我需要使用Google Charts API或任何这样的JS插件创建折线图:
答案 0 :(得分:0)
Google图表有一个趋势线选项: https://developers.google.com/chart/interactive/docs/gallery/trendlines
他们的文档示例:
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
['Diameter', 'Age'],
[8, 37], [4, 19.5], [11, 52], [4, 22], [3, 16.5], [6.5, 32.8], [14, 72]]);
var options = {
title: 'Age of sugar maples vs. trunk diameter, in inches',
hAxis: {title: 'Diameter'},
vAxis: {title: 'Age'},
legend: 'none',
trendlines: { 0: {} } // Draw a trendline for data series 0.
};
var chart = new google.visualization.ScatterChart(document.getElementById('chart_div'));
chart.draw(data, options);
}
我已经将它与他们的LineChart一起使用而没有任何问题。