Page 1 of 1

Problems with axis break

Posted: Sat Sep 01, 2012 5:40 am
by 15661292
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 11952 times

Many thanks

Oli

Re: Problems with axis break

Posted: Mon Sep 03, 2012 12:07 pm
by narcis
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.

Re: Problems with axis break

Posted: Mon Sep 03, 2012 3:59 pm
by 15661292
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

Re: Problems with axis break

Posted: Tue Sep 04, 2012 10:51 am
by 10050769
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,

Re: Problems with axis break

Posted: Sat Sep 08, 2012 6:31 am
by 15661292
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 11872 times

Re: Problems with axis break

Posted: Sat Sep 08, 2012 6:32 am
by 15661292
Forgot to mention that I use the latest release of Teechart.

Re: Problems with axis break

Posted: Mon Sep 10, 2012 10:55 am
by yeray
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...