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

matching legend marker and series pointmarks

9 Answers 109 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Lauren
Top achievements
Rank 1
Lauren asked on 14 Dec 2010, 04:07 PM

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



9 Answers, 1 is accepted

Sort by
0
Sia
Telerik team
answered on 16 Dec 2010, 05:59 PM
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
0
Lauren
Top achievements
Rank 1
answered on 20 Jan 2011, 01:11 AM
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
0
Giuseppe
Telerik team
answered on 20 Jan 2011, 06:12 PM
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>>
0
Jeremy
Top achievements
Rank 1
answered on 14 Mar 2011, 04:00 AM
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
0
Sia
Telerik team
answered on 14 Mar 2011, 05:23 PM
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!
0
Jeremy
Top achievements
Rank 1
answered on 15 Mar 2011, 01:40 AM
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?
0
Sia
Telerik team
answered on 17 Mar 2011, 09:34 AM
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
0
Daniela
Top achievements
Rank 1
answered on 02 Apr 2012, 01:45 PM
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
0
Sia
Telerik team
answered on 05 Apr 2012, 01:29 PM
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 >>

Tags
Chart
Asked by
Lauren
Top achievements
Rank 1
Answers by
Sia
Telerik team
Lauren
Top achievements
Rank 1
Giuseppe
Telerik team
Jeremy
Top achievements
Rank 1
Daniela
Top achievements
Rank 1
Share this question
or