8

Using JSON Data in Highcharts

 3 years ago
source link: https://www.codesd.com/item/using-json-data-in-highcharts.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Using JSON Data in Highcharts

advertisements

I have some JSON data:

data1=[
{"date": 1396828800, "impressions": 49145385},
{"date": 1396915200, "impressions": 46704447},
{"date": 1397001600, "impressions": 47181000},
{"date": 1397088000, "impressions": 47337965},
{"date": 1397174400, "impressions": 51129266},
{"date": 1397260800, "impressions": 60547397},
{"date": 1397347200, "impressions": 62217077},
{"date": 1397433600, "impressions": 49145385},
{"date": 1397520000, "impressions": 46704447},
{"date": 1397606400, "impressions": 47181000},
{"date": 1397692800, "impressions": 47337965},
{"date": 1397779200, "impressions": 51129266},
{"date": 1397865600, "impressions": 60547397}
];

and I want to display this in Highcharts. Here is the template I am working off of: http://jsfiddle.net/hohenheim/j8cTE/9/

How can I get this data into the highcharts chart?


You need to do some processesing of your data to get it into the format highcharts wants.

for (var i=0;i< data1.length;i++) {
    data1[i] = [data1[i].date, data1[i].impressions];
}

http://jsfiddle.net/j8cTE/10/

and then use it as the series:

    series:
    [{
        data: data1
    }]

Related Articles

Create a HighCharts pie chart using JSON data

I am trying to plot a pie chart using JSON data returned from cartoDB SQL. I am using the example provided on the High Charts website but the chart is not loading. Below is my javascript code. Can you see anything wrong? $(document).ready(function()

Browse the Highchart Multi-Line Diagram using JSON Data

I tried to plot JSON data using JSON data.JSFiddle Below is my JSON data in JavaScript. var JSON = [ { name:"Maintenance", data:[[2017-06-26,1.5], [2017-07-03,5.2], [2017-07-10,1.65], [2017-07-17,2.5], [2017-07-24,1.5] ] }, { name:"Others&q

How to create an html table using JSON data?

I all, i want make table format using JSON data. I have JSON data like this var jsondata = [ { id: 1, name: 'Mani', subject: English, Score: 88 }, { id: 1, name: 'Mani', subject: Maths, Score: 65 }, { id: 2, name: 'Ram', subject: English, Score: 75 }

Using JSON data is better than database querying when there is no security problem for the data

For my new project I'm looking forward to use JSON data as a text file rather then fetching data from database. My concept is to save a JSON file on the server whenever admin creates a new entry in the database. As there is no issue of security, will

can not work live graphic stock in android using json data URL

I'm a beginner with HIGHCHARTS. I want to start from this example: http://people.canonical.com/~bradf/media/highstock/examples/basic-line/index.htm $(function() { $.getJSON('http://www.highcharts.com/samples/data/jsonp.php?filename=aapl-c.json&callba

Use Json data from the network call in UITableView

I am trying to use the data from my network call to display in the UItableview as cell names Here is my current view controller import UIKit import Alamofire import SwiftyJSON class ViewController: UIViewController, UITableViewDataSource{ var article

Need help using JSON data in the Windows application

Suppose this is my JSON data received through API... var client = new HttpClient(); var uri = new Uri("blabla.com"); var response = await client.GetAsync(uri); string result = await response.Content.ReadAsStringAsync(); [ { "id": "

Using JSON Data in ASP.NET MVC

I have not done this before, so need some leads. I have a ASP.NET MVC4 (beta) project - Mobile project - setup. And I am given a set of REST APIs to consume. How would I do this? The APIs return data in JSON format. Do you have any examples, best pra

How to Use JSON Data from a URL to Set Markers in an Android Card Activity

Hello I am new to android and I wanted to know how can I get JSON data from a url and then use that data from the URL to set markers in an android map activity. Thanks for the helpuse HttpUrlConnection to get the JSON data, and then create a new JSON

Trying to Pass JSON Data to Highcharts Without Success

I am trying to parse json data created by a php file to another script and display its values to a highchart. My data.php which creates the json data is this: <?php header("Content-type: application/json"); $dbhost = "localhost"; $d

I do not understand how to use JSON data in Xcode

I have successfully downloaded and parsed (I think) the JSON data NSURL *quoteURL = [NSURL URLWithString:@"http://www.qwoatzz.com"]; NSData *jsonData = [NSData dataWithContentsOfURL:quoteURL]; NSError *error = nil; NSDictionary *dataDictionary =

how to use JSON data in chart.js?

hi i have been trying to use data from MYSQL database and use them to create graphical chart with chart.js. i encoded data into JSON data( through a php file name data1.php), now i need to convert these Json data back to array using Jquery or javascr

How can I prevent my application from blocking unexpectedly, & ldquo; force close, when using JSON data and handle the exception instead?

In my application, I have a food activity in which the user enters his/her food, and the app requests the food, by the name entered by the user, from a MYSQL database. In the case that the entered food not exist, the string returned by the database s

How can I dynamically populate jQuery Mobile pages using JSON data?

I'm trying to get data from some external JSON (http://ip-api.com/json). I then want to use the keys to dynamically populate a listview. I want each list item to be a link, and when you click the link, the jQuery Mobile page will contain the key's ma

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK