ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  YAxis value range in AutoScale Mode
Posted by Mahbub on Sep-23-2011 03:51
Attachments:
Dear Peter, I have a candlestick chart which has autoscale Y axis. Sometimes YAxis starts at 450 and ends at 1450 (according to stock price) and sometimes at other values. How can I get these range scale (or Maximum and Minimum values) in my program?

I'm attaching a picture.

Waiting for your kind response..
YScale.JPG

  Re: YAxis value range in AutoScale Mode
Posted by Mahbub on Sep-23-2011 13:37
I have used Finance Chart. How can I get YAxis 's Highest and Lowest Value?

Another thing, There is no AddMark option in FinanceChart. How can I add Mark in Finance Chart.

Thanks.

  Re: YAxis value range in AutoScale Mode
Posted by Mahbub on Sep-23-2011 13:44
My Code:

Dim m As FinanceChart = New FinanceChart(chrtWidth)
m.setData(timeStamps, highData, lowData, openData, closeData, volData, extraPoints)
m.setPlotAreaStyle(&HFFFFF0, &HDDDDDD, &HDDDDDD, &HDDDDDD, &HDDDDDD)
m.setMargins(40, 0, 45, 20)
m.setPlotAreaBorder(0, 0)

m.addMainChart(mainHeight)

........................

  Re: YAxis value range in AutoScale Mode
Posted by Peter Kwan on Sep-24-2011 01:34
Hi Mahbub,

In a FinanceChart, there can be multiple XYCharts (eg. the main price chart, and a number of technical indicator charts). Each chart can have multiple axes (eg. the main price chart can have an axis for the price and an axis for the volume).

To get the axis range for the axis you want, you may use Axis.getMinValue and Axis.getMaxValue. Because the axis is auto-scaled, it means you must enter all the data, configure your entire chart, and enter layout the chart (using BaseChart.layout) or draw the chart first, because ChartDirector can determine the axis scale.

For example, suppose you want to obtain the price axis range of the main price chart, the code is like:

Dim m As FinanceChart = New FinanceChart(chrtWidth)
.......................
Dim myMainPriceChart = m.addMainChart(mainHeight)
........................

'after entering all the data, and configuring the charts, you may call layout to
'ask ChartDirector to auto-scale the axis
m.layout()

Dim minY As Double = myMainPriceChart.yAxis().getMinValue()
Dim maxY As Double = myMainPriceChart.yAxis().getMaxValue()

Hope this can help.

Regards
Peter Kwan

  Re: YAxis value range in AutoScale Mode
Posted by Peter Kwan on Sep-24-2011 01:37
Hi Mahbub,

For adding a mark, the addMark is a method of the Axis object. The addMark method is available on any chart that has Axis objects, including FinanceChart. For example:

myMainPriceChart.yAxis().addMark(100, &H123456)

Hope this can help.

Regards
Peter Kwan

  Re: YAxis value range in AutoScale Mode
Posted by Mahbub on Sep-24-2011 13:22
Thanks Peter. Now it works fine.