mirror of
https://github.com/apache/superset.git
synced 2024-09-19 20:19:37 -04:00
feat(plugin-chart-echarts): bump to version 5.0 (#852)
merge to test feat: Results table on Explore view #11854
This commit is contained in:
parent
a6d8f57bce
commit
8c4c4ef020
@ -31,9 +31,8 @@ export const WeekdayPie = ({ width, height }) => {
|
|||||||
innerRadius: number('Inner Radius', 30),
|
innerRadius: number('Inner Radius', 30),
|
||||||
outerRadius: number('Outer Radius', 50),
|
outerRadius: number('Outer Radius', 50),
|
||||||
labelsOutside: boolean('Labels outside', true),
|
labelsOutside: boolean('Labels outside', true),
|
||||||
labelLine: boolean('Label line', false),
|
labelLine: boolean('Label line', true),
|
||||||
showLabels: boolean('Show labels', true),
|
showLabels: boolean('Show labels', true),
|
||||||
showLabelsThreshold: number('Percentage threshold', 0),
|
|
||||||
showLegend: boolean('Show legend', false),
|
showLegend: boolean('Show legend', false),
|
||||||
pieLabelType: select(
|
pieLabelType: select(
|
||||||
'Pie label type',
|
'Pie label type',
|
||||||
@ -63,7 +62,6 @@ export const PopulationPie = ({ width, height }) => {
|
|||||||
labelsOutside: boolean('Labels outside', false),
|
labelsOutside: boolean('Labels outside', false),
|
||||||
labelLine: boolean('Label line', false),
|
labelLine: boolean('Label line', false),
|
||||||
showLabels: boolean('Show labels', true),
|
showLabels: boolean('Show labels', true),
|
||||||
showLabelsThreshold: number('Percentage threshold', 5),
|
|
||||||
showLegend: boolean('Show legend', false),
|
showLegend: boolean('Show legend', false),
|
||||||
pieLabelType: select(
|
pieLabelType: select(
|
||||||
'Pie label type',
|
'Pie label type',
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
"@superset-ui/core": "0.15.15",
|
"@superset-ui/core": "0.15.15",
|
||||||
"@types/echarts": "^4.6.3",
|
"@types/echarts": "^4.6.3",
|
||||||
"@types/mathjs": "^6.0.7",
|
"@types/mathjs": "^6.0.7",
|
||||||
"echarts": "^4.9.0",
|
"echarts": "^5.0.0",
|
||||||
"mathjs": "^8.0.1"
|
"mathjs": "^8.0.1"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
|
@ -122,20 +122,6 @@ const config: ControlPanelConfig = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
[
|
|
||||||
{
|
|
||||||
name: 'show_labels_threshold',
|
|
||||||
config: {
|
|
||||||
type: 'TextControl',
|
|
||||||
label: t('Percentage threshold'),
|
|
||||||
renderTrigger: true,
|
|
||||||
isFloat: true,
|
|
||||||
default: 5,
|
|
||||||
description: t('Minimum threshold in percentage points for showing labels.'),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
noopControl,
|
|
||||||
],
|
|
||||||
['color_scheme', noopControl],
|
['color_scheme', noopControl],
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
@ -147,7 +133,7 @@ const config: ControlPanelConfig = {
|
|||||||
min: 10,
|
min: 10,
|
||||||
max: 100,
|
max: 100,
|
||||||
step: 1,
|
step: 1,
|
||||||
default: 50,
|
default: 80,
|
||||||
description: t('Outer edge of Pie chart'),
|
description: t('Outer edge of Pie chart'),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -67,10 +67,9 @@ export default function transformProps(chartProps: ChartProps): EchartsProps {
|
|||||||
labelLine = false,
|
labelLine = false,
|
||||||
metric,
|
metric,
|
||||||
numberFormat,
|
numberFormat,
|
||||||
outerRadius = 50,
|
outerRadius = 80,
|
||||||
pieLabelType = 'value',
|
pieLabelType = 'value',
|
||||||
showLabels = true,
|
showLabels = true,
|
||||||
showLabelsThreshold = 5,
|
|
||||||
showLegend = false,
|
showLegend = false,
|
||||||
} = formData as PieChartFormData;
|
} = formData as PieChartFormData;
|
||||||
const { label: metricLabel } = convertMetric(metric);
|
const { label: metricLabel } = convertMetric(metric);
|
||||||
@ -91,7 +90,6 @@ export default function transformProps(chartProps: ChartProps): EchartsProps {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const formatter = (params: { name: string; value: number; percent: number }) => {
|
const formatter = (params: { name: string; value: number; percent: number }) => {
|
||||||
if (params.percent < showLabelsThreshold) return '';
|
|
||||||
return formatPieLabel({ params, numberFormatter, pieLabelType });
|
return formatPieLabel({ params, numberFormatter, pieLabelType });
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -134,7 +132,7 @@ export default function transformProps(chartProps: ChartProps): EchartsProps {
|
|||||||
radius: [`${donut ? innerRadius : 0}%`, `${outerRadius}%`],
|
radius: [`${donut ? innerRadius : 0}%`, `${outerRadius}%`],
|
||||||
center: ['50%', '50%'],
|
center: ['50%', '50%'],
|
||||||
avoidLabelOverlap: true,
|
avoidLabelOverlap: true,
|
||||||
labelLine: labelLine ? { show: true } : { show: false },
|
labelLine: labelsOutside && labelLine ? { show: true } : { show: false },
|
||||||
label: labelsOutside
|
label: labelsOutside
|
||||||
? {
|
? {
|
||||||
...defaultLabel,
|
...defaultLabel,
|
||||||
|
@ -93,11 +93,10 @@ export function transformSeries(
|
|||||||
areaStyle: {
|
areaStyle: {
|
||||||
opacity: forecastSeries.type === ForecastSeriesEnum.ForecastUpper || area ? opacity : 0,
|
opacity: forecastSeries.type === ForecastSeriesEnum.ForecastUpper || area ? opacity : 0,
|
||||||
},
|
},
|
||||||
symbolSize:
|
showSymbol:
|
||||||
!isConfidenceBand &&
|
!isConfidenceBand &&
|
||||||
(plotType === 'scatter' || (forecastEnabled && isObservation) || markerEnabled)
|
(plotType === 'scatter' || (forecastEnabled && isObservation) || markerEnabled),
|
||||||
? markerSize
|
symbolSize: markerSize,
|
||||||
: 0,
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
import React, { useRef, useEffect } from 'react';
|
import React, { useRef, useEffect } from 'react';
|
||||||
import { styled } from '@superset-ui/core';
|
import { styled } from '@superset-ui/core';
|
||||||
import echarts from 'echarts';
|
import { init } from 'echarts';
|
||||||
import { EchartsProps, EchartsStylesProps } from '../types';
|
import { EchartsProps, EchartsStylesProps } from '../types';
|
||||||
|
|
||||||
const Styles = styled.div<EchartsStylesProps>`
|
const Styles = styled.div<EchartsStylesProps>`
|
||||||
@ -33,7 +33,7 @@ export default function Echart({ width, height, echartOptions }: EchartsProps) {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!divRef.current) return;
|
if (!divRef.current) return;
|
||||||
if (!chartRef.current) {
|
if (!chartRef.current) {
|
||||||
chartRef.current = echarts.init(divRef.current);
|
chartRef.current = init(divRef.current);
|
||||||
}
|
}
|
||||||
chartRef.current.setOption(echartOptions, true);
|
chartRef.current.setOption(echartOptions, true);
|
||||||
}, [echartOptions]);
|
}, [echartOptions]);
|
||||||
|
@ -8953,12 +8953,13 @@ ecc-jsbn@~0.1.1:
|
|||||||
jsbn "~0.1.0"
|
jsbn "~0.1.0"
|
||||||
safer-buffer "^2.1.0"
|
safer-buffer "^2.1.0"
|
||||||
|
|
||||||
echarts@^4.9.0:
|
echarts@^5.0.0:
|
||||||
version "4.9.0"
|
version "5.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/echarts/-/echarts-4.9.0.tgz#a9b9baa03f03a2a731e6340c55befb57a9e1347d"
|
resolved "https://registry.yarnpkg.com/echarts/-/echarts-5.0.0.tgz#66ec0ea47e3c93b2aadfbb2d719869932ad13ce0"
|
||||||
integrity sha512-+ugizgtJ+KmsJyyDPxaw2Br5FqzuBnyOWwcxPKO6y0gc5caYcfnEUIlNStx02necw8jmKmTafmpHhGo4XDtEIA==
|
integrity sha512-6SDcJbLVOcfQyjPg+spNU1+JVrkU1B9fzUa5tpbP/mMNUPyigCOJwcEIQAJSbp9jt5UP3EXvQR0vtYXIo9AjyA==
|
||||||
dependencies:
|
dependencies:
|
||||||
zrender "4.3.2"
|
tslib "1.10.0"
|
||||||
|
zrender "5.0.1"
|
||||||
|
|
||||||
edit-json-file@^1.4.0:
|
edit-json-file@^1.4.0:
|
||||||
version "1.4.0"
|
version "1.4.0"
|
||||||
@ -19201,6 +19202,11 @@ ts-pnp@^1.1.2:
|
|||||||
resolved "https://registry.yarnpkg.com/ts-pnp/-/ts-pnp-1.2.0.tgz#a500ad084b0798f1c3071af391e65912c86bca92"
|
resolved "https://registry.yarnpkg.com/ts-pnp/-/ts-pnp-1.2.0.tgz#a500ad084b0798f1c3071af391e65912c86bca92"
|
||||||
integrity sha512-csd+vJOb/gkzvcCHgTGSChYpy5f1/XKNsmvBGO4JXS+z1v2HobugDz4s1IeFXM3wZB44uczs+eazB5Q/ccdhQw==
|
integrity sha512-csd+vJOb/gkzvcCHgTGSChYpy5f1/XKNsmvBGO4JXS+z1v2HobugDz4s1IeFXM3wZB44uczs+eazB5Q/ccdhQw==
|
||||||
|
|
||||||
|
tslib@1.10.0:
|
||||||
|
version "1.10.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a"
|
||||||
|
integrity sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==
|
||||||
|
|
||||||
tslib@^1.10.0, tslib@^1.8.1, tslib@^1.9.0, tslib@^1.9.3:
|
tslib@^1.10.0, tslib@^1.8.1, tslib@^1.9.0, tslib@^1.9.3:
|
||||||
version "1.11.1"
|
version "1.11.1"
|
||||||
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.11.1.tgz#eb15d128827fbee2841549e171f45ed338ac7e35"
|
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.11.1.tgz#eb15d128827fbee2841549e171f45ed338ac7e35"
|
||||||
@ -20331,7 +20337,9 @@ yosay@^2.0.2:
|
|||||||
taketalk "^1.0.0"
|
taketalk "^1.0.0"
|
||||||
wrap-ansi "^2.0.0"
|
wrap-ansi "^2.0.0"
|
||||||
|
|
||||||
zrender@4.3.2:
|
zrender@5.0.1:
|
||||||
version "4.3.2"
|
version "5.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/zrender/-/zrender-4.3.2.tgz#ec7432f9415c82c73584b6b7b8c47e1b016209c6"
|
resolved "https://registry.yarnpkg.com/zrender/-/zrender-5.0.1.tgz#cc377136a9d00d0a177ca7f65c32aed2901928da"
|
||||||
integrity sha512-bIusJLS8c4DkIcdiK+s13HiQ/zjQQVgpNohtd8d94Y2DnJqgM1yjh/jpDb8DoL6hd7r8Awagw8e3qK/oLaWr3g==
|
integrity sha512-i8FNCKAKfF0EfZFJ6w2p30umBrCyy481/PePFQqPdtNgCl5Hp5z7/dovqb7soEoFkhNvhjJ/J4W9zFALeae6yA==
|
||||||
|
dependencies:
|
||||||
|
tslib "1.10.0"
|
||||||
|
Loading…
Reference in New Issue
Block a user