Skip to content

Commit

Permalink
Merge pull request #5376 from rawagner/chart_prop_type
Browse files Browse the repository at this point in the history
Bug 1800769: Define pointerLength prop for multiline charts
  • Loading branch information
openshift-merge-robot committed May 11, 2020
2 parents 9f7e7a3 + 7a882df commit d361d81
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion frontend/public/components/graphs/area.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,18 @@ export const AreaChart: React.FC<AreaChartProps> = ({
[humanize, unit, formatDate],
);

const multiLine = data && data.filter((d) => !!d).length > 1;

const container = (
<ChartVoronoiContainer
voronoiDimension="x"
labels={getLabel}
activateData={false}
labelComponent={
<ChartTooltip centerOffset={data.filter((d) => !!d).length > 1 ? { x: 0, y: -40 } : null} />
<ChartTooltip
centerOffset={multiLine ? { x: 0, y: -40 } : undefined}
pointerLength={multiLine ? 40 : undefined}
/>
}
/>
);
Expand Down

0 comments on commit d361d81

Please sign in to comment.