Skip to content
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
9 changes: 5 additions & 4 deletions src/StackedBarChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,8 @@ class StackedBarChart extends AbstractChart<
withVerticalLabels = true,
segments = 4,
decimalPlaces,
percentile = false
percentile = false,
hideLegend = false
} = this.props;

const { borderRadius = 0 } = style;
Expand All @@ -209,7 +210,8 @@ class StackedBarChart extends AbstractChart<
border = max;
}

var stackedBar = data.legend && data.legend.length == 0 ? false : true;
const showLegend = !hideLegend && data.legend && data.legend.length != 0;
const stackedBar = showLegend;

return (
<View style={style}>
Expand Down Expand Up @@ -267,8 +269,7 @@ class StackedBarChart extends AbstractChart<
stackedBar
})}
</G>
{data.legend &&
data.legend.length != 0 &&
{showLegend &&
this.renderLegend({
...config,
legend: data.legend,
Expand Down