var data2 = google.visualization.arrayToDataTable([
    ['state' , 'town','count'],
    <?php
        $getStateTownInfo = mysql_query("SELECT 
`state`,`town`,SUM(`outlet_status`) as salesCovered FROM `poientry` group 
by town");
        $getTowns = Array();
        $getStatesTowns = Array();
        while( $row = mysql_fetch_assoc($getStateTownInfo)){
            $state = $row['state'];
            $town = $row['town'];
            $getTowns[] = $town;
            $getStatesTowns[] = $state;
            $salesCovered = $row['salesCovered'];
            echo "['{$state}', '{$town}', {$salesCovered}],";
        }
    ?>
    
    ]);

var townArray = new Array();
    <?php foreach($getTowns as $key => $val){ ?>
        townArray.push('<?php echo $val; ?>');
    <?php } ?> 


var townsColumns = [1];
    for (var i = 0; i < townArray.length; i++) {
        townsColumns.push({
            type: 'number',
            label: townArray[i],
            calc: (function (x) {
                return function (dt, row) {
                    return (dt.getValue(row, 1) == townArray[x]) ? 
dt.getValue(row, 2) : null;
                }
            })(i)
        });
    }
  
  //alert(townsColumns.toSource());
  //chart wrapper for data2
  var chart2 = new google.visualization.ChartWrapper({
    chartType: 'ColumnChart',
    containerId: 'chart_div2',
    dataTable: data2,
    options: {
      height: 300,
      width: 800,
      bar: {groupWidth: '130%'},
    },
    /***view****/
    view: {
        columns: townsColumns
    }
  });
  

in my above code i want to update the view in the chart2 object dynamically 
in the 
google.visualization.events.addListener(chart, 'select', function () 
{-------------}

chart is the another ChartWrapper

-- 
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 http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to