Currently i am creating chart using google chart. for this i have created one custom function called myJchart
as below.
function myJChart(ChartPackage,ChartType,ChartData,ChartTitel,ChartSubtitle,Chart3D,ChartHeight,ChartWidth,ChartDivID){
google.load("visualization", "1", {packages:[ChartPackage]});
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable(ChartData);
var options = {
title: ChartTitel,
subtitle: ChartSubtitle,
is3D: true,
height: ChartHeight,
width: ChartWidth
};
var chart = new google.visualization.PieChart(document.getElementById(ChartDivID));
chart.draw(data, options);
}
}
And Calling function
myJChart('corechart','PieChart',<?php echo $jsonTable;?>,'test','test again',true,'600','800','chart_div');
this above function is working good.
now the problem is that when i pass the ChartType
parameter to google google.visualization.ChartType
i am getting below error message
Uncaught TypeError: google.visualization.ChartType is not a function
i used [ChartType] but i got this error Unexpected token [
any suggestion will help.