Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

c3js: Is there a way to change font size?

Tags:

c3.js

Can I enlarge the font of c3js charts, such as in axis labels, data labels or categories? I'm interested in setting the general-case font to a larger one.

I searched the docs and couldn't find anything that related to "font" in any way.

like image 325
Kludge Avatar asked Feb 11 '15 14:02

Kludge


People also ask

How do I change font size in editor?

Use a keyboard shortcut to change the font size in the editor. To increase the font size, press ⌃⇧Period on macOS or Alt+Shift+Dot on Windows and Linux. To decrease it, press ⌃⇧Comma on macOS or Alt+Shift+Comma on Windows and Linux.

How do I make my font size normal?

In HTML, you can change the size of text with the <font> tag using the size attribute. The size attribute specifies how large a font will be displayed in either relative or absolute terms. Close the <font> tag with </font> to return to a normal text size.


2 Answers

Use the following two classes.

.c3-axis-y text 
{
  font-size: 15px; //change the size of the fonts
}

.c3-axis-x text 
{
  font-size: 15px; //change the size of the fonts
}

For a y axis on the right hand side use - .c3-axis-y2 text

like image 72
Janmejay Shikhare Avatar answered Oct 26 '22 07:10

Janmejay Shikhare


C3 give some classes for each element when generating. So, you can change the style of the elements by using those classes with CSS.

Example: 1. Line style The lines have c3-line-[id] class, so this class can be used to define the style in css.

A Web Inspector would be useful to check classes.

In your case labels are:

  • c3-legend-item-event
  • tick
  • ....

From C3js documentation: http://c3js.org/gettingstarted.html

like image 20
aberna Avatar answered Oct 26 '22 08:10

aberna