Skip to content

Commit

Permalink
fix(line-chart): adds renderTooltipOutside input to allow for renders…
Browse files Browse the repository at this point in the history
… in modal (#2273)
  • Loading branch information
lorenzolevy authored Sep 25, 2024
1 parent 899f082 commit 514350e
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/tasty-dancers-do.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@ebay/ebayui-core": patch
---

fix(line-chart): adds renderTooltipOutside input to allow for renders in modal
3 changes: 2 additions & 1 deletion src/components/ebay-line-chart/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ interface LineChartInput
"cdn-highcharts-accessibility"?: string;
version?: string;
series: SeriesLineOptions | SeriesLineOptions[];
renderTooltipOutside?: boolean;
trend?: "positive" | "negative" | "neutral";
}

Expand Down Expand Up @@ -321,7 +322,7 @@ class LineChart extends Marko.Component<Input> {
backgroundColor: tooltipBackgroundColor, // sets tooltip background color
borderWidth: 0, // hide the default border stroke
borderRadius: 10, // set the border radius of the tooltip
outside: true, // used to render the tooltip outside of the main SVG element
outside: component.input.renderTooltipOutside !== false, // used to render the tooltip outside of the main SVG element
shadow: false, // hide the default shadow as it conflicts with designs
crosshair: {
dashStyle: "Solid", // makes a yaxis cross hair appear over the hovered xAxis data points
Expand Down
1 change: 1 addition & 0 deletions src/components/ebay-line-chart/index.marko
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ $ const {
yAxisLabels,
xAxisPositioner,
yAxisPositioner,
renderTooltipOutside,
trend,
...htmlInput
} = input;
Expand Down
9 changes: 9 additions & 0 deletions src/components/ebay-line-chart/line-chart.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,15 @@ export default {
type: { name: "string", require: false },
description: "Highcharts version to load from CDN",
},
renderTooltipOutside: {
type: { name: "boolean", require: false },
description: "Defaults to `true`, if set to false the tooltip will render inside the chart container. Set to `false` when rendering in a modal.",
table: {
defaultValue: {
summary: "true",
},
},
}
},
};

Expand Down
1 change: 1 addition & 0 deletions src/components/ebay-line-chart/marko-tag.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@
"@xAxisPositioner": "function",
"@yAxisLabels": "array",
"@yAxisPositioner": "function",
"@renderTooltipOutside": "boolean",
"@trend": "boolean"
}

0 comments on commit 514350e

Please sign in to comment.