Click here to Skip to main content
15,887,746 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
I made a google api graph page Which Shows Order graph from database . i want if any one click on the graph pointed node then it redirect to another page with x and y co -ordinate value..
my function is

C#
private void BindAuthorisedOrder_LineGraph()
 {
     try
     {
         HttpResponseMessage response = objCRUD.Get("api/Orders/0/0/1/");// Blocking call!
         if (response.IsSuccessStatusCode)
         {
             var AllOrder = response.Content.ReadAsAsync<List<OrdersModel>>().Result;
           //  var AllOrder = AllOrders.Where(x => x.OrderStatusID == 1).Take(7).ToList();
             if (AllOrder.Count > 0)
             {
                 StrOrderAUOL.Append(@"<script type=text/javascript> google.load( *visualization*, *1*, {packages:[*corechart*]});
                   google.setOnLoadCallback(drawChart);
                   function drawChart() {
                     var data = new google.visualization.DataTable();
                     data.addColumn('string', 'OrderDate');
                     data.addColumn('number', 'Order');

                     data.addRows(" + AllOrder.Count + ");");

                 Int32 i;
                 for (i = 0; i <= AllOrder.Count - 1; i++)
                 {
                     StrOrderAUOL.Append("data.setValue( " + i + "," + 0 + "," + "'" + AllOrder[i].OrderDate.ToShortDateString() + "');");
                     StrOrderAUOL.Append("data.setValue(" + i + "," + 1 + "," + AllOrder[i].OrderCount.ToString() + ") ;");
                 }
                 StrOrderAUOL.Append("   var chart = new google.visualization.LineChart(document.getElementById('DivAUOL'));");
                 StrOrderAUOL.Append(" chart.draw(data, {width: 350, height: 300, title: 'Authorized Order',");
                 StrOrderAUOL.Append("hAxis: {title: 'Date', titleTextStyle: {color: 'green'}}");
                // StrOrderAUOL.Append("vAxis: {title: 'Order', titleTextStyle: {color: 'green'}}");
                 StrOrderAUOL.Append("}); }");
                 StrOrderAUOL.Append("</script>");
                 LiteralAUOL.Text = StrOrderAUOL.ToString().TrimEnd(',').Replace('*', '"');
             }
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }


 }




Any one can help me. I am in Big trouble just give me reply............
Thank you in advance
Posted
Updated 12-Dec-13 22:45pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900