mirror of
https://github.com/apache/superset.git
synced 2026-04-25 19:14:27 +00:00
feat: add Nightingale chart support for echarts pie chart (#28597)
This commit is contained in:
@@ -40,6 +40,7 @@ const {
|
||||
outerRadius,
|
||||
numberFormat,
|
||||
showLabels,
|
||||
roseType,
|
||||
} = DEFAULT_FORM_DATA;
|
||||
|
||||
const config: ControlPanelConfig = {
|
||||
@@ -87,6 +88,23 @@ const config: ControlPanelConfig = {
|
||||
},
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
name: 'roseType',
|
||||
config: {
|
||||
type: 'SelectControl',
|
||||
label: t('Rose Type'),
|
||||
default: roseType,
|
||||
renderTrigger: true,
|
||||
choices: [
|
||||
['area', t('Area')],
|
||||
['radius', t('Radius')],
|
||||
[null, t('None')],
|
||||
],
|
||||
description: t('Whether to show as Nightingale chart.'),
|
||||
},
|
||||
},
|
||||
],
|
||||
...legendSection,
|
||||
// eslint-disable-next-line react/jsx-key
|
||||
[<ControlSubSectionHeader>{t('Labels')}</ControlSubSectionHeader>],
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 50 KiB After Width: | Height: | Size: 31 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 31 KiB |
@@ -74,6 +74,7 @@ export default class EchartsPieChartPlugin extends EchartsChartPlugin<
|
||||
t('Popular'),
|
||||
t('Proportional'),
|
||||
t('ECharts'),
|
||||
t('Nightingale'),
|
||||
],
|
||||
thumbnail,
|
||||
},
|
||||
|
||||
@@ -156,6 +156,7 @@ export default function transformProps(
|
||||
showLabelsThreshold,
|
||||
sliceId,
|
||||
showTotal,
|
||||
roseType,
|
||||
}: EchartsPieFormData = {
|
||||
...DEFAULT_LEGEND_FORM_DATA,
|
||||
...DEFAULT_PIE_FORM_DATA,
|
||||
@@ -283,6 +284,7 @@ export default function transformProps(
|
||||
type: 'pie',
|
||||
...chartPadding,
|
||||
animation: false,
|
||||
roseType: roseType || undefined,
|
||||
radius: [`${donut ? innerRadius : 0}%`, `${outerRadius}%`],
|
||||
center: ['50%', '50%'],
|
||||
avoidLabelOverlap: true,
|
||||
|
||||
@@ -45,6 +45,7 @@ export type EchartsPieFormData = QueryFormData &
|
||||
numberFormat: string;
|
||||
dateFormat: string;
|
||||
showLabelsThreshold: number;
|
||||
roseType: 'radius' | 'area' | null;
|
||||
};
|
||||
|
||||
export enum EchartsPieLabelType {
|
||||
@@ -78,6 +79,7 @@ export const DEFAULT_FORM_DATA: EchartsPieFormData = {
|
||||
labelsOutside: true,
|
||||
showLabelsThreshold: 5,
|
||||
dateFormat: 'smart_date',
|
||||
roseType: null,
|
||||
};
|
||||
|
||||
export type PieChartTransformedProps =
|
||||
|
||||
Reference in New Issue
Block a user