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?
Many thanks
Oli
Problems with axis break
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: Problems with axis break
Hi Oli,
Thanks in advance.
That's because you have not added any break (AxisBreak) at the AxisBreaksTool. Code snippet below works fine for me here: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?
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();
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.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?
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 |
Instructions - How to post in this forum |
Re: Problems with axis break
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
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
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:
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,
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();
}
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 |
Instructions - How to post in this forum |
Re: Problems with axis break
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
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
Re: Problems with axis break
Forgot to mention that I use the latest release of Teechart.
Re: Problems with axis break
Hi Oli,
I've reproduced the behaviour with the code below so I've added this to the wish list too (TF02016339).
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...
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;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |