Hi,
I am using an automatic left axis on a chart (IAxis.Automatic property is true), and adjusting the bottom axis with the IAxis.Minimum /Maximum properties.
When I first load the data, the left axis range is very good.
If I later shrink the range on the bottom axis and the range of visible y-values becomes smaller and I would like the left axis to rescale itself automatically to match the visible data.
Is there a way to force this recalculation, or is the left axis range determined by the data loaded, including that out of sight?
I still want to leave the full range of data in the chart, so the user can drag the chart back to a different range of x-values.
Many thanks
Roger
Forcing automatic axis recalculation?
Hi Roger,
I think that you should use MinVisibleSeriesValue and MaxVisibleSeriesValue to calculate the new SetMinMax values for your Left axis.
I think that you should use MinVisibleSeriesValue and MaxVisibleSeriesValue to calculate the new SetMinMax values for your Left axis.
Code: Select all
TChart1.Axis.Left.SetMinMax TChart1.Axis.Left.MinVisibleSeriesValue(True, 0), TChart1.Axis.Left.MaxVisibleSeriesValue(True, 0)
TChart1.Axis.Left.MinimumOffset = 10
TChart1.Axis.Left.MaximumOffset = 10
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Almost there
Hi Yeray,
Thanks, that is clearly in the right direction, but I suspect it needs some sort of internal refresh or recalculation first.
What I am doing following your post is:
1. set the min/max of the bottom axis
2. calculating the visible min and max on the left axis
3. setting the min/max on the left axis
What it is doing in step 2 is giving me the vertical range that looks correct before step 1. So if I shrink the x-range, the y-range stays large and if I expand the x-range again, the y-range goes small.
Is there something I should be doing as step 1.5 to ensure that step 2 uses the updated x-range?
Many thanks
Roger
Thanks, that is clearly in the right direction, but I suspect it needs some sort of internal refresh or recalculation first.
What I am doing following your post is:
1. set the min/max of the bottom axis
2. calculating the visible min and max on the left axis
3. setting the min/max on the left axis
What it is doing in step 2 is giving me the vertical range that looks correct before step 1. So if I shrink the x-range, the y-range stays large and if I expand the x-range again, the y-range goes small.
Is there something I should be doing as step 1.5 to ensure that step 2 uses the updated x-range?
Many thanks
Roger
Hi Roger,
Yeah, maybe it lefts an InternalRepaint to force teechart to update internal variables:
Yeah, maybe it lefts an InternalRepaint to force teechart to update internal variables:
Code: Select all
TChart1.Environment.InternalRepaint
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |