Is it possible to set font-family for any of the non-flash Google chart visualizations? Specifically for things like the text on the chart axis. Google charts is powerful, but ugly. And unfortunately I can’t move to something nicer, like gRaphael.
相关问题
- Is there a limit to how many levels you can nest i
- How to toggle on Order in ReactJS
- void before promise syntax
- Keeping track of variable instances
- Can php detect if javascript is on or not?
Have a look to the textstyle properties, take for example the
hAxis.textStyle
:You can change the font family like this: fontName: 'Arial'
So, these are both technically accurate answers, but I wanted to add a little bit of context (that I couldn't add in comments because I don't have the appropriate reputation).
My solution was to directly change the elements within the SVG container using jQuery loaded in after the chart enters the "ready" state, but before they're rendered as PNGs:
There's probably a cleaner way to do all of that (I'm a hacky coder, at best), and I've still got some issues to work out, like fonts reverting when you hover and the tooltips not getting styled right, but that's the best way to ensure consistency between what's displayed onscreen and what, inevitably, your users are going to want to print.