SeriesItem.Label.Appearance.Position support in ChartSeriesType.Line?

Thread is closed for posting
4 posts, 0 answers
  1. Jack
    Jack avatar
    3 posts
    Member since:
    Jan 2009

    Posted 14 Feb 2011 Link to this post

    I am using the Q3-2009 release and have successfully added static vertical lines as another series to a horizontal bar graph. The bar graph is a percentile representation of data with the vertical lines being the low end of a series of targets. I have scaled the graph to start at the low and high ends of the targets, with a little room above and below so that the lowest value in the data series is shown and the target series is shown clearly with outliers in the data series shown extending past the edge of the graph.

    All of that works perfectly and I can upload a sample project that demonstrates the basics of how that is accomplished. What isn't working is the positioning of the SeriesItem labels. Your RadChart help references the [SeriesItem].Label.Appearance property, which is a broken link, and I drilled into the lightly documented (i.e. What's the Single value represent, pixels, percent of chart area?) API help for info on .Position.X and .Position.Y. 

    Here is the code I'm trying to implement.

                var targetLine = new ChartSeries
                                     {
                                         Type = ChartSeriesType.Line
                                     };
                // To get a vertical line, the series has to be added for each person
                int countTeam = SampleData.Rows.Count;

                // Setup first item with label
                targetLine.AddItem(value);
                // Show labels only on this first series item
                ChartSeriesItem item = targetLine.Items[0];
                item.Label.Visible = true;
                item.Label.Appearance.RotationAngle = 90;
                item.Label.TextBlock.Text = "#Y{P1}";

                // Show the rest of the series items without labels
                for (int i = 1; i < countTeam; i++)
                {
                    targetLine.AddItem(value);
                    targetLine.Items[i].Label.Visible = false;
                }
                RadChart1.AddChartSeries(targetLine);
                ... (removed series color coding)
                // Try to reposition the labels with the end goal to be to draw them 
                // below the scale with a label connector line
                // BUG: this fails to relocate
                item.Label.Appearance.Position.Auto = false;
                item.Label.Appearance.Position.X += 10;  // Using random numbers at this point since nothing is happening, there's
                item.Label.Appearance.Position.Y += 10;  // no documentation, and I don't know if X & Y are axis or screen oriented
                item.Label.Appearance.LabelConnectorStyle.Visible = true;

    The labels show up as they should, only one on the first item in the series, i.e. the bottom of the chart, but it refuses to move at all from the spot it is automatically drawn. Am I trying to affect this at the wrong point of its creation or is the documentation missing something and/or the interface exposing something it shouldn't, i.e. Position.X and Position.Y being public writable when they don't actually have any affect?
  2. Ves
    Admin
    Ves avatar
    2926 posts

    Posted 17 Feb 2011 Link to this post

    Hi Jack,

    Indeed, there is a problem when trying to move a label manually. A possible workaround in this case would be to increase the label size and to position the textblock inside it as per your requirements, here is an example:

    item.Label.Appearance.Dimensions.AutoSize = false;
    item.Label.Appearance.Dimensions.Width = Telerik.Charting.Styles.Unit.Pixel(80);
    item.Label.Appearance.Dimensions.Height = Telerik.Charting.Styles.Unit.Pixel(20);
     
    item.Label.TextBlock.Appearance.Position.Auto = false;
    item.Label.TextBlock.Appearance.Position.X += 60;

    Note, that the label does not actually move, and it grows in both left and right, so the above example moves the text by less than 30 pixels and not by 60.

    Best regards,
    Ves
    the Telerik team
  3. Jack
    Jack avatar
    3 posts
    Member since:
    Jan 2009

    Posted 18 Feb 2011 Link to this post

    Is this a known issue with a fix in progress? The workaround has merit and underscores what will be a problem even if the method I used previously were working and that is that the label won't move outside of the chart area, which was my goal as they are currently colliding with labels of the horizontal bar series. That's really the problem I'm trying to solve, that the lines' labels are colliding with the bar's labels. Any thoughts on that?
  4. Evgenia
    Admin
    Evgenia avatar
    1437 posts

    Posted 24 Feb 2011 Link to this post

    Hi Jack,

    Presently, there is no scheduled fix for this bug and even if there was it would not address your main concern, namely the presence of labels outside the plot area. This contradicts with the current control design and is not feasible.
    I hope this information helps.

    Best wishes,
    Evgenia
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
Back to Top