chartjs / chartjs/Chart.js

Allow per line configuration for multiline axes labels

Open
#9,643 2 comments 0 reactions 0 assignees View on GitHub
type: enhancement
Dominant language
JavaScript
Stars
67.7k
Forks
11.9k
Avg merge
7h 39m
Merged PRs (30d)
5

Description

Admittedly, I might be missing something, and this is already possible (see [my question posted to StackOverflow here](https://stackoverflow.com/questions/69136120/chartjs-is-there-a-way-to-control-the-font-options-per-line-for-a-multiline-axi)).

Assuming that what I want to attempt is currently not possible (via existing configuration, or through the current plugin architecture), I am asking for consideration of how the font for a given axes label is configured. Today, returning an array of font objects is possible (within `scales > x|y > ticks > font`) - but when an array is returned, it is assumed that each item in the array corresponds with a given item in the dataset (allowing the developer to do things like have each label be a different color, either by having the size of the font array match the dataset array size, or by looping over `config.tick.label`). Since a given label may be a string or an array of strings (the latter of which allows for multiline labels), could the corresponding font configuration follow the same pattern (return a font object, or an array of font objects)?

Specifically, this would help with use cases where the label for a given axes is not only multiline, but also visually should show some semblance of hierarchy (e.g., the primary label is size 22 and bolded, while the secondary portion of the label is displayed on the next line in size 12 and normal weight).

To be fair, I have an immediate need, so a push in the right direction on how to appropriately use the plugin architecture to solve this problem would be best suited for my use case (versus the turn-around time of an enhancement to the core project) - but I am also curious if there is a bigger need, possibly leading to inclusion of this feature alongside the existing ability to generate multiline labels.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.