Hey asgallant Thanks a lot, that was exactly what I was looking for! (even if it is more a workaround, but anyway) I made a feature request (I hope, that it is comprehensible...): http://code.google.com/p/google-visualization-api-issues/issues/detail?id=1159 If you'd like to, you can give it a star ;-) Thanks again!
Am Samstag, 23. Februar 2013 18:10:07 UTC+1 schrieb asgallant: > > There's no way to turn off the tooltip for only one data series (though > it's a good idea, if you'd like to make a feature > request<http://code.google.com/p/google-visualization-api-issues/issues/list>for > it). The solution here is a little bit complicated. You need to add > two extra rows of data to your DataTable; one right before your real data > set, and one right after. Give these two rows date values outside your > real data set, set views to null, and set the average column to the > average. In the real data set, make the average column null. Set the > chart's interpolateNulls option to true and the hAxis.viewWindow.min/max > options to the dates at the ends of your real data set (so the average rows > will be outside this range). You will get an average line through the > chart without any tooltips. See an example here: > http://jsfiddle.net/asgallant/UAFUM/ > > On Friday, February 22, 2013 7:01:18 PM UTC-5, [email protected]: >> >> 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.
