Java Counterpart for VB "FigureIncrement"
Posted: Mon Jul 14, 2008 10:55 pm
I am coding in Java what has been coded in the same application in VB in order to match the same appearance of numerous graphs.
One of the graphs is a 2d line graph with "years" across the bottom and account values on the left. I am graphing anywhere from 7 to 12 xy coordinates. The VB application keeps up with the smallest and the largest value - then sets the Left axis minimum and maximum value (which I am also doing in Java) - but it also uses the method Figure Increment - and for one example the left axis has 5 increments - 5,000,000; 7,500,000;10,000,000, 12,500,000, and 15,000,000.
The values that were plotted were 5314922,6258615,6258615,6653647,6655367,7303844,7303844,8642993,8726223,10690395,10782157,13230826
VBCode:
dTemp = dMax - dMin
dMax = dMax + (dTemp * 0.25)
dMin = dMin - (dTemp * 0.25)
If (dMin < 0) Then dMin = 0
.Axis.Left.SetMinMax dMin, dMax
.Axis.Left.Increment = FigureIncrement(dTemp)
Java Code:
myChart.getAxes().getLeft().setMinimum(dMin);
myChart.getAxes().getLeft().setMaximum(dMax);
dMin was 2942293.5 and dMax was 1.52885325E7
My Java graph axis starts at 5,500,000 and increments by 500,000 to 13,000,000.
How do I get it to mimic the VB code?
One of the graphs is a 2d line graph with "years" across the bottom and account values on the left. I am graphing anywhere from 7 to 12 xy coordinates. The VB application keeps up with the smallest and the largest value - then sets the Left axis minimum and maximum value (which I am also doing in Java) - but it also uses the method Figure Increment - and for one example the left axis has 5 increments - 5,000,000; 7,500,000;10,000,000, 12,500,000, and 15,000,000.
The values that were plotted were 5314922,6258615,6258615,6653647,6655367,7303844,7303844,8642993,8726223,10690395,10782157,13230826
VBCode:
dTemp = dMax - dMin
dMax = dMax + (dTemp * 0.25)
dMin = dMin - (dTemp * 0.25)
If (dMin < 0) Then dMin = 0
.Axis.Left.SetMinMax dMin, dMax
.Axis.Left.Increment = FigureIncrement(dTemp)
Java Code:
myChart.getAxes().getLeft().setMinimum(dMin);
myChart.getAxes().getLeft().setMaximum(dMax);
dMin was 2942293.5 and dMax was 1.52885325E7
My Java graph axis starts at 5,500,000 and increments by 500,000 to 13,000,000.
How do I get it to mimic the VB code?