Skip to content

Commit 49d0320

Browse files
committed
Removed legacy/deprecated charts
1 parent 9b3f369 commit 49d0320

File tree

3 files changed

+4
-214
lines changed

3 files changed

+4
-214
lines changed

apps/webapp/app/components/primitives/charts/ChartBar.tsx

Lines changed: 0 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,6 @@ export type ChartBarRendererProps = {
4848
referenceLine?: ReferenceLineProps;
4949
/** Custom tooltip label formatter */
5050
tooltipLabelFormatter?: (label: string, payload: any[]) => string;
51-
/** @deprecated Legend is now controlled via Chart.Root showLegend prop */
52-
showLegend?: boolean;
53-
/** @deprecated Legend is now controlled via Chart.Root maxLegendItems prop */
54-
maxLegendItems?: number;
55-
/** @deprecated No longer used */
56-
simpleLegend?: boolean;
5751
/** Width injected by ResponsiveContainer */
5852
width?: number;
5953
/** Height injected by ResponsiveContainer */
@@ -78,10 +72,6 @@ export function ChartBarRenderer({
7872
yAxisProps: yAxisPropsProp,
7973
referenceLine,
8074
tooltipLabelFormatter,
81-
// Deprecated: legend is now controlled via Chart.Root
82-
showLegend: _showLegend,
83-
maxLegendItems: _maxLegendItems,
84-
simpleLegend: _simpleLegend,
8575
width,
8676
height,
8777
}: ChartBarRendererProps) {
@@ -291,8 +281,6 @@ type LegacyChartBarProps = {
291281
state?: ChartState;
292282
maxLegendItems?: number;
293283
referenceLine?: ReferenceLineProps;
294-
/** @deprecated Use onZoomChange callback instead */
295-
useGlobalDateRange?: boolean;
296284
minHeight?: string;
297285
stackId?: string;
298286
/** Series keys to render (if not provided, derived from config keys) */
@@ -315,62 +303,3 @@ type LegacyChartBarProps = {
315303
className?: string;
316304
};
317305

318-
/**
319-
* Legacy ChartBar component for backward compatibility.
320-
* Uses the new compound component system internally.
321-
*
322-
* For new code, prefer the compound component API:
323-
* ```tsx
324-
* <Chart.Root config={config} data={data} dataKey="day" enableZoom onZoomChange={handleZoom}>
325-
* <Chart.Bar stackId="a" />
326-
* <Chart.Legend />
327-
* </Chart.Root>
328-
* ```
329-
*/
330-
export function ChartBar({
331-
config,
332-
data,
333-
dataKey,
334-
state,
335-
maxLegendItems = 5,
336-
referenceLine,
337-
useGlobalDateRange = false,
338-
minHeight,
339-
stackId,
340-
series,
341-
xAxisProps,
342-
yAxisProps,
343-
showLegend = true,
344-
enableZoom = true,
345-
onZoomChange,
346-
tooltipLabelFormatter,
347-
simpleLegend = false,
348-
className,
349-
}: LegacyChartBarProps) {
350-
// Note: useGlobalDateRange is deprecated - the new compound system uses
351-
// DateRangeContext integration via the syncWithDateRange prop on Chart.Zoom
352-
353-
return (
354-
<ChartRoot
355-
config={config}
356-
data={data}
357-
dataKey={dataKey}
358-
series={series}
359-
state={state}
360-
enableZoom={enableZoom}
361-
onZoomChange={onZoomChange}
362-
minHeight={minHeight}
363-
className={className}
364-
showLegend={showLegend}
365-
maxLegendItems={maxLegendItems}
366-
>
367-
<ChartBarRenderer
368-
stackId={stackId}
369-
xAxisProps={xAxisProps}
370-
yAxisProps={yAxisProps}
371-
referenceLine={referenceLine}
372-
tooltipLabelFormatter={tooltipLabelFormatter}
373-
/>
374-
</ChartRoot>
375-
);
376-
}

apps/webapp/app/components/primitives/charts/ChartLine.tsx

Lines changed: 0 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@ export type ChartLineRendererProps = {
5151
stacked?: boolean;
5252
/** Custom tooltip label formatter */
5353
tooltipLabelFormatter?: (label: string, payload: any[]) => string;
54-
/** @deprecated Legend is now controlled via Chart.Root showLegend prop */
55-
showLegend?: boolean;
5654
/** Width injected by ResponsiveContainer */
5755
width?: number;
5856
/** Height injected by ResponsiveContainer */
@@ -77,8 +75,6 @@ export function ChartLineRenderer({
7775
yAxisProps: yAxisPropsProp,
7876
stacked = false,
7977
tooltipLabelFormatter,
80-
// Deprecated: legend is now controlled via Chart.Root
81-
showLegend: _showLegend,
8278
width,
8379
height,
8480
}: ChartLineRendererProps) {
@@ -227,91 +223,3 @@ export function ChartLineRenderer({
227223
</LineChart>
228224
);
229225
}
230-
231-
// ============================================================================
232-
// LEGACY API (for backward compatibility)
233-
// ============================================================================
234-
235-
type LegacyChartLineProps = {
236-
config: ChartConfig;
237-
data: any[];
238-
dataKey: string;
239-
state?: ChartState;
240-
/** @deprecated Use onZoomChange callback instead */
241-
useGlobalDateRange?: boolean;
242-
lineType?: CurveType;
243-
/** Series keys to render (if not provided, derived from config keys) */
244-
series?: string[];
245-
/** Custom X-axis props to merge with defaults */
246-
xAxisProps?: Partial<XAxisProps>;
247-
/** Custom Y-axis props to merge with defaults */
248-
yAxisProps?: Partial<YAxisProps>;
249-
/** Render as stacked area chart instead of line chart */
250-
stacked?: boolean;
251-
/** Custom tooltip label formatter */
252-
tooltipLabelFormatter?: (label: string, payload: any[]) => string;
253-
/** Show legend (default false) */
254-
showLegend?: boolean;
255-
/** Enable zoom selection (default false for line charts) */
256-
enableZoom?: boolean;
257-
/** Callback when zoom range changes */
258-
onZoomChange?: (range: ZoomRange) => void;
259-
/** Additional className for the container */
260-
className?: string;
261-
/** Minimum height for the chart */
262-
minHeight?: string;
263-
};
264-
265-
/**
266-
* Legacy ChartLine component for backward compatibility.
267-
* Uses the new compound component system internally.
268-
*
269-
* For new code, prefer the compound component API:
270-
* ```tsx
271-
* <Chart.Root config={config} data={data} dataKey="day">
272-
* <Chart.Line type="step" />
273-
* <Chart.Legend simple />
274-
* </Chart.Root>
275-
* ```
276-
*/
277-
export function ChartLine({
278-
config,
279-
data,
280-
dataKey,
281-
state,
282-
useGlobalDateRange = false,
283-
lineType = "step",
284-
series,
285-
xAxisProps,
286-
yAxisProps,
287-
stacked = false,
288-
tooltipLabelFormatter,
289-
showLegend = false,
290-
enableZoom = false,
291-
onZoomChange,
292-
className,
293-
minHeight,
294-
}: LegacyChartLineProps) {
295-
return (
296-
<ChartRoot
297-
config={config}
298-
data={data}
299-
dataKey={dataKey}
300-
series={series}
301-
state={state}
302-
enableZoom={enableZoom}
303-
onZoomChange={onZoomChange}
304-
minHeight={minHeight}
305-
className={className}
306-
showLegend={showLegend}
307-
>
308-
<ChartLineRenderer
309-
lineType={lineType}
310-
xAxisProps={xAxisProps}
311-
yAxisProps={yAxisProps}
312-
stacked={stacked}
313-
tooltipLabelFormatter={tooltipLabelFormatter}
314-
/>
315-
</ChartRoot>
316-
);
317-
}

apps/webapp/app/routes/storybook.charts/route.tsx

Lines changed: 4 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,21 @@
11
import { ArrowTrendingUpIcon } from "@heroicons/react/20/solid";
22
import { IconTimeline } from "@tabler/icons-react";
33
import { useMemo, useState } from "react";
4-
import { AbacusIcon } from "~/assets/icons/AbacusIcon";
5-
import { ArrowTopRightBottomLeftIcon } from "~/assets/icons/ArrowTopRightBottomLeftIcon";
64
import { Button } from "~/components/primitives/Buttons";
75
import { BigNumber } from "~/components/primitives/charts/BigNumber";
86
import { Card } from "~/components/primitives/charts/Card";
9-
import { type ChartState, type ChartConfig } from "~/components/primitives/charts/Chart";
10-
import { ChartBar } from "~/components/primitives/charts/ChartBar";
11-
import { ChartLine } from "~/components/primitives/charts/ChartLine";
7+
import { type ChartConfig, type ChartState } from "~/components/primitives/charts/Chart";
128
import { Chart } from "~/components/primitives/charts/ChartCompound";
139
import {
1410
DateRangeProvider,
15-
useDateRange,
1611
formatISODate,
1712
formatISODateLong,
13+
useDateRange,
1814
} from "~/components/primitives/charts/DateRangeContext";
15+
import type { ZoomRange } from "~/components/primitives/charts/hooks/useZoomSelection";
1916
import { Paragraph } from "~/components/primitives/Paragraph";
2017
import { RadioGroup, RadioGroupItem } from "~/components/primitives/RadioButton";
2118
import SegmentedControl from "~/components/primitives/SegmentedControl";
22-
import type { ZoomRange } from "~/components/primitives/charts/hooks/useZoomSelection";
2319

2420
// Date formatters for chart display
2521
const xAxisTickFormatter = (value: string) => formatISODate(value);
@@ -172,50 +168,7 @@ function ChartsDashboard() {
172168
</Card.Content>
173169
</Card>
174170

175-
{/* Legacy API Example (still works) */}
176-
<Card>
177-
<Card.Header>
178-
<div className="flex items-center gap-1.5">
179-
<AbacusIcon className="size-5 text-indigo-500" />
180-
Legacy API <span className="font-normal text-text-dimmed">by status</span>
181-
</div>
182-
<Card.Accessory>
183-
<SegmentedControl
184-
name="runCountByStatus"
185-
options={[
186-
{ label: "By status", value: "status" },
187-
{ label: "By task", value: "task" },
188-
]}
189-
defaultValue="status"
190-
variant="secondary/small"
191-
/>
192-
<Button
193-
variant="secondary/small"
194-
TrailingIcon={<ArrowTopRightBottomLeftIcon className="size-4" />}
195-
className="px-1"
196-
/>
197-
</Card.Accessory>
198-
</Card.Header>
199-
<Card.Content>
200-
<ChartBar
201-
config={barChartConfig}
202-
data={filteredBarData2}
203-
dataKey="day"
204-
stackId="a"
205-
enableZoom
206-
onZoomChange={handleZoomChange}
207-
referenceLine={{
208-
value: 30000,
209-
label: "Max concurrency",
210-
}}
211-
state={chartState === "loaded" ? undefined : chartState}
212-
minHeight="400px"
213-
xAxisProps={{ tickFormatter: xAxisTickFormatter }}
214-
tooltipLabelFormatter={tooltipLabelFormatter}
215-
/>
216-
</Card.Content>
217-
</Card>
218-
171+
219172
{/* Simple Line Chart (no zoom, but synced with date range) */}
220173
<Card>
221174
<Card.Header>

0 commit comments

Comments
 (0)