you did something quite silly, you declared the datatable with the name
ticketsData and set its columns and rows under the name dataTable.

this is what you did:
var *ticketsData *= new google.visualization.DataTable();
*dataTable*.addColumn('string','Place / Movie');
*dataTable*.addColumn('number', 'London');
*dataTable*.addColumn('number', 'Paris');
*dataTable*.addColumn('number', 'Moscow');
*dataTable*.addRows([['Pi',5,25,7],
['Requiem',9,20,30],['Fountain',1,3,6]]);

look at the bolded red variables. they all need to be with the same name (*
ticketsData *in your case) and it will all work fine

:-)


On Mon, Oct 31, 2011 at 8:35 AM, Sherlock Holmes <[email protected]> wrote:

> Hi,
>
> The following is the code I had obtained from examples. Here there is
> a reference to a spreadsheet. I wanted to remove it and use my
> hardcoded values. But the code below (whatever I have commented) does
> not work when I un-comment. Can you pls help me on this.. Where am I
> wrong ??
>
>    <script type="text/javascript">
>      google.load('visualization', '1',
>          {'packages': ['table', 'map', 'corechart']});
>      google.setOnLoadCallback(initialize);
>
>      function initialize() {
>        var query = new google.visualization.Query(
>            'https://spreadsheets.google.com/pub?key=pCQbetd-
> CptF0r8qmCOlZGg');
>        query.send(draw);
>      }
>
>      function draw(response) {
>        if (response.isError()) {
>          alert('Error in query');
>        }
>
>        var ticketsData = response.getDataTable();
>
>                //create data table object
> //var ticketsData = new google.visualization.DataTable();
>
> //define columns
> // dataTable.addColumn('string','Place / Movie');
> // dataTable.addColumn('number', 'London');
> // dataTable.addColumn('number', 'Paris');
> // dataTable.addColumn('number', 'Moscow');
>
> //define rows of data
> // dataTable.addRows([['Pi',5,25,7], ['Requiem',9,20,30],['Fountain',
> 1,3,6]]);
>
>        var chart = new google.visualization.ColumnChart(
>            document.getElementById('chart_div'));
>        chart.draw(ticketsData, {'isStacked': true, 'legend':
> 'bottom',
>            'vAxis': {'title': 'Number of tickets'}});
>      }
>    </script>
>
> Thanks in advance
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Visualization API" group.
> To post to this group, send email to
> [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/google-visualization-api?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-visualization-api?hl=en.

Reply via email to