score:2
Accepted answer
you are overwriting the name
and data
nodes of your newseries
object each time you loop, by declaring them outside of the loop in that way.
i would turn this:
$.getjson('/uploads/test.json', function (list) {
var newseries = {
name: '',
data: []
};
$.each(list, function (i, item) {
newseries.name = item.name;
newseries.data = item.data;
options.series.push(newseries);
});
var chart = new highcharts.chart(options);
into something more like this:
$.getjson('/uploads/test.json', function (list) {
var newseries;
$.each(list, function (i, item) {
newseries = {};
newseries.name = item.name;
newseries.data = item.data;
options.series.push(newseries);
});
var chart = new highcharts.chart(options);
although really, in your case, you don't need to loop at all, because your return json is already in the proper format for highcharts.
you can try something like
$.getjson('/uploads/test.json', function (list) {
options.series = list;
var chart = new highcharts.chart(options);
instead (untested, might need to be tweaked).
score:2
please try this:
$.each(list, function (i, item) {
if(item.name!=undefined){
options.series.push({
name:item.name,
data:item.data
});
}
});
Source: stackoverflow.com
Related Query
- Highcharts with multiple series from JSON Dynamically
- Charts using Highcharts with multiple series from JSON
- Highcharts with multiple series from JSON
- highcharts with dynamically adding multiple series from JavaScript array name value pair
- Highcharts multiple series from JSON with different style depending on serie name
- Highcharts with JSON data and multiple series
- Highcharts - How to make a scatter plot with multiple series from HTML table
- Highcharts multiple series json from php
- Highcharts with JSON to customize multiple series
- Creating a Highchart with multiple series from a JSON file
- Extract data series from a JSON array for a Highcharts chart with 2 y-axis
- Loading json data to highcharts with multiple series
- How to have multiple highcharts with different series data in vuejs without repeating code
- Add Categories and Series dynamically from JSON in HighCharts
- Highcharts with values from multiple JSON file
- How to dynamically addEvent to Highcharts series with multiple charts?
- Plotting multiple series from JSON php import to Highcharts
- Plotting multiple series in single Highcharts plot from JSON
- Highcharts multiple series from json
- How to render highcharts from external json for multiple series
- How can I assign multiple series from my json data? Highcharts
- How to make multiple Y-axis with incoming series of data from database using Highcharts
- Issue with tooltip on Highcharts with multiple series added dynamically
- Highcharts displays series names but missing data points from json source
- adding series to highcharts from JSON
- Adding a series dynamically with HighCharts Stock Charts
- Multiple Series Timeline with HighCharts
- Highcharts not displaying series data for graph with multiple Y-axes
- Click events on highcharts with multiple series
- Highcharts async Server Loading with multiple series
More Query from same tag
- ERROR TypeError: Cannot set property 'proceed' of undefined
- Add time-stamp data from multiple csv files to highchart
- Highmaps drill down map select event
- Highchart How to set pie chart sliced distance gap wider to one another
- Offset displayed data 4 hours forward on HighCharts x axis
- Angular-chart.js graph highlight
- How do I make a fixed range?
- Highcharts. Is it possible to show data labels programmatically
- Compare two pie-charts with same data name (Highcharts)
- HighMaps how to update data using jQuery
- Highmaps mulitple series can't seen without disable one
- Add initial and final date to Range Selector Highstock
- How to highlight specific Point with Highcharts Js
- Load chart with some series/legend items hidden by default
- Highcharts multi line graphs
- Issue on Drawing Highcharts From Selected Row Table
- How to make a multi pane on highstock (highcharts) which contain a stacked area graph?
- Line Chart using array
- What kind of charts library is being used on this Huffington Post page?
- Highcharts legend hover for bar chart?
- Highcharts : How to fix labels to the top when xAxis rotation is 90°?
- Highstock plotting images that follow series when scrolling
- Using modified JS version in Highcharts to bring back the pre-3.0 export buttons
- Compare one month of two year with Highcharts
- Highcharts not plotting datetime series
- Highchart.js is not working properly in pure IE8
- Update Highcharts tooltip with onchange
- How to import highchart-more into angular 4 project
- TEMP_DATA value must be same but it is changing
- Adding round corners to Highcharts Bar Chart with stacked bars when value is 0