how to retrieve h/v-axis min and max values chosen by google charts in viewWindowMode "pretty" (default) ?

345 views
Skip to first unread message

K W

unread,
Dec 1, 2015, 1:27:18 PM12/1/15
to Google Visualization API
My chart uses the default viewWindowMode of "pretty".   I'd like to implement some custom controls to zoom the chart in a particular way, and I'd like to set the range of these controls to the same min and max values with which the chart is displayed initially (the values inferred from my data set).   I'd rather not use "maximized" mode, which would make this simpler, but not as clean.  Is this possible, and if so, how?  I'm using ChartWrapper.

Daniel LaLiberte

unread,
Dec 1, 2015, 1:52:30 PM12/1/15
to Google Visualization API
You can find out how the chart has determined the axis bounds by using the ChartLayoutInterface feature.    The documentation for it is rather minimal, but see https://developers.google.com/s/results/?q=getChartLayoutInterface&p=%2Fchart and discussions here:  https://groups.google.com/forum/#!searchin/google-visualization-api/ChartLayoutInterface

Hope that helps.

On Tue, Dec 1, 2015 at 1:27 PM, K W <kea...@gmail.com> wrote:
My chart uses the default viewWindowMode of "pretty".   I'd like to implement some custom controls to zoom the chart in a particular way, and I'd like to set the range of these controls to the same min and max values with which the chart is displayed initially (the values inferred from my data set).   I'd rather not use "maximized" mode, which would make this simpler, but not as clean.  Is this possible, and if so, how?  I'm using ChartWrapper.

--
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 http://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-visualization-api/23f332f5-f755-4448-b524-c6d9832d79e6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
dlaliberte@Google.com   5CC, Cambridge MA
daniel.laliberte@GMail.com 9 Juniper Ridge Road, Acton MA

K W

unread,
Dec 1, 2015, 2:31:57 PM12/1/15
to Google Visualization API
Thank you very much!   I never could get any google searches to land on these pages in response to many phrasings of the original question.
After playing with the calls available on ChartLayoutInterface, I found the following sequence gives me the value to set vAxis.viewWindow.max to in order to recreate the initial inferred graph layout:

var theChart = chart.getChart();
var cli = theChart.getChartLayoutInterface();
var bb = cli.getChartAreaBoundingBox();
var vAxisMax = cli.getVAxisValue(bb.top);


On Tuesday, December 1, 2015 at 10:52:30 PM UTC+4, Daniel LaLiberte wrote:
You can find out how the chart has determined the axis bounds by using the ChartLayoutInterface feature.    The documentation for it is rather minimal, but see https://developers.google.com/s/results/?q=getChartLayoutInterface&p=%2Fchart and discussions here:  https://groups.google.com/forum/#!searchin/google-visualization-api/ChartLayoutInterface

Hope that helps.
On Tue, Dec 1, 2015 at 1:27 PM, K W <kea...@gmail.com> wrote:
My chart uses the default viewWindowMode of "pretty".   I'd like to implement some custom controls to zoom the chart in a particular way, and I'd like to set the range of these controls to the same min and max values with which the chart is displayed initially (the values inferred from my data set).   I'd rather not use "maximized" mode, which would make this simpler, but not as clean.  Is this possible, and if so, how?  I'm using ChartWrapper.

--
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-visualization-api+unsub...@googlegroups.com.



--
dlali...@Google.com   5CC, Cambridge MA
daniel.l...@GMail.com 9 Juniper Ridge Road, Acton MA
Reply all
Reply to author
Forward
0 new messages