Web page displaying Empty Pie Chart for dynamic values in ASP.Net

on Jan 16, 2018 12:14 AM

i dynamically set the value in pie chart My code as follows

<asp:PieChart ID="PieChart1" runat="server" ChartHeight="300"
ChartWidth="450" ChartTitle="Today's Attendance"
<asp:PieChartValue Category="Present" Data="80" />
<asp:PieChartValue Category="Absent" Data="10" />
<asp:PieChartValue Category="Leave" Data="10" />

when i run the above code shows the empty pie chart. what is the mistake in my above code.

Download FREE API for Word, Excel and PDF in ASP.Net: Download
on Feb 01, 2018 07:05 AM

in page load code as follows

    DataTable _objdt = new DataTable();
    _objdt = GetDataForChart();

    public void BindDataToChartcontrol(DataTable _objdt)
        Chart1.DataSource = _objdt;


    public DataTable GetDataForChart()
        DataTable _objdt = new DataTable();

        _objdt.Columns.Add("Country", typeof(string));
        _objdt.Columns.Add("Growth", typeof(long));

        var _objrow = _objdt.NewRow();
        _objrow["Country"] = "On or Before Time";
        _objrow["Growth"] = 80;

        _objrow = _objdt.NewRow();
        _objrow["Country"] = "Grace Time";
        _objrow["Growth"] = 15;

        _objrow = _objdt.NewRow();
        _objrow["Country"] = "Late Time";
        _objrow["Growth"] = 5;

        return _objdt;

 When i run the above code. pie chart is display