Page 1 of 1

Multiple custom y-axes and zooming

Posted: Tue Apr 12, 2011 12:57 pm
by 15659035
Hi

We have been using the TeeChart Active X component for some years now. Now moving to the .Net version, a couple of issues have arisen.
As we often use multiple y-axes, we only use custom y-axes to be able to treat all in the same manner. Also we at all time only have one x-axis, in DateTime units. This is also a custom axis.
Perhaps I should also mention that when the user performs a zoom-gesture the zoomed area is shown in a separate window. Please see below
Now using
Steema.TeeChart.TChart.Zoom.ZoomRect(new Rectangle(x, y, width, height));
causes some problems. When zooming into a small time span the charts x-alignment goes off center
TeeChart1.jpg
x-alignment off center
TeeChart1.jpg (116.12 KiB) Viewed 8474 times
Doing exactly the same, but for a larger user defined zoom rectangle, everything look as expected.
TeeChart2.jpg
x-alignment on center
TeeChart2.jpg (124.34 KiB) Viewed 8471 times
At first I thought that perhaps it was the zoom rectangle height/width ratio. But even ensuring that the zoom rectangle has the same height/width ratio as the whole chart, does not seem to help.

Another thing. Depending on how much the user zooms, the spreading of the x-axis grid becomes nonlinear somehow:
TeeChart4.jpg
Nonlinear x-axis grid
TeeChart4.jpg (19.96 KiB) Viewed 8437 times
I’m a little lost for ideas, could you please advice?

Best Regards
Christian

Re: Multiple custom y-axes and zooming

Posted: Wed Apr 13, 2011 8:02 am
by 10050769
Hello Christian,

Could you try arrange a simple project a simple example project we can run as-is to reproduce exactly the problem here?


Thanks,

Re: Multiple custom y-axes and zooming

Posted: Wed Apr 13, 2011 9:31 am
by 15659035
Hi Sandra,

Yep sure. As I saied, we used to use your Active X component. In order to change a minimum of our orginal software, we have made a wapper project. I’ll upload that.
Please be aware that zooming for now only is done in the “Custom Zooming” region, ultimate by the
private void CustomZoomInInternal(object sender, EventArgs e)
method.

Please let me know if you need anything else.

BR
Christian

Re: Multiple custom y-axes and zooming

Posted: Wed Apr 13, 2011 2:19 pm
by 10050769
Hello Christian,
Another thing. Depending on how much the user zooms, the spreading of the x-axis grid becomes nonlinear somehow:
I am gratetful if you could you explain because if you only have one x-axis, you need a x-custom axis? I think is more easy use default bottom axis and I recommend it.
On the other hand, I couldn't run your project,because this has lost:
  • - properties folder.
    -Ellab.Debug
    -Ellab.Utilities
Is necessary that you add the properties folder because we can execute your project. So please you can send us again your project we can run here where include the properties folder.

Re: Multiple custom y-axes and zooming

Posted: Wed Apr 13, 2011 11:19 pm
by 15659035
Hi again Sandra,

Thanks for your swift reply, and sorry – I see now that what I attached earlier, was kind of useless :oops:
Anyhow – I’ve attached a simple Windows Forms VS2010 solution (ChartingSandbox.zip), taking use of our wapper class, and which will clearly show my problem. Just add your TeeChart.dll to the .. \ChartingSandbox\Ellab.Charting\DLL folder and it should build and run. Please let me know it you have any problems.
In the app, zoom in to approx 15 sec, and the series x-axis values are misaligned. Also the x-axis grid is not evenly spread. Both issues, as shown below..
TeeChart5.jpg
TeeChart5.jpg (141.3 KiB) Viewed 8393 times
Oh - and by the way - the data added to the chart, can be viewed by clicking the 'Show Data' button.

We decided to use a custom x-axis, as this would enable us, at a later date, to introduce multiple x-axes without having to keep track on which was the bottom axis and which was the custom ones. Same philosophy as with the y-axes actually.

Re: Multiple custom y-axes and zooming

Posted: Fri Apr 15, 2011 9:18 am
by 10050769
Hello Christian,

Seems the problem is that the rounding of axis labels. You can check this, adding milliseconds and changing label format as next lines of code:

Code: Select all

this.chartControl.HorizontalAxis.LabelFormat = "hh:mm:ss:fff";
Using it and doing zoom you will get next image:
Example1.jpg
Example1.jpg (109.55 KiB) Viewed 8360 times
If you calculate the difference of milliseconds there are between values of labels of bottom axis, these correspond approximately one second. I think that a good solution for you would be fixing the DateTimeSteps to a OneSecond as do in next line of code:

Code: Select all

 this.chartControl.HorizontalAxis.Increment = Steema.TeeChart.Utils.GetDateTimeStep(Steema.TeeChart.DateTimeSteps.OneSecond);
And you will get next image doing zoom that increments one second to one second:
Example2.jpg
Example2.jpg (148.53 KiB) Viewed 8359 times
Please, could you confirm us if our solution solve your problem?

I hope will helps.

Thanks,

Re: Multiple custom y-axes and zooming

Posted: Tue Apr 19, 2011 2:31 pm
by 15659035
Hi Sandra,

Your a Sweetheart - thanks a million. This was exactly what I was looking for.
And sorry for the late reply - I just now saw that you had a solution for me.

Have a nice easter weekend.
Christian