C3: Custom legend item tile size & legend item padding

Created on 26 Feb 2015  路  7Comments  路  Source: c3js/c3

For some of our chart designs, we want to have legend element tiles that were lines rather than boxes - i.e. legend element tiles that look like this:
screen shot 2015-02-26 at 2 00 55 pm

Also we want to be able to control the amount of space in between each legend element for more fine-grained control over how it is displayed.

So I want to add custom config options for these:

legend: {
    // amount of padding to put between each legend element
    padding: 5,
    // define custom height and width for the legend item tile
    item: {
        tile: {
            width: 15,
            height: 2
        }
    }
}

The default values for width and height would be the current legend item size.

C-feature-request R-needs-docs

Most helpful comment

This useful configuration is not in the doc yet. That's too bad! I just found it thanks to Google.

All 7 comments

pull request filed
closing

Note this needs to be added to the documentation.

I've been searching for ways to customize tiles, e.g. (adding styles using ::after or ::before) and I found this.
I think this should be added to the docs as soon as possible.

Thanks for this awesome library. 馃槃

how can i manipulate legend text like i want to split a text. how could i do that thanks and advance

@taliffsss I guess you could use CSS for that but to be honest, if you can, use D3 as it is the base for C3.js.

This useful configuration is not in the doc yet. That's too bad! I just found it thanks to Google.

Item padding isn't working when legend is 'inset':

Inset
https://jsfiddle.net/rogeriolino/by8vwsa5/

Default
https://jsfiddle.net/rogeriolino/by8vwsa5/4/

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Zerim picture Zerim  路  3Comments

mwho picture mwho  路  3Comments

udhaya2kmrv picture udhaya2kmrv  路  3Comments

Kreozot picture Kreozot  路  3Comments

seubert picture seubert  路  3Comments