First, in order to make sure that the problem indeed lies with the second column type, you can look at the response itself and verify what are the returned column types (this should be in json format). If indeed both columns are strings, you need to look at your code which generates the DataTable from the csv file. Otherwise, the problem is someplace else.
If you are using our external Java library to create the DataTable from the csv, you need to specify the the column types (this is not part of the csv file itself). The general documentation of the library is here<http://code.google.com/apis/visualization/documentation/dev/dsl_javadocs/index.html>, you can look inside the package com.google.visualization.datasource.util<com/google/visualization/datasource/util/package-frame.html> , and specifically, the CsvDataSourceHelper <CsvDataSourceHelper.html> class which can construct the DataTable from the csv file/url. The read function also expects a the type for each of the columns. Hope it will work now, Viz Kid. On Mon, Nov 30, 2009 at 3:01 PM, gman <[email protected]> wrote: > Thanks Viz Kid --- That would make sense. I just created the csv file > using the linux vi editor and saving as a .csv file. > > Does it have to be created a special way? > > I thought a csv file was just a text file with comma separating the > data fields, with each record on a new line. Am I missing something?. > > On Nov 29, 5:26 pm, Viz Kid <[email protected]> wrote: > > Hi. > > > > Is it possible that the data table which is constructed from the csv has > > both columns type to be 'string' and not one 'string' and one 'number'? > If > > this is the case, the outcome is indeed that no gauge is being displayed. > > > > Viz Kid > > > > On Sun, Nov 29, 2009 at 2:26 PM, gman <[email protected]> wrote: > > > I just started playing with this yesterday and have run into a problem > > > I just cannot seem to get by. > > > > > Using the sample code for gauges I can display the gauges fine. When I > > > get the data from a csv file, no gauges are displayed. However if I > > > change to display a table, it displays just fine. The csv file looks > > > like this: > > > > > Label,Value > > > Memory,80 > > > CPU,55 > > > Network,68 > > > > > This does work: > > > > > // var data = response.getDataTable(); > > > var data = new google.visualization.DataTable(); > > > data.addColumn('string', 'Label'); > > > data.addColumn('number', 'Value'); > > > data.addRows(3); > > > data.setValue(0, 0, 'Memory');// data.setValue(0, 1, > > > 80); > > > data.setValue(1, 0, 'CPU');// data.setValue(1, 1, > > > 55); > > > data.setValue(2, 0, 'Network'); > > > data.setValue(2, 1, 68); > > > > > var chart = new google.visualization.Gauge > > > (document.getElementById('char > > > t_div')); > > > chart.draw(data, null); > > > > > This does not work: > > > > > var data = response.getDataTable(); > > > // var data = new google.visualization.DataTable(); > > > // data.addColumn('string', 'Label'); > > > // data.addColumn('number', 'Value'); > > > // data.addRows(3); > > > // data.setValue(0, 0, 'Memory');// data.setValue(0, > > > 1, 80); > > > // data.setValue(1, 0, 'CPU');// data.setValue(1, 1, > > > 55); > > > // data.setValue(2, 0, 'Network'); > > > // data.setValue(2, 1, 68); > > > > > var chart = new google.visualization.Gauge > > > (document.getElementById('char > > > t_div')); > > > chart.draw(data, null); > > > > > Yet --- Exactly the same code, but changing to a table does work: > > > > > var data = response.getDataTable(); > > > // var data = new google.visualization.DataTable(); > > > // data.addColumn('string', 'Label'); > > > // data.addColumn('number', 'Value'); > > > // data.addRows(3); > > > // data.setValue(0, 0, 'Memory');// data.setValue(0, > > > 1, 80); > > > // data.setValue(1, 0, 'CPU');// data.setValue(1, 1, > > > 55); > > > // data.setValue(2, 0, 'Network'); > > > // data.setValue(2, 1, 68); > > > > > var chart = new google.visualization.Table > > > (document.getElementById('char > > > t_div')); > > > chart.draw(data, null); > > > > > Any ideas or suggestions? > > > > > -- > > > > > 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]<google-visualization-api%[email protected]> > <google-visualization-api%[email protected]<google-visualization-api%[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]<google-visualization-api%[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.
