axis label font style

355 views
Skip to first unread message

Amir Miller

unread,
Jan 13, 2013, 6:39:28 AM1/13/13
to google-visua...@googlegroups.com
Hi,

Is there a way I can make the axis label font not italic?
I see how to change the font, it's size and it's color but it always stays italic.

Thanks,

Amir

asgallant

unread,
Jan 13, 2013, 11:29:13 AM1/13/13
to google-visua...@googlegroups.com
What chart are you using?  I don't recall any of them using italics.

Amir Miller

unread,
Jan 13, 2013, 12:04:04 PM1/13/13
to google-visua...@googlegroups.com
ColumnChart.
Even if you look at the playground you will see the text is italic.

asgallant

unread,
Jan 13, 2013, 12:48:07 PM1/13/13
to google-visua...@googlegroups.com
Ahh, yes, the axis titles are in italics.  I don't believe there is a way to change that in the API.  If you are willing to mess with the SVG/VML of the charts, then you can do this.  Here's a script that changes all italic text in the chart to non-italics: http://jsfiddle.net/asgallant/AcuHp/.  Note that the script uses jQuery for browser detection and document manipulation; you can do all of this with other libraries or plain js if you don't use jQuery.  Also note that since this is messing with the internal code, it could break at any time with an update to the API; none of the internal structure of the charts is guaranteed to be stable across releases.  That said, you're probably safe with this one, as it doesn't muck about with anything critical to the charts.

Amir Miller

unread,
Jan 13, 2013, 12:49:52 PM1/13/13
to google-visua...@googlegroups.com
is there any css option I can use or is this text part of the SVG?

asgallant

unread,
Jan 13, 2013, 1:09:51 PM1/13/13
to google-visua...@googlegroups.com
Font-style is an attribute of the SVG text elements, it's not a style.  You can try to override with styles, it may work.

Amir Miller

unread,
Jan 13, 2013, 1:24:36 PM1/13/13
to google-visua...@googlegroups.com
Excellent, this works:
 <style>
  text{
    font-style:normal
  }
</style>

asgallant

unread,
Jan 13, 2013, 3:19:06 PM1/13/13
to google-visua...@googlegroups.com
Note that since the charts are wrapped in an iframe in old versions of IE (<9), using css still won't work for them.
Reply all
Reply to author
Forward
0 new messages