Hello Michal,
But when the chart window is getting too small, the area within the axes becomes invisible and then suddenly leftRange becomes as big as the entire chart height. It seems that CalcPosValue() doesn't return the right value in such a case. Have anyone seen this behavior? How to go around it?
I think it is related with last thread if you submit us
http://www.teechart.net/support/viewtop ... 078#p44078 . May be, when solved one, the other will be solved too.
On the other hand, I recommend using tChart.Rect instead of tChart.Bounds, because when you calculate values of chart and her axis you calculate values of chartRect. For example you could do next:
Code: Select all
Rectangle rect = new Rectangle();
rect = tChart1.Chart.ChartRect;
int topEdge =rect.Top + tChart1.Axes.Top.Position + 1;
int bottomEdge =tChart1.Axes.Left.CalcPosValue(tChart1.Axes.Left.Inverted ? tChart1.Axes.Left.Maximum : tChart1.Axes.Left.Minimum);
int leftRange = bottomEdge - topEdge;
As you see, the only change that I made in your code is Chart.Rect. Please, check if it is a solution for you.
I hope will helps.
Thanks,