score:5
I solved the problem
Changed json array as follows:
var sales = [
{ "name" : "AllProducts123|Canada", "data" :[44936.0,50752.0] },
{ "name" : "AllProducts|Mexico", "data" : [200679.0,226838.0] },
{ "name" : "AllProducts|USA", "data" : [288993.0,289126.0] }
]
Now pass it directly to series in highcharts.
series:sales
Done !!!!!
score:5
Instead of constructing the series
array manually you could loop through the sales
variable data and construct the array. So what ever the number of elements in the sales.SalesData
array, all items will be there in the series
array
var series = [],
salesData= sales.SalesData;
for (var i=0 i< salesData.length; i++) {
series.push({"name" : key, "data" : sales[key]})
}
This constructed series
array is part of the object which you must pass as argument to highcharts
method.
var chartdata = {
chart: {type: 'column'},
title: {text: 'Sales Data'},
xAxis: {
categories: ['Category 1','Category 2']
},
yAxis: {
min: 0,
title: {text: 'Sales'}
},
series : []
}
chartdata.series = series;
$('#chart').highcharts(chartdata);
where #chart is the container where you want to display the chart.
you can also refer to the fiddles which are available in their demo pages for each type of chart to know more on how to display a particular type of chart.
Source: stackoverflow.com
Related Query
- How to pass json data to highcharts series?
- How to construct HighCharts data series to match returned Json via ajax call
- How to have multiple highcharts with different series data in vuejs without repeating code
- How to pass JSON data to update Highcharts Pie chart
- Highcharts pie/bar combo. How to load json and how are the data series expressed
- Highcharts displays series names but missing data points from json source
- Highcharts how to use JavaScript variable as series data source?
- How to get multiple data series into Highcharts
- Highcharts with JSON data and multiple series
- How to pass custom data into Highcharts graph click event
- How to hide one series data info in tooltip using highcharts
- Highcharts C# To JSON - Structuring Series Data
- How to format my json data for stack column chart in HighCharts
- How to make Highcharts fetch data from external JSON file?
- Highcharts - how to create multiple y axis and group the data series
- How to align Highcharts datetime x-axis with data I pass to it?
- How to create data in Json format for highcharts
- How to create seriesfor Highcharts from JSON data to use
- How to add Series data in Highcharts from MVC
- Highcharts not working when pass the javascript variable as hightcharts series data
- how to continue the graph line when missing series of data in middle of highcharts
- HighCharts how to add live series data set to existing chart
- How to hide data in a series in highcharts boxplot?
- Yii2 How to pass php array data into highcharts
- Pass array from js for loop to highcharts series data
- How to use json data as highcharts Pie Chart?
- Extract data series from a JSON array for a Highcharts chart with 2 y-axis
- How to reference a data point (or points) in another series in highcharts
- Highcharts Single Line series JSON date data format
- Highcharts series visibility with csv data source
More Query from same tag
- Highcharts - Legend item padding
- JSON, Highcharts and Coldfusion json data
- HighCharts - How to set a max value of 100%
- Dynamic data binding to Highchart
- Is it possible to plot points on a line graph using two separate arrays? (highcharts)
- Highcharts -- Hide zero values without using 'null'
- how to set the interval of points on Y - Axis highcharts
- Is Highmaps included in the .NET wrapper?
- Eliminate the gap at the end of a range of values in Highchart Bulletchart?
- Highcharts export time stop navigating to demo page using angularjs?
- Rename the "slices" in Pie chart using Highcharts in shiny R
- Drag multiple points at one time in highcharts
- line is not visiable in HighChart
- Highcharts: how to show more info in tooltip?
- Highcharts - hold relation among multiple series after grouping / approximation
- highcharts, json data: line and column
- How can I have both years and string-formatted x-axes in two charts in HighCharts?
- Highstock inputDateParser fires three times
- Uncaught TypeError: Cannot read property 'timestamp' of undefined
- how to create multiple chart is my data is coming into xml?
- Highstock: Can we rotate 90 degrees a candlestick chart?
- How to add thousands separator in highcharts tool tip text box
- highstock ie8 error
- Highcharts - Getting a 3d effect with selected pie chart slices
- Highcharts many panes
- Error while downloading "highcharter" package in r
- Highcharts - get bottom position for each stacked category
- Highcharts : compare current value/previous value to get the rate
- Type Labels on Stacked and grouped column - Highcharts
- Reference error using High Chart's API. MVC 3