Same Value Point Labels Overlap On Right Side of Line Chart

6 posts, 0 answers
  1. Brian
    Brian avatar
    58 posts
    Member since:
    Jul 2011

    Posted 18 Nov 2011 Link to this post

    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?
  2. Peshito
    Admin
    Peshito avatar
    585 posts

    Posted 23 Nov 2011 Link to this post

    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 >>

  3. Brian
    Brian avatar
    58 posts
    Member since:
    Jul 2011

    Posted 23 Nov 2011 Link to this post

    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
  4. Peshito
    Admin
    Peshito avatar
    585 posts

    Posted 28 Nov 2011 Link to this post

    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 >>

  5. Brian
    Brian avatar
    58 posts
    Member since:
    Jul 2011

    Posted 28 Nov 2011 Link to this post

    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
  6. Peshito
    Admin
    Peshito avatar
    585 posts

    Posted 01 Dec 2011 Link to this post

    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 >>

Back to Top