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 Articles
- 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
- Highcharts load pointStart from JSON. Milliseconds to UTC time?
- Highcharts JSON, chart not displaying
- Highchart - Changing label text of the yaxis programatically
- Highstock, True way of Get count of shown points after setExtreme (Zooming) - WITHOUT counting all data with MIN and MAX
- array and object handling in javascript for getting highchart json data
- Trying to inject datapoints into iOS webView using highcharts
- Highcharts matching specific series points (yaxis) with xaxis?
- HighCharts, HighChartTable - pie chart default slice
- Remove Square Bracket From Array Key PHP
- omit top border of highcharts chart
- highcharts sum up tooltip {point.y} with a specific number
- Two pies, one legend with unique items (merge legends)
- Highcharts animate marker
- How to achieve this graph with highcharts
- how to show text in center in highcharts?
- Highcharts - append % to first axis label?
- Highcharts using Django-Chartit. Chart lines not displayed without window resize, or Inspect Element
- Rails collecting and rendering JSON data in to a Highcharts graph
- how to render multiple line charts - highcharts on same page using highcharts react wrapper - highcharts-react-offical
- Moving Average Line in Highcharts Scattered Chart