annotation chart date range out of whack with chart range

47 views
Skip to first unread message

dunba...@gmail.com

unread,
Mar 10, 2016, 10:58:38 AM3/10/16
to Google Visualization API
Hi, 

I have created an annotation chart but the chart range filter display at the bottom is way bigger than the chart x axis itself (see screenshot). Is there a simple way to fix this so that the two are aligned? 

Below are the annotation chart options I am using: 

var chart = new google.visualization.ChartWrapper({
        chartType: 'AnnotationChart',
        containerId: 'chart_div',
        dataTable: lineTable,
options: {legend:'left',
'title': label+' index',
legendPosition: 'newRow',
displayDateBarSeparator: true,
ui: { snapToData: 'true'},
chart: {
vAxis: {format: '#,###', title: label},
hAxis: {textStyle: {fontSize: 10, fontName: 'Times-Roman'}},
colors: [ "violet", "turquoise"],
                      'width':800,
                      'height':500,
backgroundColor: 'transparent',
crosshair: { trigger: 'focus' },
legend: { position: 'right' },
interpolateNulls: true}
}
});

Thank you, 
Nick 
Screen Shot 2016-03-10 at 15.48.04.png

Daniel LaLiberte

unread,
Mar 10, 2016, 11:19:53 AM3/10/16
to Google Visualization API
Hi Nick,

Your chart.width option is causing the main chart to be the size you specified.  If you want the overall AnnotationChart to have a particular width and height, make sure you specify those options at the top level of the options, not inside the 'chart' suboptions.

--
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 google-visualizati...@googlegroups.com.
To post to this group, send email to google-visua...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-visualization-api/21d65fc7-c831-4033-8d14-7914a672c787%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Nick Dunbar

unread,
Mar 10, 2016, 11:36:13 AM3/10/16
to google-visua...@googlegroups.com
Hi Dan, 

That fixed it - obvious when you think about it. A big thank you. 

A couple of things possibly related -
 options: {legend:'left',
'title': label+' index',
Don't seem to work - the legend is on the right and there is no title. How do I fix that? 
And do you know how I can change the font size of the legend for the annotation chart? 

Thanks again, 

Nick 

--
You received this message because you are subscribed to a topic in the Google Groups "Google Visualization API" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-visualization-api/9yqnV3H6ofw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-visualizati...@googlegroups.com.

To post to this group, send email to google-visua...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-visualization-api.

Daniel LaLiberte

unread,
Mar 10, 2016, 11:55:35 AM3/10/16
to Google Visualization API
The AnnotationChart legend at the top of the main chart is done with HTML, so you could modify it with CSS, at least for now.

Not all the normal corechart options are available for the AnnotationChart itself, though many are for the 'chart' suboption.  Check the options documented here:  https://developers.google.com/chart/interactive/docs/gallery/annotationchart#configuration-options  

In particular, 'legend' is not supported at the top level, and the legend is actually implemented outside the main chart.  More work in this area is required.


For more options, visit https://groups.google.com/d/optout.

Nick Dunbar

unread,
Mar 10, 2016, 12:46:44 PM3/10/16
to google-visua...@googlegroups.com
Ok, thank you for clarifying. Is there any way I can set a minimum zoom size, such as 1 day? Chart range filter in dashboards lets you do that, but I don't know if that works here. 
Thanks, 
NIck 

Daniel LaLiberte

unread,
Mar 10, 2016, 1:17:29 PM3/10/16
to Google Visualization API
You can specify 'range' options to modify the ChartRangeFilter.  

There are a couple of undocumented options regarding the zoom buttons, if you want to customize them:  https://groups.google.com/d/msg/google-visualization-api/pzZoRUn5oLA/RQs6RSeJXr4J


For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages