Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 (marimekko) do not show lone legend item #3570

Merged
merged 1 commit into from
May 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading