Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
4970
How to set dynamic data for pie chart of XamWebChart?
posted

Suppose data for pie chart like:

Name1 100
Name2 200
Name3 300
Name4 400

how to set this data in code for pie chart? the data could be loaded dynamically. Xaml and code sample please. Document only description for pie chart, no sample code and xaml.

Thanks.

Parents
No Data
Reply
  • 17559
    posted

    Hello benjaminswitzer ,

     

    I have been looking into your question and I created a small sample for you which demonstrates a possible approach to add the pie series in XamWebChart dynamicly from code and also through xaml. In my sample I have achieved this functionality by assigning a new series for the chart with your test data as follows:

            public void GenerateSeriesData()

            {

                mySeries.Label = "Series 1";

                mySeries.ChartType = ChartType.Pie;

     

                for (int i = 1; i < 5; i++)

                {

                    DataPoint point = new DataPoint();

                    point.Label = "Name " + i;

                    point.Value = i*100;

                    point.Marker=new Marker();

                    mySeries.DataPoints.Add(point);

                }

     

    If you need any further assistance on this matter, please feel free to ask.

    XamWebChartPie.zip
Children