How to put a max value for the chart

3,351 views
Skip to first unread message

deltaaruna

unread,
Feb 23, 2012, 6:33:37 AM2/23/12
to Google Visualization API
Hi all,
I am using google visualization datasource 1.02 java API.
I want put a maximum limit for my chart. Here is my code. I am using
query the DB and generate the data table fro the chart.

var options2 = {
width: 1000, height: 500,
title: 'The Results',
vAxis: {max: 10000000}
};

var data2 = response.getDataTable();
var chart = new
google.visualization.ColumnChart(document.getElementById('chart_div'));
chart.draw(data2,options2);

asgallant

unread,
Feb 23, 2012, 9:53:58 AM2/23/12
to google-visua...@googlegroups.com
What is the problem you are having?

M.W. Aruna Withanage

unread,
Feb 23, 2012, 10:05:03 AM2/23/12
to google-visua...@googlegroups.com
This code is not working. Although i specify the max value the chart values are stil excedding the limit

On 23 February 2012 20:23, asgallant <drew_g...@abtassoc.com> wrote:
What is the problem you are having?

--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-visualization-api/-/nCoZ-DIoUpUJ.
To post to this group, send email to google-visua...@googlegroups.com.
To unsubscribe from this group, send email to google-visualizati...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-visualization-api?hl=en.

asgallant

unread,
Feb 23, 2012, 10:25:02 AM2/23/12
to google-visua...@googlegroups.com
You need to set the vAxis.viewWindow.max option instead:

vAxis: {
    viewWindow: {max:  10000000}
}

Which places a hard limit on the maximum value displayed by the chart.  Note that your data may still contain data points higher than this; if you want to exclude data > 10000000, then you either need to specify that in your query or use a DataView to filter out those values from the data set.

M.W. Aruna Withanage

unread,
Feb 27, 2012, 11:08:07 PM2/27/12
to google-visua...@googlegroups.com
dear drew_gallant,

It worked. Thank you very much 4 ur kind help.

regards
Aruna

--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
Reply all
Reply to author
Forward
0 new messages