Highcharts with multiple series from JSON
Date : March 29 2020, 07:55 AM
hope this fix your issue Can't you change that "almost" JSON to "another" JSON? Maybe something like this: [{
"name":'station 1',
"data": [ [360191600,398.625], [360191600,398.625], [360191600,398.625] ... [360191600,398.625] ]
}, {
"name":'station 2',
"data": [ [360191600,398.625], [360191600,398.625], [360191600,398.625] ... [360191600,398.625] ]
}]
data = JSON.parse(data);
var names = [];
$.each(data, function (i, ligne) {
var ind = names.indexOf(ligne.name),
splited = ligne.data.split(','),
x = parseFloat(splited[0]),
y = parseFloat(splited[1]);
if (ind == -1) {
/*series name spotted first time need to add new series */
ind = names.push(ligne.name) - 1;
options.series.push({
data: [],
name: ligne.name
});
}
if(!isNaN(x) && !isNaN(y)){
options.series[ind].data.push([x,y]);
}
});
|
Highcharts with JSON data and multiple series
Date : March 29 2020, 07:55 AM
I think the issue was by ths following , You should look at this: http://api.highcharts.com/highcharts#series.dataIf you specify each point as an object, you can add any property you want to each point and access it in your tooltip formatter through this.point. var seriesArr = [];
$.each(jdata, function(key, data) {
var series = {name : key, data : []};
$.each(data.y, function(index, value) {
series.data.push({y: value });
});
$.each(data.n, function(index, value) {
series.data[index].n = value;
});
seriesArr.push(series);
});
seriesArr : [{
name : 'Total',
data : [
{y:9.39, n:9.62},
...
]
},
...
]
tooltip: {
formatter: function () {
return 'Y value is : ' + this.point.y + '<br>' + 'N value is : ' + this.point.n;
}
},
|
Retrieving JSON data for Highcharts with multiple series?
Date : March 29 2020, 07:55 AM
it fixes the issue I've been looking through tons of examples but I can't seem to get my code to pull out the data. The chart is blank. , As per Pal's comment - changed it to this: val1.push([value[0], value[1]]);
val2.push([value[0], value[2]]);
|
Highcharts: create multiple series grouped my month and year using JSON data
Date : December 02 2020, 10:46 PM
should help you out You can achieve it simply by creating a Date object using different parameters. Instead of the string date parameter new Date('2019-07-07') use year and month as separate parameters like that: new Date(2019, 7). var json = [{
month: 6,
year: 2019,
starts: 21278998,
completes: 9309458
}, {
month: 7,
year: 2019,
starts: 38850115,
completes: 17790105
}];
var series1 = {
name: 'starts',
data: []
},
series2 = {
name: 'completes',
data: []
};
json.forEach(elem => {
series1.data.push({
x: +new Date(elem.year, elem.month),
y: elem.starts
});
series2.data.push({
x: +new Date(elem.year, elem.month),
y: elem.completes
});
});
Highcharts.chart('container', {
chart: {
type: 'spline'
},
xAxis: {
type: 'datetime'
},
series: [
series1,
series2
]
});
|
Highcharts - how to create multiple y axis and group the data series
Date : March 29 2020, 07:55 AM
|