Skip to content

Commit

Permalink
fix chart crash
Browse files Browse the repository at this point in the history
  • Loading branch information
Anush2303 committed Jan 28, 2025
1 parent 1ae2f93 commit 2828658
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ export const DeclarativeChart: React.FunctionComponent<DeclarativeChartProps> =
return <DonutChart {...transformPlotlyJsonToDonutProps(plotlySchema, colorMap, isDarkTheme)} {...commonProps} />;
case 'bar':
const orientation = plotlyInput.data[0].orientation;
if (orientation === 'h') {
if (orientation === 'h' && isNumberArray((plotlyInput.data[0] as PlotData).x)) {
return (
<HorizontalBarChartWithAxis
{...transformPlotlyJsonToHorizontalBarWithAxisProps(plotlySchema, colorMap, isDarkTheme)}
Expand Down Expand Up @@ -245,7 +245,8 @@ export const DeclarativeChart: React.FunctionComponent<DeclarativeChartProps> =
<SankeyChart {...transformPlotlyJsonToSankeyProps(plotlySchema, colorMap, isDarkTheme)} {...commonProps} />
);
case 'indicator':
if (plotlyInput.data?.[0]?.mode?.includes('gauge')) {
case 'gauge':
if (plotlyInput.data?.[0]?.mode?.includes('gauge') || plotlyInput.data?.[0]?.type === 'gauge') {
return (
<GaugeChart {...transformPlotlyJsonToGaugeProps(plotlySchema, colorMap, isDarkTheme)} {...commonProps} />
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1075,7 +1075,9 @@ export type PlotType =
| 'treemap'
| 'violin'
| 'volume'
| 'waterfall';
| 'waterfall'
// adding custom plot types as we get in plotly schemas
| 'gauge';

export type Data = Partial<PlotData> | Partial<PieData> | Partial<SankeyData>;

Expand Down

0 comments on commit 2828658

Please sign in to comment.