Hello, Can some one help me out ,whats the problem with the code. Am trying to set the Annotation for my chart.But Am getting Table has no columns.× issue. Below is the code that Am trying to get it done
<!--<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>--> <script type='text/javascript' src='https://www.google.com/jsapi'></script> <script type="text/javascript"> //google.charts.load('current', {packages: ['corechart']}); //google.charts.setOnLoadCallback(drawChart); google.load('visualization', '1', {packages:['corechart','controls','map','table','gauge'], callback:drawChart}); function drawChart(){ var data = google.visualization.arrayToDataTable([ ['Name', 'Sal'], ['Michael' , 555], ['Elisa', 777], ['Robert', 344], ['John', 222], ['Jessica', 116], ['Aaron', 111], ['Margareth', 668], ['Margareth1', 348], ['Margareth2', 450], ['Margareth3', 30] ]); var options = { title: "Name Vs Sal", width: 600, height: 400, bar: {groupWidth: "95%"}, legend: { position: "none" }, }; var AnnotationView_Company = new google.visualization.DataView(data); AnnotationView_Company.setColumns([0 , 1, { calc: 'stringify', sourceColumn: 1, type: 'string', role: 'annotation' }]); //var datatableN=AnnotationView_Company.toDataTable(); //DataTable to DataView //var csv = google.visualization.dataTableToCsv(datatableN); //console.log(csv); var chartWrapper = new google.visualization.ChartWrapper({ 'chartType': 'ColumnChart', 'containerId': 'chartDiv' , 'options': options , dataTable: data, view: { columns: AnnotationView_Company } }); chartWrapper.draw(); // var chart = new google.visualization.ColumnChart(document.getElementById("chartDiv")); //chart.draw(AnnotationView_Company, options); //var columnChart = new google.visualization.ColumnChart(document.getElementById('chartDiv')); //columnChart.draw(data, {title:' Name Vs Donuts Eaten',width: 600, height: 300, legend:''}); } </script> <body> <div id="chartDiv"></div> </body> Please help me out. regards, Naresh -- 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 https://groups.google.com/group/google-visualization-api. To view this discussion on the web visit https://groups.google.com/d/msgid/google-visualization-api/f3bf2c70-8743-47cd-926c-48fb6d1a2091%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
