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

How to get SeriesDefinition from DataSeries?

8 Answers 94 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Alexander
Top achievements
Rank 1
Alexander asked on 14 Oct 2011, 05:16 PM
Hi, guys.

Is there a way to get corresponding seriesDefinition from data series? or to check if dataseries object was produced from specific seriesdefinition instance?

Thanks in advance.

Best regards,
Alexander.

8 Answers, 1 is accepted

Sort by
0
Evgenia
Telerik team
answered on 17 Oct 2011, 02:52 PM
Hi Alexander,

The DataSeries has a property Definition of type ISeriesDefinition where the chart type is specified. You can read more about it in our help topic.

Best wishes,
Evgenia
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
0
Alexander
Top achievements
Rank 1
answered on 17 Oct 2011, 07:05 PM
Hi, Evgenia.
Thanks for the answer.
But can I get SeriesMapping from DataSeries or Series objects (especially if I get them after grouping and aggregation is applied to SeriesMapping) ?

I'm trying to store SeriesDefinition, but when grouping and aggregation is applied to series mapping - I can't find the series definition among the stored ones.
0
Alexander
Top achievements
Rank 1
answered on 19 Oct 2011, 04:10 PM
I'm sorry for annoying but are there any thoughts on this problem?
I'd really appreciate your help in this.

Thanks.
0
Evgenia
Telerik team
answered on 20 Oct 2011, 04:52 PM
Hello Alexander,

I am not quite sure I understand the requirement that you have. Any additional information that you may give us will be very helpful to guide you better.
Please note that there is a serious difference between using SeriesMappings and DataSeries. The SeriesMapping allows for configuring a data object, which is mapped to the Chart and in this scenario RadChart itself creates the DataPoints, whereas using DataSeries requires setting the DataPoints manually. So there is no way that you can access the SeriesMapping from DataSeries.
Meanwhile here is how you can access the currently set SeriesMappings and their SeriesDefinition:
RadChart1.SeriesMappings[0].SeriesDefinition

Greetings,
Evgenia
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
0
Alexander
Top achievements
Rank 1
answered on 20 Oct 2011, 05:17 PM
Hi, Evgenia.
Thanks for replying. Here what I have:
1) I have a list of my custom series descriptions.
2) The user selects some of them and I create a SeriesMapping for each selected series description.
3) I save SeriesDescription - SeriesDefinition dictionary
4) I want the user to be able to remove series from the chart just by dragging series from the chart area and dropping it outside of the chart area.

Everything goes well if no grouping was applied to the series.
So, I can get SeriesDefinition and find my custom object in the dictionary.(3)
So, when user removes series from chart by drag-n-drop, he also can see that series was also deselected in the list (1)

But, when I add some grouping to the SeriesMapping,
I can't get the appropriate SeriesDescription from the dictionary(3)  because SeriesDefinition after grouping was applied is not the same as which I set when creating SeriesMapping.

Hope this clarifies things a bit :)

Thanks.

Best regards,
Alexander.
0
Evgenia
Telerik team
answered on 25 Oct 2011, 04:48 PM
Hi Alexander,

Could ypu please send us a sample runnable project which demonstrates your approach? This way we will be able to review it locally and provide you with more adequate suggetions based on your code.
For the purpose you should open a new formal Support thread since it is not possible to send attachments in forums.

All the best,
Evgenia
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
0
Alexander
Top achievements
Rank 1
answered on 27 Oct 2011, 06:30 AM
Hi, Evgenia.

To simplify things:

1. I have a data source.
2. I create chart by applying SeriesMapping.
3. This series mapping contains Grouping definitions. So, chart displays grouped series.
4. I'd like to remove the whole series(not just a group) by just dragging it out from chart area.

Thanks.

Best regards,
Alexander.
0
Evgenia
Telerik team
answered on 31 Oct 2011, 05:17 PM
Hello Alexander,

Your scenario is very similar to the one we already have in our Drag and Drop demo. I suggest that you review its source code either online or from the local installation path of your controls i.e. C:\Program Files (x86)\Telerik\RadControls for Silverlight Q2 2011. The key in your case is the code inside OnDragInfo event:
if (chart.DefaultView.ChartArea.DataSeries.Contains(dataSeries))
                    {
                        chart.DefaultView.ChartArea.DataSeries.Remove(dataSeries);
                    }

Feel free to modify the sample's code so that it meets your requirement.

All the best,
Evgenia
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
Tags
Chart
Asked by
Alexander
Top achievements
Rank 1
Answers by
Evgenia
Telerik team
Alexander
Top achievements
Rank 1
Share this question
or