Skip to content

Commit

Permalink
fix getPreparedLegend
Browse files Browse the repository at this point in the history
  • Loading branch information
kuzmadom committed Aug 16, 2023
1 parent 2e99ed0 commit a019e1d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/plugins/d3/renderer/hooks/useChartOptions/legend.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import get from 'lodash/get';

import type {ChartKitWidgetData} from '../../../../../types/widget-data';

import type {PreparedLegend} from './types';
Expand All @@ -9,5 +7,9 @@ export const getPreparedLegend = (args: {
series: ChartKitWidgetData['series'];
}): PreparedLegend => {
const {legend, series} = args;
return {enabled: get(legend, 'enabled', true) && series.length > 1};
const enabled = legend?.enabled;

return {
enabled: typeof enabled === 'boolean' ? enabled : series.data.length > 1,
};
};

0 comments on commit a019e1d

Please sign in to comment.