PDA

View Full Version : maximum linear axis value


tsj4
05-14-2008, 06:30 PM
For some reason if I specify the maximum value for the vertical axis the axis still does not add the maximum value as a label and maintains the labels which would have displayed without that value being defined.

example (vAxis.maximum not defined)http://www.tsj4.com/vaxis1.png


(vaxis.maximum defined)
http://www.tsj4.com/vaxis2.png

what I want is the maximum value to be the top label aligned the the top of the vAxis and all interval spaced evenly from that value.

tsj4
05-14-2008, 06:47 PM
c.verticalAxis = vAxis;
c.verticalAxisRenderer = vAxisRenderer;
vAxis.maximum = 6597069766656; // This value equals 6 TB


I have also tried to set alignLabelsToInterval to true and also autoAdjust to true. Neither method had any effect on the way the labels rendered.

tsj4
05-14-2008, 11:07 PM
Fixed it.

What I have done is:

on the result of the xml which includes the data the populates my chart, I loop through all the values to get the maximum value returned. Then that value rounded up to a whole increment (example: 2.56 GB is rounded up to 3 GB). I then set the new rounded up number as the vAxis.maximum value(vAxis.maximum = newRoundedNum). To get the vertical axis labels to display in base 10 rather then base 2 which the axis does natively I made a condition statement which checks if my newRoundedNum is greater either a PB, TB, GB, MG, and KB and based on the result I set the vAxis.interval to a quarter of that value.


if (curMaxValue > 1125899906842624){
vAxis.interval = 281474976710656;
} else if (curMaxValue > 1099511627776){
vAxis.interval = 274877906944;
} else if (curMaxValue > 1073741824) {
vAxis.interval = 268435456;
} else if (curMaxValue > 1048576) {
vAxis.interval = 262144;
} else if (curMaxValue > 1024) {
vAxis.interval = 256;
}



after all that I use my vAxisFormat function to format the labels.
http://www.tsj4.com/vaxis3.png