![]() | Steema Issues DatabaseNote: This database is for bugs and wishes only. For technical support help, if you are a customer please visit our online forums;otherwise you can use StackOverflow. Before using this bug-tracker we recommend a look at this document, Steema Bug Fixing Policy. |
| Summary: | Bottom Axes label & annotation is not working | ||
|---|---|---|---|
| Product: | .NET TeeChart | Reporter: | juliana |
| Component: | Chart | Assignee: | Steema Issue Manager <issuemanager> |
| Status: | RESOLVED FIXED | ||
| Severity: | blocker | CC: | chris |
| Priority: | --- | ||
| Version: | TeeChart for .Net 4.1.2015.12165 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows | ||
| Chart Series: | --- | Delphi / C++ Builder RAD IDE Version: | |
| Attachments: | version compare | ||
|
Description
juliana
2018-02-13 22:49:45 EST
Created attachment 813 [details]
version compare
The axis label defect is a regression introduced in version 4.1.2016.10260 in the code change related to http://bugs.teechart.net/show_bug.cgi?id=1606 I can reproduce the issue with the following code: private void InitializeChart() { tChart1.Legend.Visible = false; Line series = new Line(tChart1.Chart); DateTime dt = DateTime.Today; int year, oldYear = 0; for (int i = 0; i < 10000; i++) { year = dt.Year; string label = year != oldYear ? year.ToString() : ""; series.Add(dt, Math.Log(i), label); dt = dt.AddDays(1); oldYear = year; } tChart1.Axes.Bottom.Labels.Angle = 90; } I have fixed this regression, and in the meantime the workaround is to use repeated labels e.g. private void InitializeChart() { tChart1.Legend.Visible = false; Line series = new Line(tChart1.Chart); DateTime dt = DateTime.Today; for (int i = 0; i < 10000; i++) { series.Add(dt, Math.Log(i), dt.Year.ToString()); dt = dt.AddDays(1); } tChart1.Axes.Bottom.Labels.Angle = 90; } The annotation defect is a regression introduced in version 4.1.2017.10190 (change for Xamarin.Forms) in code related to http://bugs.teechart.net/show_bug.cgi?id=1874. I can reproduce the issue with the following code: private void InitializeChart() { Annotation tool = new Annotation(tChart1.Chart); tool.Position = AnnotationPositions.Center; StringBuilder builder = new StringBuilder(); for (int i = 1; i < 10; i++) { builder.Append("This is text line " + i.ToString() + " of a multi-line series" + Environment.NewLine); } tool.Text = builder.ToString(); } We are looking into a fix for this regression, and in the meantime the workaround is to derive from the Annotation tool and override the erroneous method e.g. public class MyAnnotation : Annotation { public MyAnnotation(Chart c): base(c) { } protected override int CalcTempWidth(Graphics3D g, string tmp, out int numLines) { int i = tmp.IndexOf(Environment.NewLine); int result = 0; numLines = 0; while (i > 0) { result = Utils.Round(Math.Max(result, g.TextWidth(tmp.Substring(0, i)))); ++numLines; tmp = tmp.Remove(0, i + Environment.NewLine.Length); i = tmp.IndexOf(Environment.NewLine); } if (tmp != "") { result = Utils.Round(Math.Max(result, g.TextWidth(tmp))); ++numLines; } return result; } } to use: private void InitializeChart() { MyAnnotation tool = new MyAnnotation(tChart1.Chart); tool.Position = AnnotationPositions.Center; StringBuilder builder = new StringBuilder(); for (int i = 1; i < 10; i++) { builder.Append("This is text line " + i.ToString() + " of a multi-line series" + Environment.NewLine); } tool.Text = builder.ToString(); } |