0

hi all,

am trying to add google chart to my application. i want a graph like the one attached. Below is the code which i am using to generate the GRAPH. i am able to generate for only 1 graph
My question is how to pass value dynamically and to get repective graph.

7a693d4672c6d3f967fc43abe7b9fd71

 google.load("visualization", "1", {packages:["corechart"]});
          google.setOnLoadCallback(drawChart);
         function drawChart() {     
                var jsonData = $.ajax({
                    url: "php/tracker.php",
                    dataType: "json",
                    async: false
                }).responseText;

                var obj = jQuery.parseJSON(jsonData);
                var data = google.visualization.arrayToDataTable(obj);

            var options = {
              chartArea:{left:50,top:30,width:"80%",height:"80%"},
              hAxis: {title: 'Year',  titleTextStyle: {color: 'red'}},
               series: {
                0: {
                    color: '#058dc7',
                    lineWidth: 3,
                    pointSize: 10
                }
            }
            };
            var chart = new google.visualization.AreaChart(document.getElementById('chart_div'));
            chart.draw(data, options);
          }
Attachments chart.JPG 33.71 KB
2
Contributors
1
Reply
14
Views
4 Years
Discussion Span
Last Post by pritaeas
0

You should pass the inputs as parameters to your tracker.php script. You can see how in the jQuery documentation for ajax.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.