Google Chart Background Color

4,757 views
Skip to first unread message

firebait

unread,
Jan 11, 2012, 3:22:06 PM1/11/12
to Google Visualization API
I'm styling a google chart using the javascript api. I want to change
the background of the area where the data is plotted. For some reason
when I set background options like so:

chart.draw(data, { backgroundColor: { fill: "#F4F4F4" } })

It changes the the background of the whole chart and not the area
where the data is plotted. Any ideas on how to only change the
background of the plotted area?
Thanks

Jinji

unread,
Jan 12, 2012, 9:23:25 AM1/12/12
to google-visua...@googlegroups.com
Sorry, but this is not supported at the moment.


--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To post to this group, send email to google-visua...@googlegroups.com.
To unsubscribe from this group, send email to google-visualizati...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-visualization-api?hl=en.


Mitesh Chauhan

unread,
Jan 27, 2014, 5:24:47 AM1/27/14
to google-visua...@googlegroups.com, ji...@google.com


I want to add background color for some range. is that possible?


On Thursday, 12 January 2012 19:53:25 UTC+5:30, Jinji wrote:
Sorry, but this is not supported at the moment.

On Wed, Jan 11, 2012 at 10:22 PM, firebait <marco...@gmail.com> wrote:
I'm styling a google chart using the javascript api. I want to change
the background of the area where the data is plotted. For some reason
when I set background options like so:

chart.draw(data, { backgroundColor: { fill: "#F4F4F4" } })

It changes the the background of the whole chart and not the area
where the data is plotted. Any ideas on how to only change the
background of the plotted area?
Thanks

--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To post to this group, send email to google-visua...@googlegroups.com.
To unsubscribe from this group, send email to google-visualization-api+unsub...@googlegroups.com.

Sergey Grabkovsky

unread,
Jan 27, 2014, 10:02:20 AM1/27/14
to google-visua...@googlegroups.com
Unfortunately, this isn't officially supported. However, you can hack it by adding a area series or a steppedArea series to your chart and making it non-interactive. If you link to a jsfiddle with some of your data, I can show you exactly how to do so.

- Sergey


To unsubscribe from this group and stop receiving emails from it, send an email to google-visualizati...@googlegroups.com.

To post to this group, send email to google-visua...@googlegroups.com.

asgallant

unread,
Jan 27, 2014, 12:49:45 PM1/27/14
to google-visua...@googlegroups.com


On Monday, January 27, 2014 10:02:20 AM UTC-5, Sergey wrote:
Unfortunately, this isn't officially supported. However, you can hack it by adding a area series or a steppedArea series to your chart and making it non-interactive. If you link to a jsfiddle with some of your data, I can show you exactly how to do so.

- Sergey


On Mon, Jan 27, 2014 at 5:24 AM, Mitesh Chauhan <mit...@alakmalak.com> wrote:


I want to add background color for some range. is that possible?

On Thursday, 12 January 2012 19:53:25 UTC+5:30, Jinji wrote:
Sorry, but this is not supported at the moment.

On Wed, Jan 11, 2012 at 10:22 PM, firebait <marco...@gmail.com> wrote:
I'm styling a google chart using the javascript api. I want to change
the background of the area where the data is plotted. For some reason
when I set background options like so:

chart.draw(data, { backgroundColor: { fill: "#F4F4F4" } })

It changes the the background of the whole chart and not the area
where the data is plotted. Any ideas on how to only change the
background of the plotted area?
Thanks

--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To post to this group, send email to google-visua...@googlegroups.com.
To unsubscribe from this group, send email to google-visualization-api+unsubscr...@googlegroups.com.

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 unsubscribe from this group and stop receiving emails from it, send an email to google-visualization-api+unsub...@googlegroups.com.

Mitesh Chauhan

unread,
Jan 28, 2014, 1:27:42 AM1/28/14
to google-visua...@googlegroups.com


I have created Jsfiddle with my chart data.  http://jsfiddle.net/L7KpS/1/ I just want to set Gray or any predefined color background as per below image. thanks in advance...

asgallant

unread,
Jan 28, 2014, 11:10:49 AM1/28/14
to google-visua...@googlegroups.com
You need to create a DataView that adds two series of data to your data set: the first sets the lower bound of the shaded area, the second sets the upper bound.  Use a ComboChart with the first series set to a "bars" type, while the second and third are set to "area" types.  Here's an example based on your code: http://jsfiddle.net/asgallant/L7KpS/2/

Mitesh Chauhan

unread,
Jan 29, 2014, 5:00:17 AM1/29/14
to google-visua...@googlegroups.com

Ohh gr8. Its working awesome. thx a lot...


--
You received this message because you are subscribed to a topic in the Google Groups "Google Visualization API" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-visualization-api/v-waN8ija1Q/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-visualizati...@googlegroups.com.

To post to this group, send email to google-visua...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/groups/opt_out.



--
Best regards,
Mitesh Chauhan
Web Developer
Alakmalak Technologies Pvt. Ltd.
Reply all
Reply to author
Forward
0 new messages