编辑:
现在我有一个图表,所有的数据都被推到了右边,但是我有不同颜色的标签来显示我想要显示的集合,但没有数据?更新了我的代码。
原帖: 我在这里有一个工作的高级图表http://opensourcesurf.com/chart.html。问题是当我尝试改变单个数据集的颜色时,它们全部改变了。怎样才能在我的代码中改变这些设置呢?提前感谢!
代码:
原帖: 我在这里有一个工作的高级图表http://opensourcesurf.com/chart.html。问题是当我尝试改变单个数据集的颜色时,它们全部改变了。怎样才能在我的代码中改变这些设置呢?提前感谢!
代码:
var options1 = {
chart: {
renderTo: 'container1',
type: 'area'
},
xAxis: {
type: 'datetime'
},
series: [{
name: 'Swell Period',
color: '#0066FF',
data: 'newSeriesData',
},
{ name: ' Maximum Breaking Wave Height',
color: '#ffffff',
data: 'newSeriesData',
},
{ name: 'Swell Height',
color: '#123456',
data: 'newSeriesData',
}],
};
var drawChart = function(data, name, color) {
var newSeriesData = {
name: name,
data: data
};
// Add the new data to the series array
options1.series.push(newSeriesData);
// If you want to remove old series data, you can do that here too
// Render the chart
var chart = new Highcharts.Chart(options1);
};
$.getJSON('decode.php', function(data){
drawChart(data, 'Swell Height');
});
$.getJSON('decode2.php', function(data){
drawChart(data, ' Maximum Breaking Wave Height');
});
$.getJSON('decode3.php', function(data){
drawChart(data, 'Swell Period');
});