Skip to content

Commit

Permalink
fix(dashboards): Account for "Releases" as a series when formatting `…
Browse files Browse the repository at this point in the history
…LineChartWidget` legend (#81772)

Account for it when determining whether to show the legend. If one
series is shown, no legend. If one series _and releases_ are shown, show
the legend!
  • Loading branch information
gggritso authored Dec 6, 2024
1 parent 8d87931 commit dfb883d
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,13 @@ export function LineChartWidgetVisualization(props: LineChartWidgetVisualization
})(deDupedParams, asyncTicket);
};

let visibleSeriesCount = props.timeseries.length;
if (releaseSeries) {
visibleSeriesCount += 1;
}

const showLegend = visibleSeriesCount > 1;

return (
<BaseChart
ref={e => {
Expand Down Expand Up @@ -184,13 +191,13 @@ export function LineChartWidgetVisualization(props: LineChartWidgetVisualization
utc={props.utc}
grid={{
left: 0,
top: props.timeseries.length > 1 ? 25 : 10,
top: showLegend ? 25 : 10,
right: 1,
bottom: 0,
containLabel: true,
}}
legend={
props.timeseries.length > 1
showLegend
? {
top: 0,
left: 0,
Expand Down

0 comments on commit dfb883d

Please sign in to comment.