|
Problem with scale change |
Posted by Alexander on Aug-30-2017 17:32 |
|
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)
`
|
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. |
|