using number in first column

15 views
Skip to first unread message

slavix

unread,
Dec 2, 2011, 8:35:54 PM12/2/11
to Google Visualization API
Hello,
I need to create a ColumnChart and have a question about using number
in x-axis and have data normalization and scaling being done
automatically. I can use number in first column in Line Charts and the
chart does scaling for me. Now I need to do the same for Column Chart.
Unfortunately the same is not working for Column Chart as it shows x-
axis as another column if I try changing type to number.

line_data = new google.visualization.DataTable({
cols: [
{id: 'price', label: 'Price', type: 'number'},
{id: 'bid', label: 'Bids', type: 'number'}
],
rows: [
{c:[ {v: 0.008}, {v: 8786.0} ]},
{c:[ {v: 0.01}, {v: 8755.0} ]},
{c:[ {v: 0.011}, {v: 8709.0} ]},
{c:[ {v: 0.032}, {v: 8648.0} ]}
]
})

asgallant

unread,
Dec 2, 2011, 9:49:17 PM12/2/11
to google-visua...@googlegroups.com
What do you mean by "data normalization and scaling"?  The charts don't normalize anything.  What do you want to have, an (X,Y) scatter-plot-like Column Chart?  I don't think that can be done.  You can, however, use a DataView to translate the first column into a string and draw the chart based on the view; see http://jsfiddle.net/526pL/.

slavix

unread,
Dec 3, 2011, 2:31:21 AM12/3/11
to Google Visualization API
I have a Line Chart with number for first column, where no matter the
data points the chart come out well scaled. For Column Chart I am
supposed to provide x,y points for each column, but I would like to
have the many data points pre-processed and split among corresponding
columns in a scaled fashion, so that there are only a few (10-20)
columns, no matter the number of data points.

visigoth

unread,
Dec 5, 2011, 3:27:07 AM12/5/11
to google-visua...@googlegroups.com
I am not sure I fully understand your intention - would you like the X axis to have one label per row in the data table, or would you like the chart to come up with round gridline values?
Reply all
Reply to author
Forward
0 new messages