We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Dynamic chart gridview

I use gridview to show multiply charts. Everything works just fine now. As long as all charts are the same. But if I wish realy dinamyc charts I have one huge problem.

For an example...there is no need, that axisX will always be DateTime. It can somethimes be Numerical, or Category. Is there any possible way to achieve this?

My current XAML code:
<GridView
       x:Name="resultsGridView"
       AutomationProperties.AutomationId="ResultsGridView"
       TabIndex="1"
       SelectionMode="Multiple"
       IsSwipeEnabled="True"
       IsItemClickEnabled="True"
       Grid.Row="1"
       ItemClick="resultsGridView_ItemClick"
       ItemsSource="{Binding List}">
       <GridView.ItemTemplate>
           <DataTemplate>
               <Charts:SfChart>
                   <Charts:SfChart.PrimaryAxis>
                       <Charts:DateTimeAxis/>  //HERE -> Is possible to make this somehow dynamic?
                   </Charts:SfChart.PrimaryAxis>
                   <Charts:SfChart.SecondaryAxis>
                       <Charts:NumericalAxis/>
                   </Charts:SfChart.SecondaryAxis>
                   <Charts:ColumnSeries
                       ItemsSource="{Binding dataList}"
                       XBindingPath="TimeStamp"
                       YBindingPath="NoOfUsers">
                   </Charts:ColumnSeries>
               </Charts:SfChart >
           </DataTemplate>
       </GridView.ItemTemplate>
   </GridView>

2 Replies

KO Klemen Ošlaj February 25, 2014 10:11 AM UTC

Ok, I managed to do this:

class listOfCharts
    {
        public listOfCharts(String id, String name, String type, ObservableCollection<chartsInput> data)
        {
            this.Id = id;
            this.dataList = data; 
            this.primaryAxis = new DateTimeAxis();
            this.secundaryAxis = new NumericalAxis();
        }

        public string Id { get; private set; }
        public ObservableCollection<chartsInput> dataList { get; private set; }
        public dynamic primaryAxis { get; private set; }
        public dynamic secundaryAxis { get; private set; }
    }

<Charts:SfChart PrimaryAxis="{Binding primaryAxis}" SecondaryAxis="{Binding secundaryAxis}" />

But now, how can I choose proper series? For an example ColumnSeries.
And also, when to other page and return back on this page, application crashes(global::System.Diagnostics.Debugger.Break()). I dont know why.

Attachment: sync_2375c68a.zip


KV Karthikeyan V Syncfusion Team March 3, 2014 03:33 AM UTC

Hi Klemen,

Thank you for your products,

We have analysed the reported issue with your sample. But we are unable to reproduce issue. Could you please give more information along with replication procedure? This would be helpful for us to serve you.

Thanks,

Karthikeyan V.


Loader.
Up arrow icon