Page 1 of 1

Clipping points when using multiple custom axes

Posted: Tue Oct 12, 2004 8:29 am
by 6919168
Does anyone know if it is possible to hide or clip points when the scale of a custom axis is changed after a series has been loaded - this is to stop an overflow into adjacent chart areas using other custom axes.

Many thanks

Posted: Tue Oct 12, 2004 11:27 am
by Marjan
Hi, Richie.

You can manually clip each series to specific regioin. I think there is an example of this feature available in TeeChart .NET demo. Check the "All Features -> Axes -> Opaque zones" example.

Posted: Sat Jul 07, 2007 8:09 am
by 13045392
Hello,

How can I clip points when the scale of a custom or normal axis is changed when I zoom? There is an example in features part Features -> Axes -> Opaque zones but I do not work on windows application. I have to do that in web application and there is no event like MouseUp, MouseDown, Zoomed, UndoneZoom in there.

How can I achive this in web application?

Posted: Mon Jul 09, 2007 10:13 am
by Marc
Hello,

An option would be to fix each Axis scale so that the Maximum and Minimum is constant and zooms do not move the data out of range of the Axis space.

Another option is to apply opaque zones as per the Winform demo.
eg.

Code: Select all

protected void Page_Load(object sender, EventArgs e)
{

  //data load routine and call to CheckZoom() (see web zoom examples)

  //add event calls to the Series you want to clip:
  WebChart1.Chart[0].BeforeDrawValues += new Steema.TeeChart.PaintChartEventHandler(WebChart1Chart0_BeforeDrawValues);
  WebChart1.Chart[0].AfterDrawValues += new Steema.TeeChart.PaintChartEventHandler(WebChart1Chart0_AfterDrawValues);
}

private void WebChart1Chart0_BeforeDrawValues(object sender, Steema.TeeChart.Drawing.Graphics3D g)
{
  //  make opaque
  Steema.TeeChart.Styles.Series s = sender as Steema.TeeChart.Styles.Series;

  int left = s.GetHorizAxis.IStartPos;
  int right = s.GetHorizAxis.IEndPos;
  int top = s.GetVertAxis.IStartPos;
  int bottom = s.GetVertAxis.IEndPos;
  WebChart1.Chart.Graphics3D.ClipRectangle(left, top, right, bottom);
}

private void WebChart1Chart0_AfterDrawValues(object sender, Steema.TeeChart.Drawing.Graphics3D g)
{
  WebChart1.Chart.Graphics3D.ClearClipRegions();
}
Regards,
Marc Meumann

Posted: Mon Jul 09, 2007 2:13 pm
by 13045392
Thank you for your solution, it worked fine in c#.net but I also need to apply this code in VB ( I am a newbee in VB).
I could not find such an event like WebChart1.Chart(0).BeforeDrawValues.
This is fine in c# but I could not find an event to place this your code.
Could you please help me about this issue?

Thank you for spending your time.

Posted: Mon Jul 09, 2007 3:00 pm
by Marc
Hello,

VB syntax would be:

Code: Select all

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        'data fill
        'then..
        AddHandler WebChart1.Chart(0).BeforeDrawValues, AddressOf WebChart1Chart0_BeforeDrawValues
        AddHandler WebChart1.Chart(0).AfterDrawValues, AddressOf WebChart1Chart0_AfterDrawValues
    End Sub

    Private Sub WebChart1Chart0_BeforeDrawValues(ByVal sender As System.Object, ByVal g As Steema.TeeChart.Drawing.Graphics3D)
        'event code
    End Sub

    Private Sub WebChart1Chart0_AfterDrawValues(ByVal sender As System.Object, ByVal g As Steema.TeeChart.Drawing.Graphics3D)
        'event code
    End Sub
Regards,
Marc

Posted: Tue Jul 10, 2007 2:45 pm
by 13045392
Hello Marc,

Your code worked fine. Now I am trying to zoom two series on the same axis. I work with normal axis.Its startpoint is 20 and endpoint is 90. When I zoomed the chart, first serie (line1) which is also the first one I added to chart looked like what is expected but the second serie (line2) overflow from the axis' boundry. If add line2 before line1 then line2 works fine and line1 overflows.

How can I manage both of them?

Thank you spending your time.

Posted: Mon Jul 30, 2007 11:05 am
by narcis
Hi Bilgehan,

Which TeeChart version are you using? Are you using the latest release available at the client area? If so and the problem persists, could you please send us a simple example project we can run "as-is" to reproduce the problem here.

You can either post your files at news://www.steema.net/steema.public.attachments newsgroup or at our upload page.

Thanks in advance.

Posted: Mon Mar 03, 2008 6:22 pm
by 9787981
Hi Narcís.

I am having a similar issue. What was the outcome of this issue? Was it identified as a bug? Note my application is a .Net user control, not a Web widget.

I have been trying for several days to understand what could be causing this issue for me. I am using 12 line series and have implemented a zoom capability. I have accessed several articles on how to potentially address the clipping of points. As such, I have implemented the solution as described in the Opaque Zones example, and have confirmed that the BeforeDrawValues event and AfterDrawValues event handlers are being called for each series, but still most of the series are being appropriately clipped, but some (at least two of the last series in sequence), are not being clipped. I have also checked that the parameters to the Graphics3D.ClipRectangle(...) call in the BeforeDrawValues() event handler, are the same values for both those series that are being clipped correctly and those that are not being clipped.

In my application, I am using the Axes.Bottom axis and a custom vertical (left) axis. Will the order in which things are created make a difference? In my application the creation order is as follows:

Create tchart instance
Create all 12 series
Create custom left axis
Add the custom axis to the list of tchart custom axes

foreach (series)
{
set the horizontal axis to tchart.Axes.Bottom
add the series to the tchart series collection
setup the series BeforeDrawValues and AfterDrawValues handlers
set the vertical custom axis
}

Is this creation order OK? It does seem that the problem occurs with the series that are created last. If I move the series which is not being clipped, so that it is created as one of the earlier series, then it does start to clip correctly??

I have tried to create a test application to reproduce this problem, but I cannot get it to happen in the test application, which I am taking as an indication that I'm doing something wrong in my application, but don't understand what could be going wrong ??

Note the application also employes the lineSeries_GetPointerStyle() event, and so the event handling sequence, I've verified as being called, is the following sequence for each series after a chart zoom occurs:

Series_BeforeDrawValues
lineSeries_GetPointerStyle
Series_AfterDrawValues

...and I have verified that there are no exceptions being thrown (say in the call to lineSeries_GetPointerStyle, etc), and so nothing in the above sequence is terminating prematurely, etc, etc.

Any thoughts on how to address this situation or to better understand what might be going wrong, would be very much appreciated...

Note the zoom feature has been added as an enhancement for our upcoming release, and it works quite nicely, except for this seemingly intermittent issue.

thanks,
Ben.

Posted: Tue Mar 04, 2008 5:37 am
by 9787981
Hi Narcís.

After spending yet another day investigating this issue, I've finally narrowed down the code that causes it - very bizarre (to me anyway).

I have uploaded the zip file that contains the windows forms sample project that shows the issue. The zip file that I uploaded is called SteemaIssue3.zip.

The issue is related to setting the line series pointer marker style to Sphere as follows:

line.Pointer.Style = Steema.TeeChart.Styles.PointerStyles.Sphere;

Any of the previous pointer styles does not cause the issue I'm seeing. If you run the sample code, you'll notice a checkbox called "Use Sphere Marker". If you run the application and zoom into the line, you'll see that the clipping issue occurs. If you then uncheck the "Use Sphere Marker" checkBox, you'll notice the issue goes away.

Please let me know why this happens and what can be done to fix or workaround this issue...

thanks,
Ben.

Posted: Tue Mar 04, 2008 11:42 am
by narcis
Hi Ben,
I am having a similar issue. What was the outcome of this issue? Was it identified as a bug?
No, we couldn't identify the issue as Bilgehan didn't reply to our last post in the thread.

Thanks for investigating the issue. I have been able to reproduce it here and I think it's a bug which (TF02012863) I've added to the defect list to be fixed for next releases.

There's no workaround I can think of at the moment apart of setting PointerStyle to Circle.

Posted: Tue Mar 04, 2008 3:28 pm
by 9787981
OK. Thanks for confirming the bug Narcís.

Regards,
Ben.