Problems with axis break

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Oli
Newbie
Newbie
Posts: 42
Joined: Fri Jan 13, 2012 12:00 am

Problems with axis break

Post by Oli » Sat Sep 01, 2012 5:40 am

Hi,

I posted earlier (Feb 2012) some problems with axis breaks, which seemed to have been resolved. However, with the latest version I have difficulties to count the number of breaks on a axis. My code is as the following:

Dim Xaxisbreaks As Steema.TeeChart.Tools.AxisBreaksTool = New Steema.TeeChart.Tools.AxisBreaksTool(NewChart.Chart)
Xaxisbreaks.Chart = NewChart.Chart
Xaxisbreaks.Axis = NewChart.Axes.Bottom
Dim NumXBottomBreaks As Integer = Xaxisbreaks.Breaks.Count

NumXBottomBreaks remain zero even the chart has one or two breaks on the bottom axis. Is something wrong with the code (I believe it worked with earlier versions of Teechart), or has a bug sneaked into the latest version?

Secondly, minor ticks are drawn between the gap of the breaks. Just a minor thing, but is it possible to fix it in the next release?
AxisBreaks_MinorTicks.png
AxisBreaks_MinorTicks.png (9.98 KiB) Viewed 13447 times

Many thanks

Oli

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: Problems with axis break

Post by Narcís » Mon Sep 03, 2012 12:07 pm

Hi Oli,
NumXBottomBreaks remain zero even the chart has one or two breaks on the bottom axis. Is something wrong with the code (I believe it worked with earlier versions of Teechart), or has a bug sneaked into the latest version?
That's because you have not added any break (AxisBreak) at the AxisBreaksTool. Code snippet below works fine for me here:

Code: Select all

      tChart1.Series.Add(new Steema.TeeChart.Styles.Bar()).FillSampleValues();

      Steema.TeeChart.Tools.AxisBreaksTool Xaxisbreaks = new Steema.TeeChart.Tools.AxisBreaksTool(tChart1.Chart);
      Xaxisbreaks.Axis = tChart1.Axes.Bottom;
      Xaxisbreaks.GapSize = 50;

      Steema.TeeChart.Tools.AxisBreak xBreak = new Steema.TeeChart.Tools.AxisBreak(Xaxisbreaks);
      xBreak.StartValue = 2;
      xBreak.EndValue = 4;

      int NumXBottomBreaks = Xaxisbreaks.Breaks.Count;

      tChart1.Header.Text = NumXBottomBreaks.ToString();
Secondly, minor ticks are drawn between the gap of the breaks. Just a minor thing, but is it possible to fix it in the next release?
I don't think this has ever worked. I added your request to the wish-list (TF02016324) to be considered for inclusion in future releases. If you remember this working in the past it would be very helpful if you could post the version number where this worked.

Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Oli
Newbie
Newbie
Posts: 42
Joined: Fri Jan 13, 2012 12:00 am

Re: Problems with axis break

Post by Oli » Mon Sep 03, 2012 3:59 pm

Hi Narcis,

many thanks for your reply.

Regarding the number of breaks in a chart, I should have been clearer in my earlier post. I actually try to get the number of breaks of a chart saved with breaks in the native format. After loading I would like to get the number of breaks, and their start and end points, style etc. Are the breaks not serialized? I thought they sould be just to be retrieved from the AxisBreakTool after loading.

For the minor ticks in the gap, I have never tested it earlier. I do not know if an earlier version removes the minor ticks in the gap...but thanks for considering it for the future release.

Cheers
Oli

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Problems with axis break

Post by Sandra » Tue Sep 04, 2012 10:51 am

Hello Oli,

Ok, I have modified the code that suggested Narcís for you. The changes consist in exporting the tChart1 as template .ten and load it in tChart2, see next code to check it:

Code: Select all

 private void InitializeChart()
        {
            tChart1.Series.Add(new Steema.TeeChart.Styles.Bar()).FillSampleValues();

            Steema.TeeChart.Tools.AxisBreaksTool Xaxisbreaks = new Steema.TeeChart.Tools.AxisBreaksTool(tChart1.Chart);
            Xaxisbreaks.Axis = tChart1.Axes.Bottom;
            Xaxisbreaks.GapSize = 50;

            Steema.TeeChart.Tools.AxisBreak xBreak = new Steema.TeeChart.Tools.AxisBreak(Xaxisbreaks);
            xBreak.StartValue = 2;
            xBreak.EndValue = 4;

            int NumXBottomBreaks = Xaxisbreaks.Breaks.Count;

            tChart1.Export.Template.IncludeData = true;
            tChart1.Export.Template.Save(@"Chart.ten");
            tChart2.Import.Template.Load(@"Chart.ten");
           tChart2.Header.Text = (tChart2.Tools[0] as Steema.TeeChart.Tools.AxisBreaksTool).Breaks.Count.ToString();
           tChart2.SubHeader.Visible = true;
           tChart2.SubHeader.Text = (tChart2.Tools[0] as Steema.TeeChart.Tools.AxisBreaksTool).Breaks[0].StartValue.ToString()  '-' (tChart2.Tools[0] as Steema.TeeChart.Tools.AxisBreaksTool).Breaks[0].EndValue.ToString(); 
}
Can you tell us if previous code allow you get the values of axis breaks you want? If the code still doesn't work as you expect, let me know.

I hope will helps.

Thanks,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Oli
Newbie
Newbie
Posts: 42
Joined: Fri Jan 13, 2012 12:00 am

Re: Problems with axis break

Post by Oli » Sat Sep 08, 2012 6:31 am

Thanks Sandra...your code was helpful. It works in my application now.

However, during testing I found a few other issues in the appearance of the breaks. It is just minor and an "extreme" case with multiple breaks (unlikely that a user makes a chart like this), but may be it can be resolved in a future release.

Cheers

Oli

MultipleBreaks.png
MultipleBreaks.png (22.3 KiB) Viewed 13367 times

Oli
Newbie
Newbie
Posts: 42
Joined: Fri Jan 13, 2012 12:00 am

Re: Problems with axis break

Post by Oli » Sat Sep 08, 2012 6:32 am

Forgot to mention that I use the latest release of Teechart.

Yeray
Site Admin
Site Admin
Posts: 9614
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Problems with axis break

Post by Yeray » Mon Sep 10, 2012 10:55 am

Hi Oli,

I've reproduced the behaviour with the code below so I've added this to the wish list too (TF02016339).

Code: Select all

            tChart1.Header.Visible = false;
            tChart1.Aspect.View3D = false;
            tChart1.Legend.Visible = false;
            tChart1.Panel.Gradient.Visible = false;
            tChart1.Panel.Color = Color.White;
            
            tChart1.Walls.Visible = false;

            Points points1 = new Points(tChart1.Chart);
            points1.Pointer.Style = PointerStyles.Circle;
            for (int i = 0; i < 10; i++)
            {
                points1.Add(10 - i);
            }

            tChart1.Axes.Bottom.Grid.Visible = false;
            tChart1.Axes.Bottom.Increment = 1;
            tChart1.Axes.Bottom.MinorTicks.Visible = false;

            tChart1.Axes.Left.Grid.Visible = false;
            tChart1.Axes.Left.Increment = 1;
            tChart1.Axes.Left.MinorTicks.Visible = false;

            Steema.TeeChart.Tools.AxisBreaksTool Xaxisbreaks = new Steema.TeeChart.Tools.AxisBreaksTool(tChart1.Chart);
            Xaxisbreaks.Axis = tChart1.Axes.Bottom;
            Xaxisbreaks.GapSize = 20;

            Steema.TeeChart.Tools.AxisBreaksTool Yaxisbreaks = new Steema.TeeChart.Tools.AxisBreaksTool(tChart1.Chart);
            Yaxisbreaks.Axis = tChart1.Axes.Left;
            Yaxisbreaks.GapSize = 20;

            Steema.TeeChart.Tools.AxisBreak xBreak1 = new Steema.TeeChart.Tools.AxisBreak(Xaxisbreaks);
            xBreak1.StartValue = 2;
            xBreak1.EndValue = 4;
            xBreak1.Style = AxisBreakStyle.None;

            Steema.TeeChart.Tools.AxisBreak xBreak2 = new Steema.TeeChart.Tools.AxisBreak(Xaxisbreaks);
            xBreak2.StartValue = 6;
            xBreak2.EndValue = 7;

            Steema.TeeChart.Tools.AxisBreak yBreak1 = new Steema.TeeChart.Tools.AxisBreak(Yaxisbreaks);
            yBreak1.StartValue = 4;
            yBreak1.EndValue = 5;

            Steema.TeeChart.Tools.AxisBreak yBreak2 = new Steema.TeeChart.Tools.AxisBreak(Yaxisbreaks);
            yBreak2.StartValue = 8;
            yBreak2.EndValue = 9;
            yBreak2.Style = AxisBreakStyle.Line;
I've seen that hiding the axes pen makes some of the undesired lines to disappear, but if you want the axes to be drawn, then you'll have to draw them manually...
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply