|
Y Axis scale |
Posted by Luke on Jan-10-2010 11:37 |
|
Hello,
I am using the multiline chart with VB. Instead of having the Y axis scale start at 0 I would like to set it it myself, based on the minimum value for the data. How would I modify the axis scale?
Thanks |
Re: Y Axis scale |
Posted by Peter Kwan on Jan-11-2010 23:10 |
|
Hi Luke,
ChartDirector will automatically set the axis scale based on the minimum value of the data. However, ChartDirector has a tendency to start the axis scale from 0. The tendency is configurable with a "zero affinity" parameter in setAutoScale. If you do not want ChartDirector to have the tendency to start from 0, you can set "zero affinity" to 0. For example:
Call c.yAxis().setAutoScale(0.05, 0.05, 0)
If you want to specify a minimum value yourself, you may use Axis.setLinearScale. For example, in VB6:
'set the lower limit to 10, and upper limit to auto
Call c.yAxis().setLinearScale(10, cd.NoValue)
The same code in VB.NET, VB 2002/2003/2005/2008 is:
c.yAxis().setLinearScale(10, Chart.NoValue)
Hope this can help.
Regards
Peter Kwan |
Re: Y Axis scale |
Posted by Jean-Luc on Nov-24-2016 03:04 |
|
Dear Peter,
inside a financeChart I created an XYchart named "SecondIndic" by using C.addIndicator.
I add data using this code:
Call SecondIndic.addCandleStickLayer(HiData, LoData, OpData, ClData, green, red, black).
Note that the Highest High is 10727, Lowest low is 10658.
I want the Yaxis to go exactly from 10658 to 10727, with no margin.
For this, I'm using:
Call SecondIndic.yAxis().setLinearScale(10658, 10727).
However the vertical scale invariably goes from 10640 to 10740.
I tried adding the following codes with no better result:
Call SecondIndic.yAxis().setAutoScale(0, 0, 0)
Call SecondIndic.yAxis().setMargin(0)
If I use:
Call SecondIndic.yAxis().setLinearScale(10630, 10750)
then the vertical scale goes from 10600 to 10750.
I tried recompilating the DLL with suppressing following lines:
Call a.setAutoScale(0, 0.05, 0)
and
Call a.setMargin(m_yAxisMargin)
in Sub configureYAxis, with no better result.
How could I have the y axis exactly adjusted to the values that I provide?
Thanks in advance! |
Re: Y Axis scale |
Posted by Peter Kwan on Nov-24-2016 17:28 |
|
Hi Jean-Luc,
May be you can try:
Call SecondIndic.yAxis().setRounding(False, False)
If your code do not provide the tick increment (the last parameter in setLinearScale, like in Call "myAxis.setLinearScale(50, 120, 10)"), ChartDirector will automatically determine the tick increment, and then extend the axis if necessary to make sure it starts and ends at a tick position. The Axis.setRounding can be used to disable this extension.
Hope this can help.
Regards
Peter Kwan |
Re: Y Axis scale |
Posted by Jean-Luc on Nov-24-2016 19:10 |
|
Bingo! As usual, exactly what what I needed
Thanks a lot Peter! |
|