我有一个从 mySQL 数据库获取的数据集。该集合包含不同系列数据的数据。
如何在谷歌图表折线图上将这些数据显示为不同的集合?我检索到的数据如下所示:
[date Value SeriesName]
[2015-10-11 23.4 Series 1]
[2015-10-11 20.3 Series 2]
[2015-10-12 24.8 Series 3]
[2015-10-15 20.0 Series 2]
[2015-10-16 19.8 Series 1]
...
谢谢 鲁珀特
最佳答案
您需要旋转数据, 1.使用sql函数(不太用户友好) 2. 手动:将每个系列连接到它自己的子查询中,因此它有自己的列。然后图表会将每一列识别为自己的系列
例如:
select
t.date,
t1.value as 'Series 1',
t2.value as 'Series 2',
t3.value as 'Series 3'
from table t
left join (select date,value from table where seriesname='series 1') t1 on t1.date=t.date
left join (select date,value from table where seriesname='series 2') t2 on t2.date=t.date
left join (select date,value from table where seriesname='series 3') t3 on t3.date=t.date
关于mysql - Google Charts 在一张表中显示多个系列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32034252/