hackoregon / civic

The frontend monorepo for the CIVIC platform.
http://civicplatform.org
MIT License
60 stars 26 forks source link

Grouped HorizontalBarChart should display legend by default #1224

Open jaronheard opened 4 years ago

jaronheard commented 4 years ago

Is your feature request related to a problem? Please describe. Currently, the HorizontalBarChart with the grouped chart will not display a legend unless it is passed an array of dataSeriesLabels.

Example: The chart shown in this story requires the following dataSeriesLabel in order to display a legend.

Screen Shot 2020-09-13 at 6 45 25 PM
dataSeriesLegend: [
  {
    "category": "Poodle",
    "label": "Poodle"
  },
  {
    "category": "Bulldog",
    "label": "Bulldog"
  }
]

Otherwise, the chart will look like this:

Screen Shot 2020-09-13 at 6 48 27 PM
dataSeriesLegend: null

Describe the solution you'd like Should populate the legend based on the values of dataSeriesKey by default.

Describe alternatives you've considered Could keep as is, but requires extra work from component users.

Additional context The legend component can be overridden with the legendComponent prop, so there's no need to provide an extra override to hide the legend.