How to get SeriesDefinition from DataSeries?

9 posts, 0 answers
  1. Alexander
    Alexander avatar
    21 posts
    Member since:
    Jun 2011

    Posted 14 Oct 2011 Link to this post

    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.
  2. Evgenia
    Admin
    Evgenia avatar
    1437 posts

    Posted 17 Oct 2011 Link to this post

    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 >>
  3. Alexander
    Alexander avatar
    21 posts
    Member since:
    Jun 2011

    Posted 17 Oct 2011 Link to this post

    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.
  4. Alexander
    Alexander avatar
    21 posts
    Member since:
    Jun 2011

    Posted 19 Oct 2011 Link to this post

    I'm sorry for annoying but are there any thoughts on this problem?
    I'd really appreciate your help in this.

    Thanks.
  5. Evgenia
    Admin
    Evgenia avatar
    1437 posts

    Posted 20 Oct 2011 Link to this post

    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 >>
  6. Alexander
    Alexander avatar
    21 posts
    Member since:
    Jun 2011

    Posted 20 Oct 2011 Link to this post

    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.
  7. Evgenia
    Admin
    Evgenia avatar
    1437 posts

    Posted 25 Oct 2011 Link to this post

    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 >>
  8. Alexander
    Alexander avatar
    21 posts
    Member since:
    Jun 2011

    Posted 27 Oct 2011 Link to this post

    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.
  9. Evgenia
    Admin
    Evgenia avatar
    1437 posts

    Posted 31 Oct 2011 Link to this post

    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 >>
Back to Top