I could not see the years  list . 

here is my .net code


<script src="http://code.jquery.com/jquery-1.8.2.js";></script>  
    <script src="http://www.google.com/jsapi"; 
type="text/javascript"></script>  
    <script type="text/javascript">
        google.load('visualization', '1', { packages: ['corechart'] });  
    </script>  
    <script type="text/javascript">
        $(function () {
            $.ajax({
                type: 'POST',
                dataType: 'json',
                contentType: 'application/json',
                url: 'Home.aspx/GetChartData',
                data: '{}',
                success:
                function (response) {
                    drawchart(response.d);
                },

                error: function () {
                    alert("Error loading data!");
                }
            });
        })
        function drawchart(dataValues) {
            var data = new google.visualization.DataTable();
            data.addColumn('string', 'year');

            data.addColumn('number', 'intake');
           
           
            for (var i = 0; i < dataValues.length; i++) {
                data.addRow([dataValues[i].Year,dataValues[i].Total]);
            }

            var options = { 
            'title': 'Data Analysis',
                'width': 600,
                'height': 500
            };
           var char= new 
google.visualization.PieChart(document.getElementById('myChartDiv')).
                  draw(data, options);
        }  
    </script>  
    
    <style type="text/css">
        .style1
        {
            font-size: medium;
        }
    </style>
    
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" 
runat="server">
    <br />
    <asp:Image ID="Image2" runat="server" Height="232px" 
        ImageUrl="~/images/8cz96d5cp.jpg" Width="914px" />
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
    Year&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <asp:DropDownList ID="DropDownList1" runat="server" Height="37px">
        <asp:ListItem>2014</asp:ListItem>
        <asp:ListItem>2015</asp:ListItem>
    </asp:DropDownList>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Programe&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <asp:DropDownList ID="DropDownList2" runat="server" Height="37px">
        <asp:ListItem>---All---</asp:ListItem>
        <asp:ListItem>Applied Arts</asp:ListItem>
        <asp:ListItem>ntr</asp:ListItem>
    </asp:DropDownList>
&nbsp;&nbsp;&nbsp;
    <asp:Button ID="Button1" runat="server" onclick="Button1_Click" 
Text="Submmit" 
        Width="100px" />
    <br />
    <br />
    <span class="style1" style="color: #000000">Filter of chart</span><br />
    <asp:LinkButton ID="LinkButton1" runat="server" 
onclick="LinkButton1_Click">Placed</asp:LinkButton>
    <br />
    <asp:LinkButton ID="LinkButton2" runat="server" 
onclick="LinkButton2_Click">Intake</asp:LinkButton>
    <br />
    <asp:LinkButton ID="LinkButton3" runat="server" 
onclick="LinkButton3_Click">Enroll</asp:LinkButton>
    <br />
    <asp:LinkButton ID="LinkButton4" runat="server" 
onclick="LinkButton4_Click">Passed</asp:LinkButton>
    <br />

        <div id="myChartDiv" style="width: 700px; height: 450px;">  
        </div>  
     
</asp:Content>







here is code behined home.aspx

 protected void Page_Load(object sender, EventArgs e)
        {
            n = "SELECT year, intake FROM overview WHERE program='Applied 
Arts' ORDER BY year";
        }
        //call google api
        [WebMethod]
        public static List<employeeDetails> GetChartData()
        {
            // first create table
            DataTable dt = new DataTable();
            //create connection string
            using (SqlConnection con = new SqlConnection(@"Data 
Source=.\SQLEXPRESS;AttachDbFilename=E:\sushant\career\career\App_Data\home.mdf;Integrated
 
Security=True;User Instance=True"))
            {
                con.Open();
                SqlCommand cmd = new SqlCommand(n, con);
                SqlDataAdapter da = new SqlDataAdapter(cmd);
                da.Fill(dt);
                con.Close();
            }
            List<employeeDetails> dataList = new List<employeeDetails>();
            foreach (DataRow dtrow in dt.Rows)
            {
                employeeDetails details = new employeeDetails();
                details.year = dtrow[0].ToString();
                details.Total = Convert.ToInt32(dtrow[1]);
                dataList.Add(details);
            }
            return dataList;
        }

        public class employeeDetails
        {
            public string year { get; set; }
                        public int Total { get; set; }
        }

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-visualization-api/e80f9d3b-7c79-4bbe-b58b-e52afdf57084%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to