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);
          }

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.