Thursday 21 February 2019

How to create Google Pie Chart in ASP.NET?

Simple example of a Google Pie Chart

Hello everyone welcome ,
If you want to create a Google PIE Chart then watch my video and follow my blogs ...
Pie Chart
Google Pei Chart


Watch my Latest Video on Youtube for creating Pie Chart

Steps involve creating Pie Chart in ASP.NET:


Open Visual Studio 2010 or Latest Version, Create a website project ...

Add one webform and give form name as "piechart.aspx"

Add website name as PieChart.aspx


In Head section write following code....

<head runat="server">
    <title> Google PieChart </title>

    <!--Load the AJAX API--->

   <!--Load the AJAX API-->
    <script src="" type="text/javascript"></script>
    <script type="text/javascript">

        // Load the Visualization API and the corechart package.
        google.charts.load('current', { 'packages': ['corechart'] });

        // Set a callback to run when the Google Visualization API is loaded.


        // Callback that creates and populates a data table,
        // instantiates the pie chart, passes in the data and
        // draws it.

        function drawChart() {

            // Create the data table.
            var data = new google.visualization.DataTable();
            data.addColumn('string', 'Topping');
            data.addColumn('number', 'Slices');
          ['India', 4],
          ['America', 1],
          ['Zapan', 1],
          ['Russia', 2],
          ['SriLanka', 1],
          ['Canada', 1]

            // Set chart options
            var options = { 'title': 'How many Viewers watching my videos',
                'width': 400,
                'height': 300

            // Instantiate and draw our chart, passing in some options.
            var chart = new google.visualization.PieChart(document.getElementById('chart_div'));
            chart.draw(data, options);

in Body section write Div tag.

    <form id="form1" runat="server">

    <!---Add DIV that will load pie chart--->

    <div id="chart_div">



Connect Your PC or Laptop with Internet so its can store the API file in browser buffer.And Run  "PieChart.aspx" webform in browser


Google pei chart

Thanks for watching My videos , hit like , subscribe our channel & don't forget to share with your friends

No comments:

Post a Comment

Popular Posts