Hi Team,

I need to get a value in the chart when im click. ao i add a listner
and can get the column & row index too.
but i fail to get the value.

Please help me to find it

here is my code

I want to get 2004 ,2005 & ....
when i was click on a column.

Data Table

data = new google.visualization.DataTable();
        data.addColumn('string', 'Year');
        data.addColumn('number', 'Sales');
        data.addRows(4);
        data.setValue(0, 0, '2004');
        data.setValue(0, 1, 1000);
        data.setValue(1, 0, '2005');
        data.setValue(1, 1, 1170);
        data.setValue(2, 0, '2006');
        data.setValue(2, 1, 660);
        data.setValue(3, 0, '2007');
        data.setValue(3, 1, 1030);

        var chart = new google.visualization.ColumnChart
(document.getElementById('chart_div'));
        chart.draw(data, {width: 400, height: 240, is3D: true, title:
'Company Performance'});

        google.visualization.events.addListener(chart, 'select',
handleSelect);



function handleSelect() {

        var selection = this.getSelection();

        var message = '';
        var col = 0;
        var row = 0;
          for (var i = 0; i < selection.length; i++) {
            var item = selection[i];
            if (item.row != null && item.column != null) {
              row = item.row;
              col = item.column;
              message += '{row:' + item.row + ',column:' + item.column
+ '}';
            } else if (item.row != null) {
              message += '{row:' + item.row + '}';
            } else if (item.column != null) {
              message += '{column:' + item.column + '}';
            }
          }
          if (message == '') {
            message = 'nothing';
          }
          alert('You selected ' + message);
            //alert(message);

            alert('1',data.getColumnLabel(col));
            alert('2',data.getValue(row, col));
            alert('3',data.getDistinctValues(col));
            alert('4',data.getColumnType(col));
            alert('5',data.getColumnRange(col));
            alert('6',data.getColumnPattern(col));   //from this i get
nothing
            alert('7',data.getColumnId(col));      //from this i get
nothing

I didnt get 2004, 2005..... from any of the ways.
Please help me to find it

Thanks & best Regards,
Sajeevi

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