Corechart Visualization Configuration

54 views
Skip to first unread message

Oliver Kilk

unread,
Mar 27, 2012, 8:17:44 AM3/27/12
to Google Visualization API
Hey,

Why is that if I try to add options like backgroundColor.stroke or any
other "new" options with ' . ' between, code gives an error and doesnt
work. Even though I have corechart loaded.

<--
var options = {title: 'Chart',
backgroundColor: '#D6D6D6',
backgroundColor.stroke: '#FFF',
height: 265,
};

Color.stroke is syntax error.

Other problem is with date.
data.addColumn('date', 'Date');
data.addRows([
['01.01.2010', xxxx],
-->

What do I need to data.addRows as the date to get an output as a date,
for example Mar 23, 2012 instead of the date I inserted?

asgallant

unread,
Mar 27, 2012, 1:19:39 PM3/27/12
to google-visua...@googlegroups.com
The dot notation only works if the base element is already an object.  For 'backgroundColor', the option can either be an object or a string, not both as you try to do.  Try this instead:

var options = {
    title: 'Chart',
    backgroundColor: {
         stroke: '#FFF',
         fill: '#D6D6D6'
    },
    height: 265
};

Dates must be added as javascript Date objects, like this (note that months are 0-indexed, so January is 0 not 1):

new Date(<year>, <month>, <day>) 

so the dates would be added like this:

data.addRows([
          [new Date(2010, 1, 1), xxxx], // <-- Feb 2, 2010
          [new Date(2012, 2, 23), yyyy], // <-- Mar 23, 2010
]);
Reply all
Reply to author
Forward
0 new messages