From 9c9490e44f13c685617908ecb45b834524aadb95 Mon Sep 17 00:00:00 2001
From: zhj <1784863376@qq.com>
Date: Mon, 12 May 2025 14:27:57 +0800
Subject: [PATCH] =?UTF-8?q?feat:=E5=BF=83=E5=A2=9E=E9=A6=96=E9=A1=B5?=
=?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=A4=A7=E5=B1=8F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/router/index.js | 2 +-
src/views/dashboard/LineAreaChart.vue | 114 ++++++++++++++++++
src/views/dashboard/LineChart.vue | 58 +++-------
src/views/dashboard/OptionBar.vue | 82 +++++++++++++
src/views/dashboard/PieChart.vue | 33 +++---
src/views/dashboard/commonChart.vue | 146 ++++++++++++++++++++++++
src/views/index.vue | 137 +++++++++++++++++++++-
src/views/{index_v1.vue => index_v.vue} | 0
8 files changed, 515 insertions(+), 57 deletions(-)
create mode 100644 src/views/dashboard/LineAreaChart.vue
create mode 100644 src/views/dashboard/OptionBar.vue
create mode 100644 src/views/dashboard/commonChart.vue
rename src/views/{index_v1.vue => index_v.vue} (100%)
diff --git a/src/router/index.js b/src/router/index.js
index 883ea2d..a14773d 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -68,7 +68,7 @@ export const constantRoutes = [
children: [
{
path: 'index',
- component: () => import('@/views/index'),
+ component: () => import('@/views/index.vue'),
name: 'Index',
meta: { title: '首页', icon: 'dashboard', affix: true }
}
diff --git a/src/views/dashboard/LineAreaChart.vue b/src/views/dashboard/LineAreaChart.vue
new file mode 100644
index 0000000..7df20c1
--- /dev/null
+++ b/src/views/dashboard/LineAreaChart.vue
@@ -0,0 +1,114 @@
+
+
+
+
+
diff --git a/src/views/dashboard/LineChart.vue b/src/views/dashboard/LineChart.vue
index 702ff73..aaeb4d7 100644
--- a/src/views/dashboard/LineChart.vue
+++ b/src/views/dashboard/LineChart.vue
@@ -61,18 +61,29 @@ export default {
this.chart = echarts.init(this.$el, 'macarons')
this.setOptions(this.chartData)
},
- setOptions({ expectedData, actualData } = {}) {
+ setOptions(data={}) {
+ let series = []
+ data.data.forEach((item,idx) => {
+ series.push({
+ name: data.legend[idx],
+ smooth: true,
+ type: 'line',
+ data: item,
+ animationDuration: 2800,
+ animationEasing: idx%2 === 0 ? 'cubicInOut': 'quadraticOut'
+ })
+ })
this.chart.setOption({
xAxis: {
- data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
+ data: data.xAxis,
boundaryGap: false,
axisTick: {
show: false
}
},
grid: {
- left: 10,
- right: 10,
+ left: 15,
+ right: 35,
bottom: 20,
top: 30,
containLabel: true
@@ -90,44 +101,9 @@ export default {
}
},
legend: {
- data: ['expected', 'actual']
+ data: data.legend
},
- series: [{
- name: 'expected', itemStyle: {
- normal: {
- color: '#FF005A',
- lineStyle: {
- color: '#FF005A',
- width: 2
- }
- }
- },
- smooth: true,
- type: 'line',
- data: expectedData,
- animationDuration: 2800,
- animationEasing: 'cubicInOut'
- },
- {
- name: 'actual',
- smooth: true,
- type: 'line',
- itemStyle: {
- normal: {
- color: '#3888fa',
- lineStyle: {
- color: '#3888fa',
- width: 2
- },
- areaStyle: {
- color: '#f3f8ff'
- }
- }
- },
- data: actualData,
- animationDuration: 2800,
- animationEasing: 'quadraticOut'
- }]
+ series: series
})
}
}
diff --git a/src/views/dashboard/OptionBar.vue b/src/views/dashboard/OptionBar.vue
new file mode 100644
index 0000000..49c76b3
--- /dev/null
+++ b/src/views/dashboard/OptionBar.vue
@@ -0,0 +1,82 @@
+
+
{b} : {c} ({d}%)'
+ formatter: '{b} : {c} ({d}%)'
},
legend: {
left: 'center',
bottom: '10',
- data: ['Industries', 'Technology', 'Forex', 'Gold', 'Forecasts']
+ data: data.legend
},
series: [
{
- name: 'WEEKLY WRITE ARTICLES',
type: 'pie',
- roseType: 'radius',
radius: [15, 95],
- center: ['50%', '38%'],
- data: [
- { value: 320, name: 'Industries' },
- { value: 240, name: 'Technology' },
- { value: 149, name: 'Forex' },
- { value: 100, name: 'Gold' },
- { value: 59, name: 'Forecasts' }
- ],
+ center: ['50%', '50%'],
+ data: seriesData,
animationEasing: 'cubicInOut',
animationDuration: 2600
}
diff --git a/src/views/dashboard/commonChart.vue b/src/views/dashboard/commonChart.vue
new file mode 100644
index 0000000..d9eff80
--- /dev/null
+++ b/src/views/dashboard/commonChart.vue
@@ -0,0 +1,146 @@
+
+
+
+
+
diff --git a/src/views/index.vue b/src/views/index.vue
index 83b651f..4837ba7 100644
--- a/src/views/index.vue
+++ b/src/views/index.vue
@@ -5,20 +5,149 @@