question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Legend display configuration is ignored in v2.5.1

See original GitHub issue

I believe that due to #158, legend display configuration is ignored in charts. I am working on a single page application and after navigating from the route where I have a line chart set to not display the legend to another route and then back, the legend is rendered. This behavior was not present in v2.4.1. In addition, the global defaults.legend.display setting is completely ignored.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:12

github_iconTop GitHub Comments

4reactions
jerairrestcommented, Jul 20, 2017

Hey all I just release 2.5.3 which adds the ability to either use legend configurations through options or the legend prop. Your choice!

https://github.com/jerairrest/react-chartjs-2/releases/tag/2.5.3

1reaction
madcodacommented, Jul 20, 2017

I was just about to bang my head to the wall, luckily I found this post. As a quick fix, just pass the legend as prop again like this legend={chartOptions.legend}, then you can still write all your options in one place.

<Line 
  data={chartData} 
  options={chartOptions} 
  legend={chartOptions.legend}
  width={300} 
  height={200} />

If ultimately need to favour the props way, one suggestion is that, you can add a little console output to remind people to use the “legend” prop. Like how React handle moving “PropTypes” to separate npm package.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Legends - Vega & Vega-Lite
Property Type Description fill String The name of a scale that maps to a fill color. opacity String The name of a scale that maps...
Read more >
Changelog - Apache ECharts
Data transform is a new set of configurations and APIs to enable data ... Add invisible and ignore to enable show and hide...
Read more >
Configure Grafana | Grafana documentation
Set to true to attempt login with OAuth automatically, skipping the login screen. This setting is ignored if multiple OAuth providers are configured....
Read more >
Advanced Settings | Kibana Guide [8.5] - Elastic
This setting must contain from and to values (see accepted formats). It is ignored unless ml:anomalyDetection:results:enableTimeDefaults is enabled.
Read more >
How to disable chartjs legendclick - javascript - Stack Overflow
According to the docs there is a onClick handler for the legend exposing the event object. If you stopPropagation it stops the data...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found