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 Query
- Setup of Highcharts and PhantomJS on Windows 7. JSON string parse error
- Highcharts phantomjs export server can't parse json string
- Use String as object in javascript?
- Parse json and give to category in Highcharts
- array and object handling in javascript for getting highchart json data
- Use different object property names for x and y axes
- Highcharts stacked column charts ( Parse json string for series)
- Get Key names and Values names from JSON and use in Highcharts
- Highcharts csv data loading and parse into separate array and json
- Accessing Value of JSON and use it in Highcharts
- Highchart - Unable to parse my JSON string as a variable in the series but hardcoded way seems to work fine
- how can I use rangeselector and navigation in highcharts in the given code
- How to parse and create JSON tuples with php
- Highcharts parse json string for x-axis grouped categories
- How to view and or read contents of a JSON object in C#?
- Use JSON with HighCharts and AJAX
- How to use the tooltip formatter and still display chart color (like it does by default)?
- use highchart and highstock on the same page
- python/flask/Jinja2 and Json
- Convert from string with milliseconds to date object Javascript
- Rails - convert date string into javascript date object for highcharts
- Possible to use xAxis with type "datetime" and yAxis with categories?
- Use non-emoji version of unicode character (highcharts and plain html)
- Highcharts with JSON data and multiple series
- Highcharts: How to load data from JSON to xAxis.categories and series.data?
- Query regarding why and how to use highcharts license
- how to parse json into highcharts
- AngularJS and angular-translate: Using the translate filter in an object literal
- Using PhantomJS to create HighCharts grahps server side for use in PDF creation (PHP) - results in exit code 11 from PHPs exec();
- How can i force Highcharts to use same symbols in Legend and Series?
More Query from same tag
- Implementing Custom Temperature Gauge with Angular 4 and HighCharts
- Highcharts credits link not working when exporting as PDF
- Combination of Scatter HighChart with Polynomial Chart
- How can I change a Highcharts bar color based on a third field?
- How to use highchart boost library with D3?
- Cannot give different values to diffrent Bar item click in HighChart
- Highcharts with shared and split tooptip, Is there any possible to style the hover xAxis labels?
- Plot Histograms in Highcharts
- highcharts group series click event to get all data in catagory
- In highchart of column type and xaxis of datetime type showing more ticks for month data
- Highstock Chart - setExtremes event data missing
- horizontal scroll bar in highcharts
- Check for duplicate dates in a table mysql
- canvas image gets blurry
- yAxis Categories on Scatter Plot
- Highcharts breaks up my data array in a strange way
- is supportablerange type graph in Highchart?
- rcharts highcharts plotLines
- How to add new symbols in Highstock chart?
- Date convert to Highstock
- Highcharts gauge needles
- How to click on SVG element in highcharts to download file using Selenium
- The type or namespace name 'Highsoft' could not be found
- Hide the zero values in a Scatter/Column chart in highcharts
- Cluster zooming Error: <image> attribute x: Expected length, "NaNNaNNaNNaN"
- Highcharts and CSV, timestamps on x axis
- Drawind Dynamic series and points with Highchart and ajax
- Highcharts format legend names
- Specific graph in highcharts
- Highstocks - Display year when hovering over a point