diff --git a/public/images/bg/bg05.png b/public/images/bg/bg05.png new file mode 100644 index 0000000..2af95fe Binary files /dev/null and b/public/images/bg/bg05.png differ diff --git a/src/views/data-analyse/charts/content-footer.ts b/src/views/data-analyse/charts/content-footer.ts new file mode 100644 index 0000000..e3225a4 --- /dev/null +++ b/src/views/data-analyse/charts/content-footer.ts @@ -0,0 +1,132 @@ +import type { Ref } from 'vue'; + +import echarts from '@/plugins/echarts'; +import { debounceChart } from '@/utils/chart'; + +let myChart = null; + +const option = { + grid: { + left: '4%', + right: '4%', + bottom: '19%', + top: '20%', + containLabel: true, + }, + title: { + text: '单位:(万元)', + textStyle: { + color: 'rgba(131, 162, 192, 1)', + fontSize: 12, + }, + top: '4%', + left: '2%', + }, + tooltip: { + trigger: 'axis', + }, + legend: { + data: ['增加值'], + icon: 'rich', + show: true, + itemWidth: 18, + itemHeight: 2, + textStyle: { + color: '#AFBDD1', + fontSize: '12px', + }, + top: 8, + right: 10, + itemGap: 34, + }, + + xAxis: { + data: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], + type: 'category', + boundaryGap: false, + axisLine: { + symbol: 'none', + lineStyle: { + color: '#50637A', + }, + }, + axisTick: { + show: false, + }, + axisLabel: { + interval: 0, + color: '#6071A9', + fontSize: 12, + padding: [10, 0, 0, 0], + }, + }, + yAxis: { + type: 'value', + axisLabel: { + color: '#6071A9', + fontSize: 12, + padding: [0, 10, 0, 0], + }, + splitLine: { + lineStyle: { + color: '#50637A', + type: 'dashed', + }, + }, + }, + series: [ + { + name: '增加值', + data: [1, 2, 3, 4, 7, 6, 7, 8, 4, 10], + type: 'line', + smooth: true, + color: '#00F7FF', + lineStyle: { + width: 2, + }, + areaStyle: { + color: new echarts.graphic.LinearGradient( + 0, + 0, + 0, + 1, + [ + { + offset: 0, + color: 'rgba(0, 247, 255, .6)', + }, + { + offset: 0.8, + color: 'rgba(0, 247, 255, .2)', + }, + ], + false + ), + shadowColor: 'rgba(0, 0, 0, 0.1)', + shadowBlur: 10, + }, + symbol: 'circle', + symbolSize: 6, + }, + ], +}; + +/** 渲染图表 */ +export const renderFooterChart = (element: Ref) => { + myChart = echarts.init(element.value, null, { + renderer: 'canvas', + devicePixelRatio: window.devicePixelRatio, + }); + + debounceChart(myChart); + + myChart.setOption(option); +}; + +/** 更新图表数据 */ +export const updateChart = (option: Array>) => { + const series = myChart.getOption().series; + // series[0].data = option[0]; + // series[1].data = option[1]; + myChart.setOption({ series }); +}; diff --git a/src/views/data-analyse/charts/right-body.ts b/src/views/data-analyse/charts/right-body.ts new file mode 100644 index 0000000..af8ac14 --- /dev/null +++ b/src/views/data-analyse/charts/right-body.ts @@ -0,0 +1,28 @@ +import type { Ref } from 'vue'; + +import echarts from '@/plugins/echarts'; +import { debounceChart } from '@/utils/chart'; + +let myChart = null; + +const option = {}; + +/** 渲染图表 */ +export const renderBodyChart = (element: Ref) => { + myChart = echarts.init(element.value, null, { + renderer: 'canvas', + devicePixelRatio: window.devicePixelRatio, + }); + + debounceChart(myChart); + + myChart.setOption(option); +}; + +/** 更新图表数据 */ +export const updateChart = (option: Array>) => { + const series = myChart.getOption().series; + // series[0].data = option[0]; + // series[1].data = option[1]; + myChart.setOption({ series }); +}; diff --git a/src/views/data-analyse/charts/right-footer.ts b/src/views/data-analyse/charts/right-footer.ts new file mode 100644 index 0000000..89a3ead --- /dev/null +++ b/src/views/data-analyse/charts/right-footer.ts @@ -0,0 +1,36 @@ +import type { Ref } from 'vue'; + +import echarts from '@/plugins/echarts'; +import { debounceChart } from '@/utils/chart'; + +let myChart = null; +const data = [ + { name: '张三', value: 88 }, + { name: '李四', value: 250 }, + { name: '王五', value: 5438 }, + { name: '赵六', value: 8848 }, + { name: '陈七', value: 9527 }, + { name: '朱八', value: 10086 }, +]; + +const option = {}; + +/** 渲染图表 */ +export const renderFooterChart = (element: Ref) => { + myChart = echarts.init(element.value, null, { + renderer: 'canvas', + devicePixelRatio: window.devicePixelRatio, + }); + + debounceChart(myChart); + + myChart.setOption(option); +}; + +/** 更新图表数据 */ +export const updateChart = (option: Array>) => { + const series = myChart.getOption().series; + // series[0].data = option[0]; + // series[1].data = option[1]; + myChart.setOption({ series }); +}; diff --git a/src/views/data-analyse/charts/right-header.ts b/src/views/data-analyse/charts/right-header.ts deleted file mode 100644 index c786568..0000000 --- a/src/views/data-analyse/charts/right-header.ts +++ /dev/null @@ -1,97 +0,0 @@ -import type { Ref } from 'vue'; - -import echarts from '@/plugins/echarts'; -import { debounceChart } from '@/utils/chart'; - -let myChart = null; -const myData = [ - { - value: 137, - name: '数学', - }, - { - value: 103, - name: '语文', - }, - { - value: 124, - name: '英语', - }, - { - value: 180, - name: '理综', - }, -]; - -const option = { - color: ['#1aa3ff', '#04f9fa', '#16bd87', '#c961ff', '#7cfc12'], - tooltip: { - trigger: 'item', - formatter: '{b}:{c} ({d}%)', - }, - legend: { - bottom: '20%', - itemWidth: 10, - itemHeight: 10, - textStyle: { - color: '#fff', - fontSize: '14', - }, - }, - series: [ - // 内圈 - { - type: 'pie', - center: ['50%', '40%'], - radius: ['33.5%', '35.5%'], - silent: true, //取消高亮 - label: { show: false, position: 'center' }, - data: myData, - }, - // 外圈 - { - type: 'pie', - center: ['50%', '40%'], - radius: ['40%', '50%'], - label: { show: false, position: 'center' }, - emphasis: { - label: { - show: true, - fontSize: 33, - lineHeight: 45, - formatter: (params) => { - return '{name|' + params.name + '}\n{value|' + params.value + '}'; - }, - rich: { - name: { - color: '#fff', - }, - value: { - color: '#04F9FA', - }, - }, - }, - }, - data: myData, - }, - ], -}; -/** 渲染图表 */ -export const renderEcharts = (element: Ref) => { - myChart = echarts.init(element.value, null, { - renderer: 'canvas', - devicePixelRatio: window.devicePixelRatio, - }); - - debounceChart(myChart); - - myChart.setOption(option); -}; - -/** 更新图表数据 */ -export const updateChart = (option: Array>) => { - const series = myChart.getOption().series; - // series[0].data = option[0]; - // series[1].data = option[1]; - myChart.setOption({ series }); -}; diff --git a/src/views/data-analyse/components/data-analyse-content/index.vue b/src/views/data-analyse/components/data-analyse-content/index.vue index 0b8df2d..59a4963 100644 --- a/src/views/data-analyse/components/data-analyse-content/index.vue +++ b/src/views/data-analyse/components/data-analyse-content/index.vue @@ -1,5 +1,20 @@ @@ -24,6 +42,10 @@ const titleList = [170582, 586220, 168902]; width: 803px; height: 970px; + h1 { + color: white; + } + &__header { display: flex; justify-content: space-between; @@ -48,14 +70,19 @@ const titleList = [170582, 586220, 168902]; &__body { margin: 14px 0 0 0; - width: 803px; + width: 100%; height: 567px; } &__footer { margin: 6px 0 0 0; - width: 860px; + width: 100%; height: 284px; + + &-chart { + width: 100%; + height: 275px; + } } } diff --git a/src/views/data-analyse/components/data-analyse-right/index.vue b/src/views/data-analyse/components/data-analyse-right/index.vue index 937bdfe..67a85c2 100644 --- a/src/views/data-analyse/components/data-analyse-right/index.vue +++ b/src/views/data-analyse/components/data-analyse-right/index.vue @@ -2,15 +2,22 @@ import { onMounted, ref } from 'vue'; import PanelTitle1 from '@/components/PanelItem/PanelTitle/PanelTitle1.vue'; -import { renderEcharts } from '@/views/data-analyse/charts/right-header'; +import { renderBodyChart } from '@/views/data-analyse/charts/right-body'; +import { renderFooterChart } from '@/views/data-analyse/charts/right-footer'; const footerChartRef = ref(); -const renderFooterChart = () => { - renderEcharts(footerChartRef); +const footerChart = () => { + renderFooterChart(footerChartRef); +}; + +const bodyChartRef = ref(); +const bodyChart = () => { + renderBodyChart(bodyChartRef); }; onMounted(() => { - renderFooterChart(); + bodyChart(); + footerChart(); }); @@ -18,10 +25,12 @@ onMounted(() => {
+
+