React-chartjs-2: Disable legends shown since last update

Created on 18 Jul 2017  路  10Comments  路  Source: reactchartjs/react-chartjs-2

Since I updated the package to it's last version, legends are shown even if they are disabled

react-chartjs-2 version : 2.5.1
chartjs options :

{
    cutoutPercentage: 80,
    maintainAspectRatio: false,
    legend: {
        display: false
    },
    animation: {
        animateRotate: false
    }
}

I rolled back to 2.4.0 and everything is fine

Most helpful comment

Oops. There's was an accidental breaking change on:

https://github.com/jerairrest/react-chartjs-2/blob/master/src/index.js#L253

If you pass your legend in as props to the chart component that should resolve your issue.

Sorry!

All 10 comments

Hmmm... we did add a legend props in for custom legends. Let me investigate

Oops. There's was an accidental breaking change on:

https://github.com/jerairrest/react-chartjs-2/blob/master/src/index.js#L253

If you pass your legend in as props to the chart component that should resolve your issue.

Sorry!

Alright, it worked!
I just passed my options.legend in props to the component.

Thank you !

I know this thread is closed but I was just wondering, are you going to fix this problem? The passing of legend as prop to the chart works, but I think it would be better if you could pass it as options like before.

@emmiz This is an easy fix I'll revert this shortly.

@emmiz Hmmm... not that I look at how the default props are for this package it almost makes more sense to be separate in a way. I'm really torn on this one. :/

@jerairrest I understand your concern, but since the module is built upon chart.js that pass the legend as an option to the chart, I think it would be wise to follow the same approach.

As @emmiz, I think you should keep it in option, also because it鈥檚 a breaking change that doesn鈥檛 change any internal behaviour

I just released 2.5.3 that should give the ability to use either prop. https://github.com/jerairrest/react-chartjs-2/releases/tag/2.5.3

Thanks again guys for pointing this out!

Super 馃槃 馃憤 Thx @jerairrest

Was this page helpful?
0 / 5 - 0 ratings