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

Same Value Point Labels Overlap On Right Side of Line Chart

5 Answers 81 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Brian
Top achievements
Rank 1
Brian asked on 18 Nov 2011, 05:06 PM
I have line chart with two series.  The rightmost point on both series is the same value, but I only see one label.  Looking at the animation as the data is being drawn on the chart, it seems like both point labels are being drawn in the same location, so the last one is the only one that shows up.  This isn't a problem with the points in the middle as it puts the labels to either side of the point.  I imagine this problem could also happen with the leftmost point if the values were the same.  Is there a way to tell the chart not to draw the labels on top of each other at the chart margins?

5 Answers, 1 is accepted

Sort by
0
Peshito
Telerik team
answered on 23 Nov 2011, 08:50 AM
Hello Brian,

RadChart allows you to modify the layout of the X-axis to better fit the different chart types in the chart area. You can do that by using the LayoutMode which is related to the X-Axis only. You can set it to Inside like this:
radChart.DefaultView.ChartArea.AxisX.LayoutMode = AxisLayoutMode.Inside;
This way a small margin on both sides will be provided for better presentation. Hence you will be able to see both labels.

More about LayoutMode can be found in our help topics here.

All the best,
Peshito
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Brian
Top achievements
Rank 1
answered on 23 Nov 2011, 03:16 PM
Peshito,
    Thank you for this suggestion.  Although it does solve the label issue, the margin that it places on the right and left makes the chart look a bit strange in my case (layout mode inside.png).  Are there any other options?  If not, I would like to request a future enhancement that deals with this problem more elegantly.  It would be nice to have a mode or feature where the chart would not draw point labels on top of each other if reasonably possible.  In this case, extending the x axis a little bit or putting a slight margin on the right would leave space for the second label.  Alternatively, the chart could place the second label vertically above the first one if there isn't space to the right.

Thanks,
Brian
0
Peshito
Telerik team
answered on 28 Nov 2011, 09:33 AM
Hello Brian,

In this case could you try using the label Distance property in order to further customize the way your series labels are displayed.

For example:
Set the first series label distance like:
(firstSeriesMapping.SeriesDefinition as LineSeriesDefinition).LabelSettings.Distance = 20;
and your second series like:
(secondSeriesMapping.SeriesDefinition as LineSeriesDefinition).LabelSettings.Distance = 10;

You may also try setting different distance values to get the most appropriate values that works in your scenario.

Best wishes,
Peshito
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Brian
Top achievements
Rank 1
answered on 28 Nov 2011, 03:54 PM
Peshito,
    Thank you for the additional suggestion.  The LabelDistance is an OK solution for the labels on the last point, but it makes the labels on the rest of the points look funny since they are at different distances on opposite sides of the point (see attached image).  Is there a way to set the label distance only for the last point in each series?  My data is databound using ItemMappings.

Thanks,
Brian
0
Peshito
Telerik team
answered on 01 Dec 2011, 10:52 AM
Hi Brian,

Distance property applies to all series item labels and there is not a way to apply it for a custom series item. You may use different distance values to make the appearance most desirable, however the end result will be similar to the previous one.

Greetings,
Peshito
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
Chart
Asked by
Brian
Top achievements
Rank 1
Answers by
Peshito
Telerik team
Brian
Top achievements
Rank 1
Share this question
or