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

Message ListMessage List     Post MessagePost Message

  Problem with scale change
Posted by Alexander on Aug-30-2017 17:32
Attachments:
Hello,

I found a problem, when change scale of the main chart.
If asset has a strong downtrend, the lib takes many space for indicators (see examples).
When I try to change scale limits, the lib draws indicators above top one (see examples).

Downtrend code:
`
def down_trend(d):
    for i in range(1, len(d)):
        d[-i] *= i/2
    return d
`

Change scale code:
`
# mainChart.yAxis().setRounding(False, False)
limit_min = min(lowData[-noOfDays:])
limit_max = max(highData[-noOfDays:])
mainChart.yAxis().setLinearScale(limit_min, limit_max)
`
many_space_for_indy.png
sma_above_rsi.png

  Re: Problem with scale change
Posted by Peter Kwan on Aug-31-2017 01:28
Hi Alexander,

By default, ChartDirector will auto-scale the axis to a reasonable scale that can accommodate the chart representation (all the lines, candlesticks, etc). You can use Axis.setLinearScale to change the axis scale, but then some of the representation (the line in your case) may go outside the axis scale. You can use XYChart.setClipping to ask ChartDirector to clip the representation to the plot area. For example:

#clip to plot area
mainChart.setClipping()

Hope this can help.

Regards
Peter Kwan

  Re: Problem with scale change
Posted by Alexander on Aug-31-2017 14:55
Thank you, that's it.