SFChart ColumnSeries not showing

Hi,

I have a StackLayout with a simple ColumnSeries chart in it. It displays an empty space. If I change the charttype to PieSeries or DoughnutSeries it works and the chart is shown. Why is the ColumnSeries type not showing?

XAML View:
...
             <chart:SfChart HeightRequest="300" WidthRequest="100" AreaBackgroundColor="Transparent">
                    <chart:ColumnSeries ItemsSource ="{Binding BeendeteArbeitsgaengeProDatum}"/>
                </chart:SfChart>
...

Model Binding:

      public ObservableCollection<ChartDataPoint> BeendeteArbeitsgaengeProDatum { get; set; }

        public DashboardViewModel()
        {
            BeendeteArbeitsgaengeProDatum = new ObservableCollection<ChartDataPoint>();

               ...

            foreach (var item in _response.BdeDashboard.BeendeteArbeitsgaengeProDatum)
            {
                   BeendeteArbeitsgaengeProDatum.Add(new ChartDataPoint(item.Key, Convert.ToDouble(item.Value)));
            }
        }




5 Replies

DD Devakumar Dhanapoosanam Syncfusion Team March 4, 2020 06:19 AM UTC

Hi Maria, 
 
Greetings from Syncfusion. 
 
We have analyzed the provided code snippet and found that you were missed to add the chart Axis for the chart. We would like to let you know that for Cartesian series it is mandatory to set the PrimaryAxis and SecondaryAxis for chart. Please refer the below code snippet for more details 
 
XAML: 
<chart:SfChart x:Name="chart" HorizontalOptions="FillAndExpand"   
                           VerticalOptions="FillAndExpand"> 
         <chart:SfChart.PrimaryAxis> 
                  <chart:CategoryAxis/> 
         </chart:SfChart.PrimaryAxis> 
         <chart:SfChart.SecondaryAxis> 
                  <chart:NumericalAxis/> 
         </chart:SfChart.SecondaryAxis> 
         <chart:ColumnSeries ItemsSource ="{Binding BeendeteArbeitsgaengeProDatum}"/> 
</chart:SfChart> 
 
 
Hope the above solution helps to resolve the reported issue.  
 
Note: Only for the accumulation series types like Pie and Doughnut series axis is not required and for all other cartesian series Axis needed. 
  
  
Please let us know if you need any further assistance on this. 
 
Regards, 
Devakumar D 



AN Andy March 4, 2020 07:02 AM UTC

Good morning,

thanks, it works now! 
I've only looked at the chart types code snippet in the documentation (https://help.syncfusion.com/xamarin/charts/charttypes#column-chart)


Have a good day

Maria


DD Devakumar Dhanapoosanam Syncfusion Team March 4, 2020 08:33 AM UTC

Hi Maria, 
 
Thanks for your update. 
 
Please let us know if you need any further assistance. 
 
Regards, 
Devakumar D 



CE Cezar February 16, 2021 10:56 PM UTC

I spent more than an hour to find out why my chart was not working.
In the documentation I had found nothing about it. I think this information needs this in TOTAL HIGHLIGHT in the documentation.


SM Saravanan Madheswaran Syncfusion Team February 17, 2021 01:13 PM UTC

Hi Cezar, 

Thanks for your feedback, currently we are in the process of revamping our UG documents. So, we will address your comments as well. And we would like to let you know that we have mentioned the important of axis and its customization in below UG links.  


Regards, 
Saravanan.  


Loader.
Up arrow icon