Add multiple chart series from different domain data sources

3 posts, 0 answers
  1. Tom
    Tom avatar
    4 posts
    Member since:
    Oct 2010

    Posted 31 Oct 2010 Link to this post

    Hi - I am trying to create a dashboard with various graphs etc.  I am using RIA services, and domain data sources.

    I want to create a line graph that uses data from two different domain data sources, creating a series for each.  

    The problem is that the ItemsSource can only be bound to one object, and I want to write everything declaratively - i.e. I don't want to have to write code-behind to go and collate the two result sets, add them to a list and then set that as the ItemsSource.

    The reason being that I want to utilise the parameter databinding functions of the domain data source - i.e. so when a user changes a filter parameter, both graph series get re-drawn.

    My domain data sources are as follows:

    <UserControl.Resources>
            <riaControls:DomainDataSource x:Key="RequestsSource" AutoLoad="True" QueryName="GetRequestsPerHour">
                <riaControls:DomainDataSource.DomainContext>
                    <my:ReportingDataContext />
                </riaControls:DomainDataSource.DomainContext>           
            </riaControls:DomainDataSource>
            <riaControls:DomainDataSource x:Key="BookingsSource" AutoLoad="True" QueryName="GetBookingsPerHour">
                <riaControls:DomainDataSource.DomainContext>
                    <my:ReportingDataContext />
                </riaControls:DomainDataSource.DomainContext>
            </riaControls:DomainDataSource>
        </UserControl.Resources>

    The chart should (ideally) show a splinearea series for each result set.  The two queries both return a list of the same object type - the object has two int properties, one for the hour of the day, the other for the no transactions requested/booked.

    Any help/advice much appreciated!
  2. Vladimir Milev
    Admin
    Vladimir Milev avatar
    1061 posts

    Posted 03 Nov 2010 Link to this post

    Hello Tom,

    Unfortunately you have hit a sore spot in the chart control. Currently the control does have only one ItemsSource property and will not allow you to bind different series to different data sources. We are aware of this limitation and have planned to introduce API which will eliminate this shortcoming.

    For the time being I suggest you combine both result sets into a single viewmodel and map the data accordingly to each series mapping.

    I sincerely apologize for this inconvenience.

    Regards,
    Vladimir Milev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. DevCraft banner
  4. Janaki
    Janaki avatar
    5 posts
    Member since:
    Dec 2011

    Posted 22 May 2013 Link to this post

    Hi all,

           i want to compare two month data in a bar radchart...i am creating the chart code behind and using LINQ query to fetch the value in Silver-light.

    i have 2 classes ChartSerieses and DataSerieses and  2 list...

      public List<EEDWebService.ChartSeries> ChartSerieses { get; set; }
            public List<EEDWebService.DataSeries> DataSerieses { get; set; }


     void BindSeries(EEDWebService.ChartSeries series)
            {
                 Chart.ItemsSource = series.Series;       
              Title.Text = string.Format("{0} : {1} {2}", series.Energy, series.Total, series.Unit);           
            }

            void BindSeries(EEDWebService.DataSeries data)
            {
                Chart.ItemsSource = data.Series;
                Title.Text = string.Format("{0} : {1} {2}", data.Energy, data.Total, data.Unit);
               
            }



    how to make this 2 itemource in to one item source?so that i can bind the datas in to 1 graph...

    Need help...Its urgent too....
Back to Top