BarSeries doesn't show

I have xaml code, and charts don't show. But if I change "chart:BarSerie" to "chart:PieSeries" all worked as expected

                        chart:SfChart>
                            <chart:SfChart.PrimaryAxis>
                                <chart:CategoryAxis/>
                            </chart:SfChart.PrimaryAxis>
                            <chart:SfChart.SecondaryAxis>
                                <chart:NumericalAxis/>
                            </chart:SfChart.SecondaryAxis>
                            <chart:BarSeries
                                       ItemsSource="{Binding BarChartData}" 
                                       XBindingPath="Country" 
                                       YBindingPath="Count"/>
                        </chart:SfChart>

Also ViewModel
            public ObservableCollection<BarChartDataModel> BarChartData { get; set; }
            BarChartData = new ObservableCollection<BarChartDataModel>()
            {
            new BarChartDataModel("USA", 50),
            new BarChartDataModel("Germany", 70),
            new BarChartDataModel("USSR", 65),
            new BarChartDataModel("Britain", 57),
            new BarChartDataModel("Japan", 48),
            };

And Model 

public class BarChartDataModel
    {
        public string Country { get; set; }

        public double Count { get; set; }

        public BarChartDataModel(string xValue, double yValue)
        {
            Country = xValue;
            Count = yValue;
        }
    }

Maybe I have a problem because use DoughnutCharts on the same page. Also all my code (MainPage.xaml and MainPageViewModel)
https://github.com/booooooogdan/forms-wtstatistics

1 Reply 1 reply marked as answer

YP Yuvaraj Palanisamy Syncfusion Team November 13, 2020 09:24 AM UTC

Hi Bogdan, 
 
Greetings from Syncfusion. 
 
We have analyzed your query and we would like to let you know that the reported problem has been resolved by setting of VerticalOptions to FillAndExpand. StackLayout/ScrollView control measures its children with the respective control’s minimum height for vertical orientation and minimum width for horizontal orientation. Since the chart control’s minimum height and width are zero, it appears blank. 
 
<Frame VerticalOptions="FillAndExpand"> 
 
     <StackLayout> 
 
         <chart:SfChart VerticalOptions="FillAndExpand">

                  . . .
 
 
         </chart:SfChart> 
 
     </StackLayout> 
 
</Frame> 
 
Also, we have prepared the sample for your reference. Please find the sample from the below link. 
 
  
For more detail please refer the below KB document 
 
 
Regards, 
Yuvaraj. 


Marked as answer
Loader.
Up arrow icon