Chart.js icon indicating copy to clipboard operation
Chart.js copied to clipboard

show Dataset label on Chart

Open rkmax opened this issue 12 years ago • 8 comments

When i going to show a line chart or bar chart should have the option to display a label for each dataset.

Example:

new Chart(ctx).Line(data, options);
var options = {
    showDatasetLabels : true
}
var data = {
    labels : ["January","February","March","April","May","June","July"],
    datasets : [
        {
            label: "Salesman A",
            fillColor : "rgba(220,220,220,0.5)",
            strokeColor : "rgba(220,220,220,1)",
            pointColor : "rgba(220,220,220,1)",
            pointStrokeColor : "#fff",
            data : [65,59,90,81,56,55,40]
        },
        {
            label: "Salesman B",
            fillColor : "rgba(151,187,205,0.5)",
            strokeColor : "rgba(151,187,205,1)",
            pointColor : "rgba(151,187,205,1)",
            pointStrokeColor : "#fff",
            data : [28,48,40,19,96,27,100]
        }
    ]
}

rkmax avatar Feb 04 '14 19:02 rkmax

It would be a very nice addition, I'm following this too. Thank you.

haxpor avatar Feb 17 '15 06:02 haxpor

Yeah I need this right now.

fatagun avatar Feb 25 '15 21:02 fatagun

This one line fixes your problem. http://stackoverflow.com/questions/24510278/chart-js-multitooltip-labels

mroien avatar May 11 '15 20:05 mroien

Closing since there is a fix

etimberg avatar Dec 24 '15 21:12 etimberg

The above solution is not correct solution. The ask was for label and the proposed solution is to show in label in tooltip. I have a similar problem, In my case my application is projected on big screen and there is no user interaction on chart to generate tooltip. It would be good if we can show label on lines in the chart

VipinAgarwal avatar Jan 20 '16 09:01 VipinAgarwal

I have the same problem, the proposed fix is for TOOLTIP not VALUE LABELs, we are going to show charts on large screen as dashboard, so there is no mouse to hover, how can I show values on each Bar or Column

RezaRahmati avatar Jun 15 '16 14:06 RezaRahmati

5 years later, I'm looking to solve the same issue!

PhysRex avatar Aug 20 '21 18:08 PhysRex

You can use the datalabels plugin

LeeLenaleee avatar Aug 21 '21 16:08 LeeLenaleee