2012-01-10 52 views
0

我需要根据给定的值绘制图表。在x轴上的单个日期的多个y轴值 - 谷歌visualzation api

这是我的数据怎么看起来像...
(X轴上和价值观上的日期Y轴)

|| 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 || 

所以现在在图中我需要获得前两直线垂直线值绘制。

但是从可视化API线图表表示第一两个日期值两个单独的列...


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

代替

xAxis - Jan 01, 2008 || Feb 01, 2008 || Mar 01, 2008 || Apr01, 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 

请帮我解决这个问题。

回答

0

使用Set集合来存储值,集合是不包含重复元素的集合。所以一旦你存储“2008年1月1日”,它不会允许重复。

使用任何实现类集,

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

//and store values like this 

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

这里IM假设你是存储字符串值,但你可以根据你的需要改变它。

+0

通过这样做,我松了一些值... 我需要在xAxis值的图表中显示一条垂直线... – Sandeep 2012-01-10 09:27:33

+0

但根据你的问题,你说你得到重复,并希望摆脱他们,请澄清/编辑您的问题,并提供一些代码。 – 2012-01-10 10:49:53

+0

对于混淆感到抱歉......我添加了一条线,它可以在2008年1月1日显示垂直直线,以避免数据混淆。 – Sandeep 2012-01-10 11:37:29