A
A
Artur Galyaev2021-06-27 14:17:36
JavaScript
Artur Galyaev, 2021-06-27 14:17:36

How to style labels in chart js?

I need to make such a label in the chart:
60d85d8d32a35994692905.png
The problem is that the bottom line should be less than the top one. Through Chart JS, as far as I understand, you can only style the entire label at once.
Then is it possible to write an html tag with a class in the label?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Golub, 2021-06-29
@RazerVG

You can try doing this:

scales: {
            x: {
                ticks: {
                    callback: function(value, index, values) {
                        return `<span>${ value.month }</span> ${ value.year }`;
                    }
                }
            }
        }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question