score:1
Accepted answer
I fixed the issue by adding the values to the chart as data [[x,y], [x,y], ...].
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
<script src="http://code.highcharts.com/highcharts.js"></script>
</head>
<body>
<div id="container" style="position:absolute;bottom:0px;right:0px;left:0px;top:0px;"></div>
<script>
var data = [
['Time', 'dataset 1', 'dataset 2'],
[0, 0,2],
[0.2, 2,3],
[0.3, 2.3,4.7],
[0.6, 2,6.2],
[1, 3.1, 3.1],
[3, 3.5, 3.0],
[3.4, 2.8, 1.7]
/* ... */
];
$(function () {
// reformat data
var seriesData = [];
// add series json with nametag for every label
data[0].forEach(function(name) {
seriesData.push({name: name, data: []});
});
// for every datum add it to the data field of the series data.
data.slice(1).forEach(function(datum) {
datum.forEach(function(item, i) {
seriesData[i].data.push([datum[0],item]);
});
});
$('#container').highcharts({
chart: {
zoomType: 'x'
},
title: {
text: 'Title',
x: -20
},
xAxis: {
},
yAxis: {
plotLines: [{
value: 0,
width: 1,
color: '#808080'
}]
},
legend: {
layout: 'vertical',
align: 'right',
verticalAlign: 'middle',
borderWidth: 3
},
series: seriesData.slice(1)
});
});
</script>
</body>
</html>
Source: stackoverflow.com
Related Query
- Hide axis and gridlines Highcharts
- Change HighCharts axis title
- how to set the interval of points on Y - Axis highcharts
- How replicate the value of Y Axis on both sides of the axis in Highcharts
- Highcharts Area graph, use 2 fill colors above / below X axis
- Highcharts y axis thousands separator
- Javascript Highcharts v3.0.5 - How to hide Y Axis Title when using multiple Y Axis
- Highcharts - set maximum range for yAxis but keep axis dynamic within that range
- Highcharts how to change x axis options
- Highcharts - How to start x axis from an arbitrary value
- Highcharts - best way to handle and display zero (or negative) values in a line chart series with logarithmic Y axis
- Highcharts - Long multi-line y axis labels causing following label to be removed
- Highcharts - with datetime axis labels overlap
- Change Y Axis vertical line color in Highcharts
- How to add space between chart and axis in highcharts
- Highcharts reset y Axis
- highcharts - removing decimal places on Y axis with only one point
- Highcharts : hiding bottom-most x axis grid line
- How to change axis label size when exporting in Highcharts / Highstock
- Change HighCharts axis title in 2.1.4
- Highcharts axis label before first point
- Highcharts | Making multiple y axis scales
- Invert Y axis in Highcharts
- Highcharts blank chart with x and y axis
- Highcharts display series.name on X Axis
- Highcharts - Display only year in x axis and stop auto formatting
- Style highcharts x and y axis
- Highcharts label format with tickPositioner in a datetime x Axis
- Align y axis tick "outside" on highstock, so they are the same as on highcharts
- Dual axis using percentage and absolute value to same serie in Highcharts
More Query from same tag
- ZoomRange Highstock works not correct?
- Highcharts - JSON series data not showing correctly
- Highcharts donut separate tooltips for inner and outer pie
- [Highcharts]: TickInterval on X-Axis is not respected after chart.update();
- highcharts x-axis datetime value for one week coming wrong
- Customisation of RangeSelectors in highstock
- how to set exporting default as disable
- How to extend X axis datetime in Highchart
- HighCharts Line xas datetime
- Highcharts: Stacked bar chart display categories data, not series
- Change marker line color in highstocks
- Scrape data from graph generated with Highcharts
- JSF2, PrimeFaces, and Highcharts - Ajax
- Highcharts: align markers with xAxis
- Highcharts - Keep Zero Centered on Y-Axis with Negative Values
- Adding vertical line on xAxis in HighStock
- Export highchart for print preview
- Highchart completely loaded after animation event
- Add new series to category highcharts
- I'm trying to use HighChart map and solid guage they both work for my data independetly but I get get lot of errors on I put them on a file
- Highchart Stacked Column w/ Datetime X-axis Columns Too Thin
- Highcharts, Mysql, and Codeigniter
- URL Link in Tooltip
- Legends display order using highcharts in pie chart
- Highchart: add custom button to show/hide annotations?
- Add series to highcharts dynamically without initial data
- Plot Option in High Charts
- Highcharts Date.UTC does not work properly for real data
- Set HighCharts data from JSON string with setData() function
- Example Highcharts in ionic 4