Hello everyone
I'd like to have a horizontal line in a Line chart, to mark the average 
value of the data displayed in the chart.
So I've added a second vertical Axis and assigned a data row to it. In that 
row I fill in a constant value (the average) for every data point.
The result looks good at first glance, but there are some problems on 
second glance:

   - As the second vertical axis scales automatically, the horizontal line 
   is at the wrong place. How do i configure the second axis to have the same 
   scaling as the first axis? Is there a easy way to do that, or do I just 
   have to assign them both the same absolute scale?
   - I'd like to hide the tooltips for the Average-Line. I tried with 
   'tooltip': {1:{trigger:'none'}} but that does not seem to work. Is this 
   possible, or is the tootlip option only for the whole chart?


Thanks for your help in advance!

Here is the code:

> data_daily = new google.visualization.DataTable();
> data_daily.addColumn('date', 'Date');
> data_daily.addColumn('number', 'Average');
> data_daily.addColumn('number', 'Views');
>
> for(var i in dates_arr) // Fill in data
> {
>     data_daily.addRow([dates_arr[i], dv_averageval, view_perc_arr_day[i]])
> }
>
>  // Set chart options
>  options_daily = {'title':'Daily Views',
>                     'width':1200,
>                     'height':400,
>                     'animation':{
>                         duration: 500,
>                         easing: 'out'
>                     },
>                     'hAxis': {gridlines:{color:'#ccc', count:10}},
>                     'series': {1:{color: '#3366cc'}, 0:{targetAxisIndex:1, 
> lineWidth:1, color:'#ff5555'}}, // Assign Average-Column to 2nd Y-Axis
>                     'tooltip': {1:{trigger:'none'}}
>  };
>
>  // Create a new View, to be able to show and hide columns without 
> modifying actual data_daily table
> ViewDaily = new google.visualization.DataView(data_daily);
>                     
> // Instantiate chart, passing in some options.
> chart_daily = new google.visualization.ChartWrapper({
>           'chartType': 'LineChart',
>           'containerId': 'div_daily_views',
>           'options': options_daily
>         });
>
> chart_daily.setDataTable(ViewDaily);
>
> chart_daily.draw('div_daily_views');
>  

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at 
http://groups.google.com/group/google-visualization-api?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to