Skip to content

Commit

Permalink
🐛 (marimekko) do not show lone legend item
Browse files Browse the repository at this point in the history
  • Loading branch information
sophiamersmann committed May 15, 2024
1 parent c67b7b5 commit c238845
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -825,7 +825,7 @@ export class MarimekkoChart
// legend props

@computed get legendPaddingTop(): number {
return this.baseFontSize
return this.legend.height > 0 ? this.baseFontSize : 0
}

@computed get legendX(): number {
Expand Down Expand Up @@ -858,10 +858,11 @@ export class MarimekkoChart

@computed get categoricalLegendData(): CategoricalBin[] {
const { colorColumnSlug, colorScale, series } = this
const customHiddenCategories =
this.colorScaleConfig?.customHiddenCategories
if (colorColumnSlug) return colorScale.categoricalLegendBins
else
if (colorColumnSlug) {
return colorScale.categoricalLegendBins
} else if (series.length > 0) {
const customHiddenCategories =
this.colorScaleConfig?.customHiddenCategories
return series.map((series, index) => {
return new CategoricalBin({
index,
Expand All @@ -871,6 +872,8 @@ export class MarimekkoChart
isHidden: !!customHiddenCategories?.[series.seriesName],
})
})
}
return []
}

@action.bound onLegendMouseOver(bin: ColorScaleBin): void {
Expand Down

0 comments on commit c238845

Please sign in to comment.