From 65d5ff19afc09b226ee509beb4270d4497b874ac Mon Sep 17 00:00:00 2001 From: Yamel Senih Date: Mon, 28 Jun 2021 15:52:36 -0400 Subject: [PATCH] Add support to Area chart and Waterfall chart (#946) --- .../ADempiere/Dashboard/charts/AreaChart.vue | 183 ++++++++++++++++++ .../ADempiere/Dashboard/charts/BarChart.vue | 12 ++ .../ADempiere/Dashboard/charts/LineChart.vue | 20 +- .../ADempiere/Dashboard/charts/PieChart.vue | 12 ++ .../Dashboard/charts/RaddarChart.vue | 24 ++- .../Dashboard/charts/WaterfallChart.vue | 155 +++++++++++++++ src/components/ADempiere/Dashboard/index.vue | 4 +- 7 files changed, 395 insertions(+), 15 deletions(-) create mode 100644 src/components/ADempiere/Dashboard/charts/AreaChart.vue create mode 100644 src/components/ADempiere/Dashboard/charts/WaterfallChart.vue diff --git a/src/components/ADempiere/Dashboard/charts/AreaChart.vue b/src/components/ADempiere/Dashboard/charts/AreaChart.vue new file mode 100644 index 00000000..73e13631 --- /dev/null +++ b/src/components/ADempiere/Dashboard/charts/AreaChart.vue @@ -0,0 +1,183 @@ + + + + diff --git a/src/components/ADempiere/Dashboard/charts/BarChart.vue b/src/components/ADempiere/Dashboard/charts/BarChart.vue index fa51674f..37e37759 100644 --- a/src/components/ADempiere/Dashboard/charts/BarChart.vue +++ b/src/components/ADempiere/Dashboard/charts/BarChart.vue @@ -113,6 +113,18 @@ export default { type: 'shadow' // 默认为直线,可选为:'line' | 'shadow' } }, + toolbox: { + // y: 'bottom', + feature: { + magicType: { + type: ['stack', 'tiled'] + }, + dataView: {}, + saveAsImage: { + pixelRatio: 2 + } + } + }, grid: { top: 10, left: '2%', diff --git a/src/components/ADempiere/Dashboard/charts/LineChart.vue b/src/components/ADempiere/Dashboard/charts/LineChart.vue index 3757c42b..6389a63a 100644 --- a/src/components/ADempiere/Dashboard/charts/LineChart.vue +++ b/src/components/ADempiere/Dashboard/charts/LineChart.vue @@ -118,12 +118,8 @@ export default { smooth: true, type: 'line', animationEasing: 'quadraticOut', - itemStyle: { - normal: { - lineStyle: { - width: 2 - } - } + lineStyle: { + width: 2 } } }) @@ -137,6 +133,18 @@ export default { show: false } }, + toolbox: { + // y: 'bottom', + feature: { + magicType: { + type: ['stack', 'tiled'] + }, + dataView: {}, + saveAsImage: { + pixelRatio: 2 + } + } + }, grid: { left: 10, right: 10, diff --git a/src/components/ADempiere/Dashboard/charts/PieChart.vue b/src/components/ADempiere/Dashboard/charts/PieChart.vue index 38f111ca..ec71c625 100644 --- a/src/components/ADempiere/Dashboard/charts/PieChart.vue +++ b/src/components/ADempiere/Dashboard/charts/PieChart.vue @@ -119,6 +119,18 @@ export default { trigger: 'item', formatter: '{a}
{b} : {c} ({d}%)' }, + toolbox: { + // y: 'bottom', + feature: { + magicType: { + type: ['stack', 'tiled'] + }, + dataView: {}, + saveAsImage: { + pixelRatio: 2 + } + } + }, legend: { left: 'center', bottom: '10', diff --git a/src/components/ADempiere/Dashboard/charts/RaddarChart.vue b/src/components/ADempiere/Dashboard/charts/RaddarChart.vue index ea2c17ea..bd5d2ec7 100644 --- a/src/components/ADempiere/Dashboard/charts/RaddarChart.vue +++ b/src/components/ADempiere/Dashboard/charts/RaddarChart.vue @@ -117,6 +117,18 @@ export default { type: 'shadow' // 默认为直线,可选为:'line' | 'shadow' } }, + toolbox: { + // y: 'bottom', + feature: { + magicType: { + type: ['stack', 'tiled'] + }, + dataView: {}, + saveAsImage: { + pixelRatio: 2 + } + } + }, radar: { radius: '66%', center: ['50%', '42%'], @@ -142,13 +154,11 @@ export default { type: 'radar', symbolSize: 0, areaStyle: { - normal: { - shadowBlur: 13, - shadowColor: 'rgba(0,0,0,.2)', - shadowOffsetX: 0, - shadowOffsetY: 10, - opacity: 1 - } + shadowBlur: 13, + shadowColor: 'rgba(0,0,0,.2)', + shadowOffsetX: 0, + shadowOffsetY: 10, + opacity: 1 }, data: seriesToShow, animationDuration: animationDuration diff --git a/src/components/ADempiere/Dashboard/charts/WaterfallChart.vue b/src/components/ADempiere/Dashboard/charts/WaterfallChart.vue new file mode 100644 index 00000000..783adaf9 --- /dev/null +++ b/src/components/ADempiere/Dashboard/charts/WaterfallChart.vue @@ -0,0 +1,155 @@ + + + + diff --git a/src/components/ADempiere/Dashboard/index.vue b/src/components/ADempiere/Dashboard/index.vue index b7fc7df4..dc8e463f 100644 --- a/src/components/ADempiere/Dashboard/index.vue +++ b/src/components/ADempiere/Dashboard/index.vue @@ -87,7 +87,7 @@ export default { break // Area Chart case 'AC': - dashboard = () => import('@/components/ADempiere/Dashboard/charts/RaddarChart') + dashboard = () => import('@/components/ADempiere/Dashboard/charts/AreaChart') break // Line Chart case 'LC': @@ -103,7 +103,7 @@ export default { break // Waterfall Chart case 'WC': - dashboard = () => import('@/components/ADempiere/Dashboard/charts/RaddarChart') + dashboard = () => import('@/components/ADempiere/Dashboard/charts/WaterfallChart') break default: dashboard = () => import('@/components/ADempiere/Dashboard/charts/LineChart')