The Open Standard for Generative UI
Fix SideBarToolTip in Condensed chart (#249)
Ankit Das5eeaade17060
diff --git a/js/packages/react-ui/package.json b/js/packages/react-ui/package.jsonindex 777242bc2..f5f80363c 100644--- a/js/packages/react-ui/package.json+++ b/js/packages/react-ui/package.json@@ -2,7 +2,7 @@"type": "module","name": "@crayonai/react-ui","license": "MIT",- "version": "0.9.10",+ "version": "0.9.11","description": "Component library for Generative UI SDK","main": "dist/index.js","types": "dist/index.d.ts",diff --git a/js/packages/react-ui/src/components/Charts/AreaChartCondensed/AreaChartCondensed.tsx b/js/packages/react-ui/src/components/Charts/AreaChartCondensed/AreaChartCondensed.tsxindex ab111981f..b7d95b9bc 100644--- a/js/packages/react-ui/src/components/Charts/AreaChartCondensed/AreaChartCondensed.tsx+++ b/js/packages/react-ui/src/components/Charts/AreaChartCondensed/AreaChartCondensed.tsx@@ -1,5 +1,5 @@import clsx from "clsx";-import React, { useEffect, useMemo, useRef, useState } from "react";+import React, { useCallback, useEffect, useMemo, useRef, useState } from "react";import { Area, AreaChart as RechartsAreaChart, XAxis, YAxis } from "recharts";import { usePrintContext } from "../../../context/PrintContext";import { useId } from "../../../polyfills";@@ -18,6 +18,7 @@ import {cartesianGrid,CustomTooltipContent,DefaultLegend,+ SideBarTooltip,SVGXAxisTick,SVGXAxisTickVariant,YAxisTick,@@ -25,9 +26,19 @@ import {import { LabelTooltipProvider } from "../shared/LabelTooltip/LabelTooltip";import { LegendItem } from "../types";import { getLineType } from "../utils/AreaAndLine/common";-import { get2dChartConfig, getDataKeys, getLegendItems } from "../utils/dataUtils";+import {+ get2dChartConfig,+ getColorForDataKey,+ getDataKeys,+ getLegendItems,+} from "../utils/dataUtils";import { PaletteName, useChartPalette } from "../utils/PalletUtils";+// this a technic to get the type of the onClick event of the area chart+// we need to do this because the onClick event type is not exported by recharts+type AreaChartOnClick = React.ComponentProps<typeof RechartsAreaChart>["onClick"];+type AreaClickData = Parameters<NonNullable<AreaChartOnClick>>[0];+export interface AreaChartCondensedProps<T extends AreaChartData> {data: T;categoryKey: keyof T[number];@@ -135,6 +146,23 @@ const AreaChartCondensedComponent = <T extends AreaChartData>({[showYAxis],);+ const onAreaClick = useCallback(+ (data: AreaClickData) => {+ if (data?.activePayload?.length && data.activePayload.length > 10) {+ setIsSideBarTooltipOpen(true);+ setSideBarTooltipData({+ title: data.activeLabel as string,+ values: data.activePayload.map((payload) => ({+ value: payload.value as number,+ label: payload.name || payload.dataKey,+ color: getColorForDataKey(payload.dataKey, dataKeys, colors),+ })),+ });+ }+ },+ [dataKeys, colors],+ );+const containerRef = useRef<HTMLDivElement>(null);const [containerWidth, setContainerWidth] = useState<number>(0);const [isSideBarTooltipOpen, setIsSideBarTooltipOpen] = useState(false);@@ -275,6 +303,7 @@ const AreaChartCondensedComponent = <T extends AreaChartData>({key={`area-chart-condensed-${id}`}data={data}margin={chartMargin}+ onClick={onAreaClick}>{grid && cartesianGrid()}@@ -342,6 +371,7 @@ const AreaChartCondensedComponent = <T extends AreaChartData>({</RechartsAreaChart></ChartContainer></div>+ {isSideBarTooltipOpen && <SideBarTooltip height={effectiveHeight} />}</div>{xAxisLabel && (<div className="crayon-area-chart-condensed-x-axis-label">{xAxisLabel}</div>diff --git a/js/packages/react-ui/src/components/Charts/AreaChartCondensed/stories/areaChartCondensed.stories.tsx b/js/packages/react-ui/src/components/Charts/AreaChartCondensed/stories/areaChartCondensed.stories.tsxindex e8454d44d..0c8de4929 100644--- a/js/packages/react-ui/src/components/Charts/AreaChartCondensed/stories/areaChartCondensed.stories.tsx+++ b/js/packages/react-ui/src/components/Charts/AreaChartCondensed/stories/areaChartCondensed.stories.tsx@@ -633,6 +633,288 @@ export const DataExplorer: Story = {},};+/**+ * ## Large Dataset with Sidebar Tooltip+ *+ * This story demonstrates the sidebar tooltip feature that appears when you have+ * more than 10 data series. Click on any point in the chart to see the sidebar+ * tooltip in action. This provides a better UX for viewing many data series at once.+ */+export const LargeDatasetWithSidebarTooltip: Story = {+ name: "π― Large Dataset (>10 Series) - Sidebar Tooltip",+ args: {+ data: [+ {+ month: "Jan",+ series1: 120,+ series2: 150,+ series3: 180,+ series4: 200,+ series5: 160,+ series6: 190,+ series7: 220,+ series8: 240,+ series9: 210,+ series10: 230,+ series11: 250,+ series12: 270,+ series13: 260,+ series14: 280,+ series15: 300,+ },+ {+ month: "Feb",+ series1: 140,+ series2: 170,+ series3: 200,+ series4: 220,+ series5: 180,+ series6: 210,+ series7: 240,+ series8: 260,+ series9: 230,+ series10: 250,+ series11: 270,+ series12: 290,+ series13: 280,+ series14: 300,+ series15: 320,+ },+ {+ month: "Mar",+ series1: 160,+ series2: 190,+ series3: 220,+ series4: 240,+ series5: 200,+ series6: 230,+ series7: 260,+ series8: 280,+ series9: 250,+ series10: 270,+ series11: 290,+ series12: 310,+ series13: 300,+ series14: 320,+ series15: 340,+ },+ {+ month: "Apr",+ series1: 180,+ series2: 210,+ series3: 240,+ series4: 260,+ series5: 220,+ series6: 250,+ series7: 280,+ series8: 300,+ series9: 270,+ series10: 290,+ series11: 310,+ series12: 330,+ series13: 320,+ series14: 340,+ series15: 360,+ },+ {+ month: "May",+ series1: 200,+ series2: 230,+ series3: 260,+ series4: 280,+ series5: 240,+ series6: 270,+ series7: 300,+ series8: 320,+ series9: 290,+ series10: 310,+ series11: 330,+ series12: 350,+ series13: 340,+ series14: 360,+ series15: 380,+ },+ {+ month: "Jun",+ series1: 220,+ series2: 250,+ series3: 280,+ series4: 300,+ series5: 260,+ series6: 290,+ series7: 320,+ series8: 340,+ series9: 310,+ series10: 330,+ series11: 350,+ series12: 370,+ series13: 360,+ series14: 380,+ series15: 400,+ },+ {+ month: "Jul",+ series1: 240,+ series2: 270,+ series3: 300,+ series4: 320,+ series5: 280,+ series6: 310,+ series7: 340,+ series8: 360,+ series9: 330,+ series10: 350,+ series11: 370,+ series12: 390,+ series13: 380,+ series14: 400,+ series15: 420,+ },+ {+ month: "Aug",+ series1: 260,+ series2: 290,+ series3: 320,+ series4: 340,+ series5: 300,+ series6: 330,+ series7: 360,+ series8: 380,+ series9: 350,+ series10: 370,+ series11: 390,+ series12: 410,+ series13: 400,+ series14: 420,+ series15: 440,+ },+ {+ month: "Sep",+ series1: 280,+ series2: 310,+ series3: 340,+ series4: 360,+ series5: 320,+ series6: 350,+ series7: 380,+ series8: 400,+ series9: 370,+ series10: 390,+ series11: 410,+ series12: 430,+ series13: 420,+ series14: 440,+ series15: 460,+ },+ {+ month: "Oct",+ series1: 300,+ series2: 330,+ series3: 360,+ series4: 380,+ series5: 340,+ series6: 370,+ series7: 400,+ series8: 420,+ series9: 390,+ series10: 410,+ series11: 430,+ series12: 450,+ series13: 440,+ series14: 460,+ series15: 480,+ },+ {+ month: "Nov",+ series1: 320,+ series2: 350,+ series3: 380,+ series4: 400,+ series5: 360,+ series6: 390,+ series7: 420,+ series8: 440,+ series9: 410,+ series10: 430,+ series11: 450,+ series12: 470,+ series13: 460,+ series14: 480,+ series15: 500,+ },+ {+ month: "Dec",+ series1: 340,+ series2: 370,+ series3: 400,+ series4: 420,+ series5: 380,+ series6: 410,+ series7: 440,+ series8: 460,+ series9: 430,+ series10: 450,+ series11: 470,+ series12: 490,+ series13: 480,+ series14: 500,+ series15: 520,+ },+ ] as any,+ categoryKey: "month" as any,+ theme: "ocean",+ variant: "natural",+ tickVariant: "singleLine",+ grid: true,+ isAnimationActive: false,+ showYAxis: true,+ xAxisLabel: "Months",+ yAxisLabel: "Performance Metrics",+ height: 300,+ },+ render: (args: any) => (+ <div>+ <div+ style={{+ marginBottom: "16px",+ padding: "16px",+ background: "#e3f2fd",+ borderRadius: "8px",+ border: "2px solid #2196f3",+ maxWidth: "700px",+ }}+ >+ <div style={{ fontSize: "14px", marginBottom: "8px" }}>+ <strong>π― Sidebar Tooltip Demo</strong>+ </div>+ <div style={{ fontSize: "13px", color: "#1565c0", lineHeight: "1.6" }}>+ This chart has <strong>15 data series</strong> (more than 10). <br />+ <strong>β¨ Click on any point</strong> in the chart to open the sidebar tooltip on the+ right side.+ <br />+ The sidebar provides a scrollable list of all series values at that point, making it easy+ to view large datasets.+ <br />+ <em>+ π‘ Try hovering first (shows inline tooltip), then click to see the sidebar version!+ </em>+ </div>+ </div>+ <Card style={{ width: "700px" }}>+ <AreaChartCondensed {...args} />+ </Card>+ </div>+ ),+ parameters: {+ docs: {+ description: {+ story:+ "**π― Large Dataset Handling:** When your chart has more than 10 data series, the inline tooltip becomes too crowded. This story demonstrates the sidebar tooltip feature:\n\n**Features:**\n- **15 data series** to showcase the sidebar tooltip\n- **Click interaction:** Click any point to open the sidebar\n- **Scrollable view:** All series values in an organized, scrollable list\n- **Better UX:** Cleaner way to view many data points simultaneously\n- **Color-coded:** Each series maintains its color for easy identification\n\n**Usage:**\n1. Hover over the chart to see the inline tooltip (works for smaller datasets)\n2. Click on any data point to open the sidebar tooltip\n3. Scroll through all 15 series values\n4. Click outside or on the X button to close the sidebar",+ },+ },+ },+};+/*** ## Big Labels*diff --git a/js/packages/react-ui/src/components/Charts/BarChartCondensed/BarChartCondensed.tsx b/js/packages/react-ui/src/components/Charts/BarChartCondensed/BarChartCondensed.tsxindex 1237ac4a8..d8ca9aaf3 100644--- a/js/packages/react-ui/src/components/Charts/BarChartCondensed/BarChartCondensed.tsx+++ b/js/packages/react-ui/src/components/Charts/BarChartCondensed/BarChartCondensed.tsx@@ -19,6 +19,7 @@ import {CustomTooltipContent,DefaultLegend,LineInBarShape,+ SideBarTooltip,SVGXAxisTick,SVGXAxisTickVariant,YAxisTick,@@ -26,9 +27,19 @@ import {import { LabelTooltipProvider } from "../shared/LabelTooltip/LabelTooltip";import { LegendItem } from "../types";import { getBarStackInfo, getRadiusArray } from "../utils/BarCharts/BarChartsUtils";-import { get2dChartConfig, getDataKeys, getLegendItems } from "../utils/dataUtils";+import {+ get2dChartConfig,+ getColorForDataKey,+ getDataKeys,+ getLegendItems,+} from "../utils/dataUtils";import { PaletteName, useChartPalette } from "../utils/PalletUtils";+// this a technic to get the type of the onClick event of the bar chart+// we need to do this because the onClick event type is not exported by recharts+type BarChartOnClick = React.ComponentProps<typeof RechartsBarChart>["onClick"];+type BarClickData = Parameters<NonNullable<BarChartOnClick>>[0];+export interface BarChartCondensedProps<T extends BarChartData> {data: T;categoryKey: keyof T[number];@@ -189,6 +200,23 @@ const BarChartCondensedComponent = <T extends BarChartData>({setHoveredCategory(null);}, []);+ const onBarClick = useCallback(+ (data: BarClickData) => {+ if (data?.activePayload?.length && data.activePayload.length > 10) {+ setIsSideBarTooltipOpen(true);+ setSideBarTooltipData({+ title: data.activeLabel as string,+ values: data.activePayload.map((payload) => ({+ value: payload.value as number,+ label: payload.name || payload.dataKey,+ color: getColorForDataKey(payload.dataKey, dataKeys, colors),+ })),+ });+ }+ },+ [dataKeys, colors],+ );+// Observe container width for legenduseEffect(() => {// Only set up ResizeObserver if width is not provided@@ -379,6 +407,7 @@ const BarChartCondensedComponent = <T extends BarChartData>({barCategoryGap={BAR_CATEGORY_GAP}onMouseMove={handleChartMouseMove}onMouseLeave={handleChartMouseLeave}+ onClick={onBarClick}>{grid && cartesianGrid()}@@ -415,6 +444,7 @@ const BarChartCondensedComponent = <T extends BarChartData>({</RechartsBarChart></ChartContainer></div>+ {isSideBarTooltipOpen && <SideBarTooltip height={effectiveHeight} />}</div>{xAxisLabel && (<div className="crayon-bar-chart-condensed-x-axis-label">{xAxisLabel}</div>diff --git a/js/packages/react-ui/src/components/Charts/BarChartCondensed/stories/barChartCondensed.stories.tsx b/js/packages/react-ui/src/components/Charts/BarChartCondensed/stories/barChartCondensed.stories.tsxindex 8559aecf6..f97ce8d74 100644--- a/js/packages/react-ui/src/components/Charts/BarChartCondensed/stories/barChartCondensed.stories.tsx+++ b/js/packages/react-ui/src/components/Charts/BarChartCondensed/stories/barChartCondensed.stories.tsx@@ -591,6 +591,144 @@ export const DataExplorer: Story = {},};+/**+ * ## Large Dataset with Sidebar Tooltip+ *+ * This story demonstrates the sidebar tooltip feature that appears when you have+ * more than 10 data series. Click on any bar in the chart to see the sidebar+ * tooltip in action. This provides a better UX for viewing many data series at once.+ */+export const LargeDatasetWithSidebarTooltip: Story = {+ name: "π― Large Dataset (>10 Series) - Sidebar Tooltip",+ args: {+ data: [+ {+ quarter: "Q1",+ metric1: 120,+ metric2: 150,+ metric3: 180,+ metric4: 200,+ metric5: 160,+ metric6: 190,+ metric7: 220,+ metric8: 240,+ metric9: 210,+ metric10: 230,+ metric11: 250,+ metric12: 270,+ metric13: 260,+ metric14: 280,+ metric15: 300,+ },+ {+ quarter: "Q2",+ metric1: 140,+ metric2: 170,+ metric3: 200,+ metric4: 220,+ metric5: 180,+ metric6: 210,+ metric7: 240,+ metric8: 260,+ metric9: 230,+ metric10: 250,+ metric11: 270,+ metric12: 290,+ metric13: 280,+ metric14: 300,+ metric15: 320,+ },+ {+ quarter: "Q3",+ metric1: 160,+ metric2: 190,+ metric3: 220,+ metric4: 240,+ metric5: 200,+ metric6: 230,+ metric7: 260,+ metric8: 280,+ metric9: 250,+ metric10: 270,+ metric11: 290,+ metric12: 310,+ metric13: 300,+ metric14: 320,+ metric15: 340,+ },+ {+ quarter: "Q4",+ metric1: 180,+ metric2: 210,+ metric3: 240,+ metric4: 260,+ metric5: 220,+ metric6: 250,+ metric7: 280,+ metric8: 300,+ metric9: 270,+ metric10: 290,+ metric11: 310,+ metric12: 330,+ metric13: 320,+ metric14: 340,+ metric15: 360,+ },+ ] as any,+ categoryKey: "quarter" as any,+ theme: "ocean",+ variant: "grouped",+ tickVariant: "singleLine",+ grid: true,+ isAnimationActive: false,+ showYAxis: true,+ xAxisLabel: "Quarters",+ yAxisLabel: "Performance Metrics",+ height: 300,+ },+ render: (args: any) => (+ <div>+ <div+ style={{+ marginBottom: "16px",+ padding: "16px",+ background: "#e3f2fd",+ borderRadius: "8px",+ border: "2px solid #2196f3",+ maxWidth: "700px",+ }}+ >+ <div style={{ fontSize: "14px", marginBottom: "8px" }}>+ <strong>π― Sidebar Tooltip Demo</strong>+ </div>+ <div style={{ fontSize: "13px", color: "#1565c0", lineHeight: "1.6" }}>+ This chart has <strong>15 data series</strong> (more than 10). <br />+ <strong>β¨ Click on any bar</strong> in the chart to open the sidebar tooltip on the right+ side.+ <br />+ The sidebar provides a scrollable list of all series values at that quarter, making it+ easy to view large datasets.+ <br />+ <em>+ π‘ Try hovering first (shows inline tooltip), then click to see the sidebar version!+ </em>+ </div>+ </div>+ <Card style={{ width: "700px" }}>+ <BarChartCondensed {...args} />+ </Card>+ </div>+ ),+ parameters: {+ docs: {+ description: {+ story:+ "**π― Large Dataset Handling:** When your chart has more than 10 data series, the inline tooltip becomes too crowded. This story demonstrates the sidebar tooltip feature:\n\n**Features:**\n- **15 data series** to showcase the sidebar tooltip\n- **Click interaction:** Click any bar to open the sidebar\n- **Scrollable view:** All series values in an organized, scrollable list\n- **Better UX:** Cleaner way to view many data points simultaneously\n- **Color-coded:** Each series maintains its color for easy identification\n- **Works with both variants:** Try switching between grouped and stacked variants\n\n**Usage:**\n1. Hover over the chart to see the inline tooltip (works for smaller datasets)\n2. Click on any bar to open the sidebar tooltip\n3. Scroll through all 15 series values\n4. Click outside or on the X button to close the sidebar",+ },+ },+ },+};+/*** ## Grouped vs Stacked Comparison*diff --git a/js/packages/react-ui/src/components/Charts/LineChartCondensed/LineChartCondensed.tsx b/js/packages/react-ui/src/components/Charts/LineChartCondensed/LineChartCondensed.tsxindex 88fb02cbf..cb0d31195 100644--- a/js/packages/react-ui/src/components/Charts/LineChartCondensed/LineChartCondensed.tsx+++ b/js/packages/react-ui/src/components/Charts/LineChartCondensed/LineChartCondensed.tsx@@ -1,5 +1,5 @@import clsx from "clsx";-import React, { useEffect, useMemo, useRef, useState } from "react";+import React, { useCallback, useEffect, useMemo, useRef, useState } from "react";import { Line, LineChart as RechartsLineChart, XAxis, YAxis } from "recharts";import { usePrintContext } from "../../../context/PrintContext";import { useId } from "../../../polyfills";@@ -18,6 +18,7 @@ import {cartesianGrid,CustomTooltipContent,DefaultLegend,+ SideBarTooltip,SVGXAxisTick,SVGXAxisTickVariant,YAxisTick,@@ -25,9 +26,19 @@ import {import { LabelTooltipProvider } from "../shared/LabelTooltip/LabelTooltip";import { LegendItem } from "../types";import { getLineType } from "../utils/AreaAndLine/common";-import { get2dChartConfig, getDataKeys, getLegendItems } from "../utils/dataUtils";+import {+ get2dChartConfig,+ getColorForDataKey,+ getDataKeys,+ getLegendItems,+} from "../utils/dataUtils";import { PaletteName, useChartPalette } from "../utils/PalletUtils";+// this a technic to get the type of the onClick event of the line chart+// we need to do this because the onClick event type is not exported by recharts+type LineChartOnClick = React.ComponentProps<typeof RechartsLineChart>["onClick"];+type LineClickData = Parameters<NonNullable<LineChartOnClick>>[0];+export interface LineChartCondensedProps<T extends LineChartData> {data: T;categoryKey: keyof T[number];@@ -135,6 +146,23 @@ const LineChartCondensedComponent = <T extends LineChartData>({[showYAxis],);+ const onLineClick = useCallback(+ (data: LineClickData) => {+ if (data?.activePayload?.length && data.activePayload.length > 10) {+ setIsSideBarTooltipOpen(true);+ setSideBarTooltipData({+ title: data.activeLabel as string,+ values: data.activePayload.map((payload) => ({+ value: payload.value as number,+ label: payload.name || payload.dataKey,+ color: getColorForDataKey(payload.dataKey, dataKeys, colors),+ })),+ });+ }+ },+ [dataKeys, colors],+ );+const containerRef = useRef<HTMLDivElement>(null);const [containerWidth, setContainerWidth] = useState<number>(0);const [isSideBarTooltipOpen, setIsSideBarTooltipOpen] = useState(false);@@ -275,6 +303,7 @@ const LineChartCondensedComponent = <T extends LineChartData>({key={`line-chart-condensed-${id}`}data={data}margin={chartMargin}+ onClick={onLineClick}>{grid && cartesianGrid()}@@ -320,6 +349,7 @@ const LineChartCondensedComponent = <T extends LineChartData>({</RechartsLineChart></ChartContainer></div>+ {isSideBarTooltipOpen && <SideBarTooltip height={effectiveHeight} />}</div>{xAxisLabel && (<div className="crayon-line-chart-condensed-x-axis-label">{xAxisLabel}</div>diff --git a/js/packages/react-ui/src/components/Charts/LineChartCondensed/stories/lineChartCondensed.stories.tsx b/js/packages/react-ui/src/components/Charts/LineChartCondensed/stories/lineChartCondensed.stories.tsxindex 61580c15c..cb637bf8f 100644--- a/js/packages/react-ui/src/components/Charts/LineChartCondensed/stories/lineChartCondensed.stories.tsx+++ b/js/packages/react-ui/src/components/Charts/LineChartCondensed/stories/lineChartCondensed.stories.tsx@@ -644,6 +644,289 @@ export const DataExplorer: Story = {},};+/**+ * ## Large Dataset with Sidebar Tooltip+ *+ * This story demonstrates the sidebar tooltip feature that appears when you have+ * more than 10 data series. Click on any point in the chart to see the sidebar+ * tooltip in action. This provides a better UX for viewing many data series at once.+ */+export const LargeDatasetWithSidebarTooltip: Story = {+ name: "π― Large Dataset (>10 Series) - Sidebar Tooltip",+ args: {+ data: [+ {+ month: "Jan",+ line1: 120,+ line2: 150,+ line3: 180,+ line4: 200,+ line5: 160,+ line6: 190,+ line7: 220,+ line8: 240,+ line9: 210,+ line10: 230,+ line11: 250,+ line12: 270,+ line13: 260,+ line14: 280,+ line15: 300,+ },+ {+ month: "Feb",+ line1: 140,+ line2: 170,+ line3: 200,+ line4: 220,+ line5: 180,+ line6: 210,+ line7: 240,+ line8: 260,+ line9: 230,+ line10: 250,+ line11: 270,+ line12: 290,+ line13: 280,+ line14: 300,+ line15: 320,+ },+ {+ month: "Mar",+ line1: 160,+ line2: 190,+ line3: 220,+ line4: 240,+ line5: 200,+ line6: 230,+ line7: 260,+ line8: 280,+ line9: 250,+ line10: 270,+ line11: 290,+ line12: 310,+ line13: 300,+ line14: 320,+ line15: 340,+ },+ {+ month: "Apr",+ line1: 180,+ line2: 210,+ line3: 240,+ line4: 260,+ line5: 220,+ line6: 250,+ line7: 280,+ line8: 300,+ line9: 270,+ line10: 290,+ line11: 310,+ line12: 330,+ line13: 320,+ line14: 340,+ line15: 360,+ },+ {+ month: "May",+ line1: 200,+ line2: 230,+ line3: 260,+ line4: 280,+ line5: 240,+ line6: 270,+ line7: 300,+ line8: 320,+ line9: 290,+ line10: 310,+ line11: 330,+ line12: 350,+ line13: 340,+ line14: 360,+ line15: 380,+ },+ {+ month: "Jun",+ line1: 220,+ line2: 250,+ line3: 280,+ line4: 300,+ line5: 260,+ line6: 290,+ line7: 320,+ line8: 340,+ line9: 310,+ line10: 330,+ line11: 350,+ line12: 370,+ line13: 360,+ line14: 380,+ line15: 400,+ },+ {+ month: "Jul",+ line1: 240,+ line2: 270,+ line3: 300,+ line4: 320,+ line5: 280,+ line6: 310,+ line7: 340,+ line8: 360,+ line9: 330,+ line10: 350,+ line11: 370,+ line12: 390,+ line13: 380,+ line14: 400,+ line15: 420,+ },+ {+ month: "Aug",+ line1: 260,+ line2: 290,+ line3: 320,+ line4: 340,+ line5: 300,+ line6: 330,+ line7: 360,+ line8: 380,+ line9: 350,+ line10: 370,+ line11: 390,+ line12: 410,+ line13: 400,+ line14: 420,+ line15: 440,+ },+ {+ month: "Sep",+ line1: 280,+ line2: 310,+ line3: 340,+ line4: 360,+ line5: 320,+ line6: 350,+ line7: 380,+ line8: 400,+ line9: 370,+ line10: 390,+ line11: 410,+ line12: 430,+ line13: 420,+ line14: 440,+ line15: 460,+ },+ {+ month: "Oct",+ line1: 300,+ line2: 330,+ line3: 360,+ line4: 380,+ line5: 340,+ line6: 370,+ line7: 400,+ line8: 420,+ line9: 390,+ line10: 410,+ line11: 430,+ line12: 450,+ line13: 440,+ line14: 460,+ line15: 480,+ },+ {+ month: "Nov",+ line1: 320,+ line2: 350,+ line3: 380,+ line4: 400,+ line5: 360,+ line6: 390,+ line7: 420,+ line8: 440,+ line9: 410,+ line10: 430,+ line11: 450,+ line12: 470,+ line13: 460,+ line14: 480,+ line15: 500,+ },+ {+ month: "Dec",+ line1: 340,+ line2: 370,+ line3: 400,+ line4: 420,+ line5: 380,+ line6: 410,+ line7: 440,+ line8: 460,+ line9: 430,+ line10: 450,+ line11: 470,+ line12: 490,+ line13: 480,+ line14: 500,+ line15: 520,+ },+ ] as any,+ categoryKey: "month" as any,+ theme: "ocean",+ variant: "natural",+ tickVariant: "singleLine",+ strokeWidth: 2,+ grid: true,+ isAnimationActive: false,+ showYAxis: true,+ xAxisLabel: "Months",+ yAxisLabel: "Performance Metrics",+ height: 300,+ },+ render: (args: any) => (+ <div>+ <div+ style={{+ marginBottom: "16px",+ padding: "16px",+ background: "#e3f2fd",+ borderRadius: "8px",+ border: "2px solid #2196f3",+ maxWidth: "700px",+ }}+ >+ <div style={{ fontSize: "14px", marginBottom: "8px" }}>+ <strong>π― Sidebar Tooltip Demo</strong>+ </div>+ <div style={{ fontSize: "13px", color: "#1565c0", lineHeight: "1.6" }}>+ This chart has <strong>15 data series</strong> (more than 10). <br />+ <strong>β¨ Click on any point</strong> in the chart to open the sidebar tooltip on the+ right side.+ <br />+ The sidebar provides a scrollable list of all series values at that point, making it easy+ to view large datasets.+ <br />+ <em>+ π‘ Try hovering first (shows inline tooltip), then click to see the sidebar version!+ </em>+ </div>+ </div>+ <Card style={{ width: "700px" }}>+ <LineChartCondensed {...args} />+ </Card>+ </div>+ ),+ parameters: {+ docs: {+ description: {+ story:+ "**π― Large Dataset Handling:** When your chart has more than 10 data series, the inline tooltip becomes too crowded. This story demonstrates the sidebar tooltip feature:\n\n**Features:**\n- **15 data series** to showcase the sidebar tooltip\n- **Click interaction:** Click any point to open the sidebar\n- **Scrollable view:** All series values in an organized, scrollable list\n- **Better UX:** Cleaner way to view many data points simultaneously\n- **Color-coded:** Each series maintains its color for easy identification\n\n**Usage:**\n1. Hover over the chart to see the inline tooltip (works for smaller datasets)\n2. Click on any data point to open the sidebar tooltip\n3. Scroll through all 15 series values\n4. Click outside or on the X button to close the sidebar",+ },+ },+ },+};+/*** ## Big Labels*