So what you are trying to draw is not a scatter chart, but a line chart, as in scatter chart the x axis is values based, and here its categories.The actual scatter chart revert to a line chart if the first column is a labels column. In your case, please use line chart instead.
Regards, VizGuy On Wed, Jun 24, 2009 at 1:05 PM, [email protected] < [email protected]> wrote: > > Hi Team, > > I can add string for first column to scatterChart if there are two > columns. > > function drawChart() { > var data = new google.visualization.DataTable(); > data.addColumn('string', 'Name'); > data.addColumn('number', 'Sub1 Marks'); > data.addRows(3); > data.setCell(0, 0, 'S1'); > data.setCell(0, 1, 65); > data.setCell(1, 0, 'S2'); > data.setCell(1, 1, 89); > data.setCell(2, 0, 'S3'); > data.setCell(2, 1, 76); > var chart = new google.visualization.ScatterChart > (document.getElementById('chart_div')); > chart.draw(data, {width: 400, height: 240, titleX: > 'Name',titleY: 'Marks', legend: 'none', pointSize: 5}); > } > > if if there are more than two columns and if the first column be > string as above the chart is not what i expect. > > function drawChart() { > var data = new google.visualization.DataTable(); > data.addColumn('string', 'Name'); > data.addColumn('number', 'Sub1 Marks'); > data.addColumn('number', 'Sub2 Marks'); > data.addRows(3); > data.setCell(0, 0, 'S1'); > data.setCell(0, 1, 65); > data.setCell(0, 2, 45); > data.setCell(1, 0, 'S2'); > data.setCell(1, 1, 89); > data.setCell(1, 2, 48); > data.setCell(2, 0, 'S3'); > data.setCell(2, 1, 76); > data.setCell(2, 2, 58); > var chart = new google.visualization.ScatterChart > (document.getElementById('chart_div')); > chart.draw(data, {width: 400, height: 240, titleX: > 'Name',titleY: 'Marks', legend: 'none', pointSize: 5}); > } > > please help me to add string for the first column if there are more > than one columns. i need to display string values for the x-axis > values rather than numbers. > > 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 -~----------~----~----~----~------~----~------~--~---
