Google Charts

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ranjaniVinsInfo
    New Member
    • Jan 2012
    • 34

    Google Charts

    Hai,
    I am using Google Chart tools for creating Charts. I am using Combo Chart but in that i want to display Dynamic Values.that means i want to populate the Row Data's using 'for Statement'.

    Below is my code.

    Code:
    <html xmlns="http://www.w3.org/1999/xhtml">
      <head>
        <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
        <title>
          Google Visualization Sample
        </title>
        <script type="text/javascript" src="http://www.google.com/jsapi"></script>
        <script type="text/javascript">
          google.load('visualization', '1', {packages: ['corechart']});
        </script>
        <script type="text/javascript">
          function drawVisualization() {
            var rowData = [['Month', 'Bolivia', 'Ecuador', 'Madagascar', 'Papua  Guinea',
                            'Rwanda', 'Average'],
                           ['2004/05', 165, 938, 522, 998, 450, 614.6],
                           ['2005/06', 135, 1120, 599, 1268, 288, 682],
                           ['2006/07', 157, 1167, 587, 807, 397, 623],
                           ['2007/08', 139, 1110, 615, 968, 215, 609.4],
                           ['2008/09', 136, 691, 629, 1026, 366, 569.6]];
            var data = google.visualization.arrayToDataTable(rowData);
            var ac = new google.visualization.ComboChart(document.getElementById('visualization'));
            ac.draw(data, {
              title : 'Monthly Coffee Production by Country',
              width: 600,
              height: 400,
              vAxis: {title: "Cups"},
              hAxis: {title: "Month"},
              seriesType: "bars",
              series: {5: {type: "line"}}
            });
          }
          google.setOnLoadCallback(drawVisualization);
        </script>
      </head>
      <body style="font-family: Arial;border: 0 none;">
        <div id="visualization" style="width: 600px; height: 400px;"></div>
      </body>
    </html>
    Thanks.
    Last edited by Dormilich; Feb 1 '12, 10:43 AM. Reason: Please use [CODE] [/CODE] tags when posting code.
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    So what problem are you having?

    Comment

    • ranjaniVinsInfo
      New Member
      • Jan 2012
      • 34

      #3
      I want to display the Chart using Dynamic values. I am using Bar Chart normally.if user click stacked bar the Bar Chart change to Stacked Bar Chart. In Stacked Bar i am using the Line Chart for Average Line. So i use Combo Chart for all it.
      But I cannot display the Values Dynamically.The Combo Chart only allows Staic values like my Example Code.Give me Any Solution for this.

      Comment

      • Rabbit
        Recognized Expert MVP
        • Jan 2007
        • 12517

        #4
        Dynamic in what way?

        Comment

        • ranjaniVinsInfo
          New Member
          • Jan 2012
          • 34

          #5
          I need to use for loop inside Array for Dynamic Datas. Is this possible?

          Comment

          • Rabbit
            Recognized Expert MVP
            • Jan 2007
            • 12517

            #6
            Certainly it is possible. Still doesn't explain where this dynamic data is coming from, which will directly affect your implementation.

            Comment

            • ranjaniVinsInfo
              New Member
              • Jan 2012
              • 34

              #7
              Thanks for yours useful info.

              Comment

              Working...