Chart won't display result as error found

I am learning how to chart using the example in https://blazor.syncfusion.com/documentation/chart/working-with-data

I Just copy and paste data but the chart won't display the result

Regards

Sam


Attachment: Chart_Error_ad683c4a.rar

1 Reply

SB Swetha Babu Syncfusion Team April 18, 2022 06:06 AM UTC

Hi Sao,


Greetings from Syncfusion.


We are unable to reproduce the reported scenario. However, we have created a simple blazor application using the provided code snippet with the latest package version(v20.1.48) and the same can be downloaded from the below link.


Sample link: https://www.syncfusion.com/downloads/support/directtrac/general/ze/Chart1119859097


Code Snippet:


<SfChart Title="Inflation - Consumer Price" Width="60%">

    <ChartPrimaryXAxis IntervalType="IntervalType.Years" LabelFormat="yyyy" ValueType="Syncfusion.Blazor.Charts.ValueType.DateTime">

    </ChartPrimaryXAxis>

              <ChartSeriesCollection>

        <ChartSeries DataSource="@ConsumerReports" XName="XValue" YName="YValue" Type="ChartSeriesType.Line">

        </ChartSeries>

    </ChartSeriesCollection>

</SfChart>

 

@code{

    public class ChartData

    {

        public DateTime XValue { get; set; }

        public double YValue { get; set; }

    }

 

    public List<ChartData> ConsumerReports = new List<ChartData>

    {

                             new ChartData { XValue = new DateTime(2005, 01, 01), YValue = 21 },

                             new ChartData { XValue = new DateTime(2006, 01, 01), YValue = 24 },

                             new ChartData { XValue = new DateTime(2007, 01, 01), YValue = 36 },

                             new ChartData { XValue = new DateTime(2008, 01, 01), YValue = 38 },

                             new ChartData { XValue = new DateTime(2009, 01, 01), YValue = 54 },

                             new ChartData { XValue = new DateTime(2010, 01, 01), YValue = 57 },

                             new ChartData { XValue = new DateTime(2011, 01, 01), YValue = 70 },

              };

}


Screenshot:



If the reported scenario still persists, please modify the above application to reproduce the reported scenario and let us know the package version that you are using. It will be helpful for us to analyze further and assist you better.


Regards,

Swetha


Loader.
Up arrow icon