简体   繁体   English

x轴上单个日期的多个y轴值-Google visualzation API

[英]multiple y-axis values for single date on x-axis - google visualzation api

I need to draw a chart based on some values given. 我需要根据给定的一些值绘制图表。

This is how my data looks like... 这就是我的数据的样子...
(Date on xAxis and Values on yAxis) (日期在xAxis上,值在yAxis上)

|| Date       || X1 || X2 || X3 ||
|| 01-01-2008 ||  1 ||  2 ||  3 ||
|| 01-01-2008 ||  2 ||  3 ||  4 ||
|| 01-02-2008 ||  1 ||  2 ||  3 ||
|| 01-03-2008 ||  1 ||  2 ||  3 ||
|| 01-04-2008 ||  1 ||  2 ||  3 ||

So now in the graph i need to get a straight vertical line for first two values plotted. 因此,现在在图形中,我需要获得绘制的前两个值的垂直直线。

But the line chart from visualization api is showing two separate columns for first two date values... 但是可视化api的折线图显示了前两个日期值的两个单独的列...

ie,

xAxis - Jan 01, 2008 || Jan 01, 2008 || Feb 01, 2008 || Mar 01, 2008 || Apr01, 2008

instead of 代替

xAxis - Jan 01, 2008 || Feb 01, 2008 || Mar 01, 2008 || Apr01, 2008

and plotting a vertical straight line for Jan 01, 2008 并绘制2008年1月1日的垂直直线

the graph should have vertical straight line for Jan 01, 2008 without omitting the     duplicate values...
so that the two values that are against Jan 01, 2008 are displayed vertically

Please help me solve this. 请帮我解决这个问题。

Use the Set collections for storing the values, A set is a collection that contains no duplicate elements. 使用Set集合存储值。Set是一个不包含重复元素的集合。 So once you store "Jan 01,2008", it will not allow duplicates. 因此,一旦存储了“ 2008年1月1日”,将不允许重复。

use any implementation class of Set, 使用Set的任何实现类,

//create a hashset
HashSet<String> xAxis = new HashSet<String>();

//and store values like this

xAxis.add(date1)
xAxis.add(date2)

here im assuming you are storing String values, but you can change it according to your need. 此处我假设您正在存储字符串值,但是您可以根据需要进行更改。

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

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