javascriptchart.jslabel

Chart.js - Writing Labels Inside of Horizontal Bars?


In Chart.js, is there any way to write the labels inside of the horizontal bars in a "horizontalBar" chart? As in something like:

this graph

Is anything similar to this possible in Chart.js?

Thanks!


Solution

  • There is now on option "mirror" to make the label appear inside the bar.

    Example of "options" config for a horizontalBar chart :

    options: {
        scales: {
            yAxes: [{ticks: {mirror: true}}]
        }
    }
    

    Doc : http://www.chartjs.org/docs/latest/axes/cartesian/#common-configuration