可视化组合图表双轴图表(Visualization Combo Chart dual axis ch

2019-10-22 10:54发布

IM上的报告,在这里我需要填充双轴图工作,有人可以帮我找到我怎么能impelment,这里是我需要的样品图。

我我试着去使用https://developers.google.com/chart/interactive/docs/gallery/combochart但看着这不会为我工作。

谢谢。

Answer 1:

这应该让你开始...

 google.load("visualization", "1", { packages: ["corechart"] }); google.setOnLoadCallback(drawChart); function drawChart() { var data = google.visualization.arrayToDataTable([ ["Week Ending","Actual FT", "Recommended FTE", "Other Tickets", "Router Tickets"], ["7/1", 1800, 1900, 19, 22], ["7/8", 1800, 1900, 20, 23], ["7/15", 1800, 1900, 20, 23], ["7/22", 1800, 1900, 19, 22], // .. ["9/29", 1800, 1900, 29, 30] ]); var options2 = { vAxes: [{ minValue: 1200, maxValue: 2500 }, { minValue: 17, maxValue: 30 }], curveType: 'function', hAxis: { title: "week ending" }, series: { 0: { type: "bars", targetAxisIndex: 0, color: "blue" }, 1: { type: "bars", targetAxisIndex: 0, color: "green" }, 2: { type: "line", targetAxisIndex: 1, color: "red" }, 3: { type: "line", targetAxisIndex: 1, color: "cyan" } } }; var chart = new google.visualization.LineChart(document.getElementById("chart")); chart.draw(data, options2); } 
 <script type="text/javascript" src="https://www.google.com/jsapi"></script> <div id="chart" style="width: 900px; height: 300px;"></div> 



文章来源: Visualization Combo Chart dual axis chart