[visualization-api] AnnotatedTimeLine: Hide legend when no value on mouse position

132 views
Skip to first unread message

Jojo1309

unread,
Feb 28, 2012, 3:48:35 AM2/28/12
to google-visua...@googlegroups.com

Hi,

I'm using Visualization API, and specially, the annotatedtimeline graph.

I want to do several things:

- First, in the legend, I want to display only the legends of the curves currently on the mouse position. For example, in the sample code I provide, when the mouse is on the red curve, I don't want to see the blue legend. I didn't find how to to this.

- I also want to display log scale

- And then, is it possible to display reverse scales?

Thanks for any help

Johann

function drawVisualization()

{

 var data = new google.visualization.DataTable();


data.addColumn('datetime', 'Heure');

data.addColumn('number', 'Curve1');

data.addColumn('number', 'Curve12');


data.addRows(16);

data.setValue(0, 0, new Date(2011, 7 ,22 ,1 ,0));

data.setValue(0, 1, 0);

data.setValue(1, 0, new Date(2011, 7 ,22 ,1 ,15));

data.setValue(1, 1, 0);

data.setValue(2, 0, new Date(2011, 7 ,22 ,1 ,30));

data.setValue(2, 1, 0);

data.setValue(3, 0, new Date(2011, 7 ,22 ,1 ,45));

data.setValue(3, 1, 0);

data.setValue(4, 0, new Date(2011, 7 ,22 ,4 ,15));

data.setValue(4, 2, 0);

data.setValue(5, 0, new Date(2011, 7 ,22 ,4 ,30));

data.setValue(5, 2, 10);

data.setValue(6, 0, new Date(2011, 7 ,22 ,4 ,45));

data.setValue(6, 2, 100);

data.setValue(7, 0, new Date(2011, 7 ,22 ,5 ,0));

data.setValue(7, 2, 10000);

data.setValue(8, 0, new Date(2011, 7 ,22 ,5 ,15));

data.setValue(8, 2, 10);

data.setValue(9, 0, new Date(2011, 7 ,22 ,5 ,30));

data.setValue(9, 2, 15);

data.setValue(10, 0, new Date(2011, 7 ,22 ,5 ,45));

data.setValue(10, 2, 20);

data.setValue(11, 0, new Date(2011, 7 ,22 ,6 ,0));

data.setValue(11, 2, 18);

data.setValue(12, 0, new Date(2011, 7 ,22 ,6 ,15));

data.setValue(12, 2, 0);

data.setValue(13, 0, new Date(2011, 7 ,22 ,6 ,30));

data.setValue(13, 2, 0);

data.setValue(14, 0, new Date(2011, 7 ,22 ,6 ,45));

data.setValue(14, 2, 0);

data.setValue(15, 0, new Date(2011, 7 ,22 ,7 ,0));

data.setValue(15, 2, 0);


Here's my sample code:

var formatter_short = new google.visualization.DateFormat({pattern: 'dd/MM/yyyy HH:mm'});

formatter_short.format(data, 0);


var timeline = new google.visualization.AnnotatedTimeLine(document.getElementById('visualization'));

timeline.draw(data, {

  'displayAnnotationsFilter': true,

  'displayExactValues': false,

  'dateFormat' : 'dd MMMM yyyy HH:mm:ss',

  'legendPosition': 'newRow',

  'displayRangeSelector' : false, 

  'displayZoomButtons': false,

  'fill' : 30,

  legend:'bottom'

});

}

asgallant

unread,
Feb 28, 2012, 9:56:00 AM2/28/12
to google-visua...@googlegroups.com
I don't believe any of the things you want are possible with the ATL charts.  Regular line charts allow you to use a log scale and/or reverse the vertical axis direction (which is what I assume you mean by "reverse scale"), and, with some hackery, they probably can be made to change the legend depending on which line you are hovering over.  With the annotation column role and the new ChartRangeFilters, most of the ATL functionality is available to LineCharts.

Jojo1309

unread,
Feb 28, 2012, 11:51:51 AM2/28/12
to google-visua...@googlegroups.com
HI,

thanks for the answer, I'll have a llok to regular line chart.

johann
Reply all
Reply to author
Forward
0 new messages