matching legend marker and series pointmarks

10 posts, 0 answers
  1. Lauren
    Lauren avatar
    37 posts
    Member since:
    Jan 2010

    Posted 14 Dec 2010 Link to this post

    Hi

    I'm using different PointMarks for different kind of data.
    I would like to be able to display the same marker shape in the legend (see attachement).
    I was able to do that by manually adding a custom legend item for each series.

    However doing it this way, i loose the selection/hover interactivity effects.
    Is there a way to automatically bind the legend item shape to the poitmark shape ? or any other way to achieve the above and keep the interactivity effects?

    Thanks for your help
    Lauren



  2. Sia
    Admin
    Sia avatar
    667 posts

    Posted 16 Dec 2010 Link to this post

    Hi Laurence Fossati,

    Let me start with that you need to upgrade with the latest internal build from your account (version 1213) because we fixed an issue with the selection of scatter series there.

    Unfortunately we do not provide build-in functionality which maintains selection of legend items which are not auto generated. Attached you can find a project where such behavior is achieved but it is one-way. I mean that if you select series in the chart area, the legend item with the same index is highlighted, but selecting a legend item does not select the corresponding scatter series.

    I hope that the sample application will help you in gaining your object.

    Greetings,
    Sia
    the Telerik team
    Browse the videos here>> to help you get started with RadControls for Silverlight
  3. DevCraft banner
  4. Lauren
    Lauren avatar
    37 posts
    Member since:
    Jan 2010

    Posted 19 Jan 2011 Link to this post

    Hi,

    I saw in the release note for version 2010.3 1314 the following statement:
    "It is now possible to declare individual MarkerShape for different legend items. "

    What does it mean exactly ? Do you know where i could find an example ?

    I'm wondering if it could help me with the scenario i described in my previous post.

    Thanks
  5. Giuseppe
    Admin
    Giuseppe avatar
    2363 posts

    Posted 20 Jan 2011 Link to this post

    Hello Lauren,

    We have attached a sample application that demonstrates the usage of the ChartLegendItem.MarkerShape property to set individual shapes for the different series.

    Hope this helps.


    Best wishes,
    Freddie
    the Telerik team
    Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
  6. Jeremy
    Jeremy avatar
    96 posts
    Member since:
    Mar 2010

    Posted 13 Mar 2011 Link to this post

    Hi Freddie

    How do I do this with SeriesMapping instead of DataPoints? While debugging I can see there are no items in the legend at the time of defining the series definition.

    Kind Regards,
    Jeremy
  7. Sia
    Admin
    Sia avatar
    667 posts

    Posted 14 Mar 2011 Link to this post

    Hi Jeremy,

    If you need to have the same marker shape for all legend items then you can set the desired shape to the Chart legend through the exposed LegendItemMarkerShape property. Please check this example.

    Attached you can find a similar solution like the one below but with RadChart with series mappings. You need just to modify it and add your custom logic for different shape per legend item. I hope this helps.

    Regards,
    Sia
    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!
  8. Jeremy
    Jeremy avatar
    96 posts
    Member since:
    Mar 2010

    Posted 14 Mar 2011 Link to this post

    No I don't want the marker shapes all the same - I want them like the picture in the original post and the title of this thread. That LayoutUpdated function is new to me. I tried using it but, again while debugging, there were no items in the legend at the time of stepping through that function. Is there something else I can try?
  9. Sia
    Admin
    Sia avatar
    667 posts

    Posted 17 Mar 2011 Link to this post

    Hello Jeremy,

    The suggested solution seems to work on your end after some small modifications in order to make the legend shapes different per item. If some other question arise, please do not hesitate to contact us again.

    Best wishes,
    Sia
    the Telerik team
  10. Daniela
    Daniela avatar
    1 posts
    Member since:
    Apr 2012

    Posted 02 Apr 2012 Link to this post

    Hi!
    I've got a similar problem:
    I want to display different marker shapes in the Legend depending on the used SeriesDefinition without declaring the ChartLegendItems manually. Is there a possibility to declare a standard legend marker shape for LineSeries and another standard legend marker shape for BarSeries with UseAutoGeneratedItems="True"?

    Thanks in advance!
    Daniela
  11. Sia
    Admin
    Sia avatar
    667 posts

    Posted 05 Apr 2012 Link to this post

    Hi Laurence,

    Please check the provided solution on 14-Mar-2011 - you can loop through all elements and change the Marker Shape depending on the Series Definition. For example:
    private string def;
    private void UserControl_LayoutUpdated(object sender, EventArgs e)
    {
        if (flag)
        {
            foreach (var chartLegendItem in RadChart1.DefaultView.ChartLegend.ChildrenOfType<ChartLegendItem>())
            {
                def = this.RadChart1.SeriesMappings[i].SeriesDefinition.ToString();
                if (def == "BarSeriesDefinition")
                    chartLegendItem.MarkerShape = MarkerShape.Square;
                else if(def == "LineSeriesDefinition")
                    chartLegendItem.MarkerShape = MarkerShape.Line;
                i++;
            }
        }
        flag = false;
    }

    Greetings,
    Sia
    the Telerik team

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

Back to Top
DevCraft banner