简体   繁体   English

用不同的X轴数据集绘制Google折线图

[英]Graphing google line chart with different set of x-axis data

Hi I have the following data from an sqlite database to plot using a google line chart. 嗨,我从sqlite数据库中获取以下数据,以使用Google折线图进行绘制。 To be clear, there are 2 sets of data, I am trying for 2 lines plotted. 要明确的是,有2组数据,我正在尝试绘制2条线。 The 'none' values appear to be messing up this hope, any thoughts? “没有”的价值观似乎正在破坏这种希望,有什么想法吗? I am new to javascript, only basic python skills. 我是javascript新手,只是基本的python技能。 Thank you! 谢谢!

 <script type="text/javascript" src="https://www.google.com/jsapi"></script> <script type="text/javascript"> google.load("visualization", "1", {packages:["corechart"]}); google.setOnLoadCallback(drawChart); function drawChart() { var data = google.visualization.arrayToDataTable([ ['Time', 'Temperature', 'Temperature 2'], ['2015-02-23 05:27:16', 'None', '22.88'], ['2015-02-23 05:30:02', '28.937', 'None'], ['2015-02-23 05:42:16', 'None', '23.06'], ['2015-02-23 05:45:02', '28.875', 'None'], ['2015-02-23 05:57:16', 'None', '22.94'], ['2015-02-23 06:00:02', '28.75', 'None'], ['2015-02-23 06:12:17', 'None', '22.44'], ['2015-02-23 06:15:02', '28.562', 'None'], ['2015-02-23 06:27:17', 'None', '22.19'], ['2015-02-23 06:30:03', '28.437', 'None'], ['2015-02-23 06:42:17', 'None', '21.63'], ['2015-02-23 06:45:02', '28.375', 'None'], ['2015-02-23 06:57:17', 'None', '21.13'], ['2015-02-23 07:00:02', '28.5', 'None'], ['2015-02-23 07:12:17', 'None', '21.06'] ]); var options = { interpolateNulls: true }; var chart = new google.visualization.LineChart(document.getElementById('chart_div')); chart.draw(data, options); } 
    

Replace the "None" string by "null" and google line charts will display the chart correct. 用“ null”代替“ None”字符串,Google折线图将显示正确的图表。

In python you can replace the None by null when printing the php code via: replaced_rowstring=rowstring.replace("None","null") 在python中,通过以下方式打印php代码时,可以将None替换为null:replace_rowstring = rowstring.replace(“ None”,“ null”)

Kind regards, Nico 亲切的问候,尼科

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM