Line Chart min value

1,371 views
Skip to first unread message

Andrew Romanov

unread,
Nov 28, 2011, 4:00:22 AM11/28/11
to Google Visualization API
Hello. Can I somehow specify minimal value shown on vertical axis so
that it becomes minimal value shown. The thing is that I want to
display ranks of names in chart and ranks go from 1 to 1000. But in
line chart left axis (rank) shows values from 0 to 1000. (although I
specify vAxis.minValue 1 )

Roni Biran

unread,
Nov 28, 2011, 3:24:05 PM11/28/11
to google-visua...@googlegroups.com
You should assign this value in the viewWindow attribute
Try to add the following options:

viewWindowMode: 'explicit', viewWindow: { min : 1 }





--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
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.


Andrew Romanov

unread,
Nov 28, 2011, 7:24:26 PM11/28/11
to Google Visualization API
Thanks. It helped a little bit. Now I don't see "0" on the top.
Although 1 isn't shown. Here is the code if you are interested:
http://pastie.org/2936220

asgallant

unread,
Nov 29, 2011, 11:40:19 AM11/29/11
to google-visua...@googlegroups.com
The problem is that the axis always wants to put 5 evenly spaced tick marks on "nice" values (nice being defined by some super-secret algorithm that I have yet to figure out completely).  The values (0, 200, 400, 600, 800, 1000) fit nicely in your chart, so it likes those.  When you try to draw with a minimum of 1, your axis no longer has "nice" values that encapsulate it.  Given your data set, there is no way to make the chart draw with a tick mark at 1.

visigoth

unread,
Nov 29, 2011, 11:51:27 AM11/29/11
to google-visua...@googlegroups.com
Hello Andrew,

Let's distinguish between 3 different elements:

1. The viewWindow - this allows you to control the visible range of values on the axis.
    In your case, if you set the minimum to 1 (instead of the default 0) then a bar with the value 1 will have a height of 0.

2. The gridlines - these are the gray lines you see. At the moment these are not configurable, but we are considering allowing the user to specify them in the future.

3. The baseline - the black line that the bars rise from.
    My guess is that in your case you would simply like the label '1' next to it. If this is so, please open a feature request asking to specify the value of the baseline next to it.

HTH,
Visigoth
Reply all
Reply to author
Forward
0 new messages