This is a migrated thread and some comments may be shown as answers.

Annotation labels overlapping

1 Answer 147 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Karl B
Top achievements
Rank 1
Karl B asked on 11 Jun 2019, 03:42 PM
for (int i = 0; i < 20; i++)
    {
    chart.Annotations.Add (
           new CartesianGridLineAnnotation
               {
               Axis = chart.HorizontalAxis,
               Value = i,
               Margin = new Thickness (0, topMargin, 0, topMargin),
               Stroke = this.m_supportLineBrush,
               StrokeThickness = 1,
               Label = $"Dyanmic{i}",
               ClipToPlotArea = false,
               LabelDefinition = new ChartAnnotationLabelDefinition ()
                   {
                   Location = ChartAnnotationLabelLocation.Right, HorizontalOffset = -15
                   }
               });
    }

I have a chart with dynamically created CartesianGridLineAnnotations with labels. In some cases these annotations are very close together and the labels overlap.  How do I keep this from happening? Is there any kind of "Smart Label" for grid line annotation? 

 

Here is a simple example you can use to simulate my problem

 

1 Answer, 1 is accepted

Sort by
0
Drago
Telerik team
answered on 12 Jun 2019, 12:22 PM
Hello Karl,

We do not have a "Smart Label" feature for the grid-line annotation. But what you can do instead is use the VerticalOffset property of CartesianGridLineAnnotation and manually offset the labels so they do not overlap.

Let me know if that helps.

Regards,
Dragan Grigorov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
ChartView
Asked by
Karl B
Top achievements
Rank 1
Answers by
Drago
Telerik team
Share this question
or