Thank you for your answer... I'm ALMOST there :) I declared wrapper as global var, I used the getChartType method but still I'm not getting what I need.
so I have these 2 functions now:
var wrapper
function loadEditor() {
// Create the chart to edit.
var table = new google.visualization.Table(document.getElementById('table_div'));
if (sorttest == 1) {
var data = new google.visualization.DataTable(<?=$jsonTableA01?>)
} else {
var data = new google.visualization.DataTable(<?=$jsonTableB01?>)
}
wrapper = new google.visualization.ChartWrapper({
dataTable: data,
left:1,
options: {
'chartArea': {width: '60%', left: 45},
'legend' :'none',
'title':'Number of Newly Opened Roles per <?echo $_SESSION['Display']?>'
}
});
chartEditor = new google.visualization.ChartEditor();
google.visualization.events.addListener(chartEditor, 'ok', redrawChart);
chartEditor.openDialog(wrapper, {});
}
function sortABC() {
var table = new google.visualization.Table(document.getElementById('table_div'));
var CurrChartType = wrapper.getChartType();
sorttest = 1;
var data = new google.visualization.DataTable(<?=$jsonTableA01?>);
var wrapper = new google.visualization.ChartWrapper({
'chartType': CurrChartType,
dataTable: data,
left:1,
options: {
'chartArea': {width: '60%', left: 45},
'legend' :'none',
'title':'Number of Newly Opened Roles per <?echo $_SESSION['Display']?>'
}
});
I get an error on the 2nd line of sortABC()
var CurrChartType = wrapper.getChartType();
but have no idea why...
please help Bro.. :)
You could determine the chart type using
google.visualization.ChartWrapper.getChartType
method. In your case you could declarewrapper
as global variable (it will be initialized oncegoogle.visualization.ChartWrapper
is created) to make it accessible insortABC
function. Then you could get current chart type.The following example demonstrates how to get/set
chart type
of Google Chart.Complete example