score:1
Accepted answer
I think you are trying to do something what you already have done.
You want to get display three series from your JSON, for respective categories, then let's to that:
Your code:
var categories = testDia['chartCategories'];
var series = testDia['chartSeries'];
Great! Now use that variables:
newChart = new Highcharts.Chart({
chart : {
renderTo : portletContainer,
type: 'column'
},
...
xAxis: {
categories: categories,
labels: {
rotation: -45,
align: 'right',
}
},
...
series: [{
name: 'Positive',
data: series.positive // testDia.chartSeries.positive is the same
}, {
name: 'Neutral',
data: series.neutral
}, {
name: 'Negative',
data: series.negative
}]
});
And working demo: http://jsfiddle.net/x8455/1/
score:1
Here's how you should do it.
var allPositiveData = []; // You want an array, so start off with an array.
for(var i=0; i < categories.length; i++) {
var diaPositive = series['positive'][i]['y'];
urlPositive = series['positive'][i]['url'];
allPositiveData.push({'y':diaPositive, 'url':urlPositive}); // Add the element to the array.
}
That's all there is to it. Your Highcharts-setup piece of code can remain the same.
To make the sample a little shorter, I only edited the code for the positive
data, the rest is the same, just a different name.
Source: stackoverflow.com
Related Articles
- Highcharts phantomjs export server can't parse json string
- Setup of Highcharts and PhantomJS on Windows 7. JSON string parse error
- Highcharts stacked column charts ( Parse json string for series)
- Highchart - Unable to parse my JSON string as a variable in the series but hardcoded way seems to work fine
- Highcharts parse json string for x-axis grouped categories
- Convert from string with milliseconds to date object Javascript
- Rails - convert date string into javascript date object for highcharts
- how to parse json into highcharts
- create a donut chart using highchart using jquery json object
- How to parse JSON into HighCharts line graph?
- Getting the complete XML source out of an XML DOM object
- How to Populate Highchart using Json Object
- passing json values to highcharts from .net code behind
- JSON string to Highcharts
- passing formatting JavaScript code to HighCharts with JSON
- Parsing a JSON object of arrays gives different results in IE9
- Use String as object in javascript?
- highcharts not plotting json string containing x,y pairs (string, float). how to fix?
- Loading JSON string into a pie chart in highcharts
- Parse json and give to category in Highcharts
- Create Pie chart for each Json object
- Highcharts Remote Data - JSON Object Undefined
- JSON Result for Highcharts Data Object in C#
- Strange character in the Highstock source code
- Highcharts piechart is not drawing slices from JSON object
- Highcharts / HighStock - How to parse JSON correctly
- How to process json object in highchart
- Set HighCharts data from JSON string with setData() function
- Pass Json Object from Play! framework to HighCharts JS
- Highcharts: Parse multi-variable JSON data
- Highcharts not displaying in Firefox
- Highchart's highstock tickPositions on multiple y axis
- Highcharts + add sub headers / group in legend
- HighCharts Sankey + NextJS: TypeError: Cannot read property 'Core/Series/Point.js' of undefined
- How to show a column with the value Zero in Bar chart in Highcharts?
- Highchart datetime x-axis : display end of month date instead of first day of month
- Reports with parameter working fine independently but not functional in cockpit (composite document)
- skip data point on x-axis and group by based on data in highcharts
- Highchart export in Internet explorer
- How to add markers to a grouped bar plot in Highcharts?
- highcharts datalabel text reversed
- Create Highchart (Column chart) and read data from external json file
- Highcharts how to make a set number of colors for pie chart data and drilldown data
- Highcharts stacked bar chart hide data labels not to overlap
- Highcharts Xaxis remove old data and shift left
- How to Create a Stacked Column Chart with Dynamic Series in Highcharts
- Series markers disable on lines and enable on legend in Highchart
- Is there any way to show the summation of area charts value in highcharts without using a line chart? I would like to know other alternative
- How to make hover effect for two bar in highcharts at the same time is there any way by using css or any inbuilt method to achieve this?
- Unable to correctly position the tooltip content in HighCharts