You have a PieChart and you want to change it into a BarChart or a 
LineChart?  You can do that by creating a new chart object and drawing it 
in the same div as the PieChart:

[javascript]
function drawChart () {
    var data = new google.visualization.DataTable();
    data.addColumn('string', 'Category');
    data.addColumn('number', 'Value');
    
    data.addRows([
        ['Foo', 5],
        ['Bar', 7],
        ['Baz', 4]
    ]);
    
    var chart = new 
google.visualization.PieChart(document.querySelector('#chart_div'));
    chart.draw(data, {
        height: 400,
        width: 600
    });
    
    $('#clickMe').click(function () {
        chart.clearChart();
        chart = new 
google.visualization.BarChart(document.querySelector('#chart_div'));
        chart.draw(data, {
            height: 400,
            width: 600
        });
        $(this).hide();
    });
}
google.load('visualization', '1', {packages:['corechart'], callback: 
drawChart});

[HTML]
<div id="chart_div"></div>
<input type="button" value="click me to change to a BarChart" id="clickMe" 
/>

see it working here: http://jsfiddle.net/asgallant/MmKYt/

On Tuesday, December 24, 2013 8:03:16 AM UTC-5, [email protected] wrote:
>
>
>

-- 
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