refactor(chart): 图标颜色优化
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
<!-- 柱状图 -->
|
<!-- 线 + 柱混合图 -->
|
||||||
<template>
|
<template>
|
||||||
<div
|
<div
|
||||||
:id="id"
|
:id="id"
|
||||||
@@ -10,6 +10,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import {nextTick, onActivated, onBeforeUnmount, onDeactivated, onMounted} from "vue";
|
import {nextTick, onActivated, onBeforeUnmount, onDeactivated, onMounted} from "vue";
|
||||||
import {init, EChartsOption} from 'echarts'
|
import {init, EChartsOption} from 'echarts'
|
||||||
|
import * as echarts from 'echarts';
|
||||||
import resize from '@/utils/resize'
|
import resize from '@/utils/resize'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
@@ -47,14 +48,14 @@ function initChart() {
|
|||||||
barChart.setOption({
|
barChart.setOption({
|
||||||
title: {
|
title: {
|
||||||
show: true,
|
show: true,
|
||||||
text: '分公司业绩总览(2021年)',
|
text: '业绩总览(2021年)',
|
||||||
x: 'center',
|
x: 'center',
|
||||||
padding: 15,
|
padding: 15,
|
||||||
textStyle: {
|
textStyle: {
|
||||||
fontSize: 18,
|
fontSize: 18,
|
||||||
fontStyle: 'normal',
|
fontStyle: 'normal',
|
||||||
fontWeight: 'bold',
|
fontWeight: 'bold',
|
||||||
color: '#096b92'
|
color: '#337ecc'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
grid: {
|
grid: {
|
||||||
@@ -113,28 +114,47 @@ function initChart() {
|
|||||||
data: [
|
data: [
|
||||||
8000, 8200, 7000, 6200, 6500, 5500, 4500, 4200, 3800,
|
8000, 8200, 7000, 6200, 6500, 5500, 4500, 4200, 3800,
|
||||||
],
|
],
|
||||||
barWidth: 20
|
barWidth: 20,
|
||||||
|
itemStyle: {
|
||||||
|
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
||||||
|
{ offset: 0, color: '#83bff6' },
|
||||||
|
{ offset: 0.5, color: '#188df0' },
|
||||||
|
{ offset: 1, color: '#188df0' }
|
||||||
|
])
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '毛利润',
|
name: '毛利润',
|
||||||
type: 'bar',
|
type: 'bar',
|
||||||
data: [
|
data: [
|
||||||
6200, 6500, 5500, 4500, 4200, 3800, 4200, 6700, 5213,
|
6700, 6800, 6300, 5213, 4500, 4200, 4200, 3800
|
||||||
],
|
],
|
||||||
barWidth: 20
|
barWidth: 20,
|
||||||
|
itemStyle: {
|
||||||
|
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
||||||
|
{ offset: 0, color: '#25d73c' },
|
||||||
|
{ offset: 0.5, color: '#1bc23d' },
|
||||||
|
{ offset: 1, color: '#179e61' }
|
||||||
|
])
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '收入增长率',
|
name: '收入增长率',
|
||||||
type: 'line',
|
type: 'line',
|
||||||
yAxisIndex: 1,
|
yAxisIndex: 1,
|
||||||
data: [42, 41, 53, 65, 67, 65, 52, 45, 43]
|
data: [65, 67, 65, 53, 47, 45, 43, 42, 41],
|
||||||
|
itemStyle: {
|
||||||
|
color: '#67C23A'
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '利润增长率',
|
name: '利润增长率',
|
||||||
type: 'line',
|
type: 'line',
|
||||||
yAxisIndex: 1,
|
yAxisIndex: 1,
|
||||||
data: [82, 81, 56, 45, 51, 65, 65, 67, 78]
|
data: [80, 81, 78, 67, 65, 60, 56,51, 45 ],
|
||||||
|
itemStyle: {
|
||||||
|
color: '#409EFF'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
} as EChartsOption)
|
} as EChartsOption)
|
||||||
|
|||||||
@@ -11,7 +11,6 @@
|
|||||||
import {nextTick, onActivated, onBeforeUnmount, onDeactivated, onMounted} from "vue";
|
import {nextTick, onActivated, onBeforeUnmount, onDeactivated, onMounted} from "vue";
|
||||||
import {init, EChartsOption} from 'echarts'
|
import {init, EChartsOption} from 'echarts'
|
||||||
import resize from '@/utils/resize'
|
import resize from '@/utils/resize'
|
||||||
import {FunnelChart} from "echarts/charts";
|
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
id: {
|
id: {
|
||||||
@@ -55,7 +54,7 @@ function initChart() {
|
|||||||
fontSize: 18,
|
fontSize: 18,
|
||||||
fontStyle: 'normal',
|
fontStyle: 'normal',
|
||||||
fontWeight: 'bold',
|
fontWeight: 'bold',
|
||||||
color:'#096b92'
|
color:'#337ecc'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
grid: {
|
grid: {
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
import {nextTick, onActivated, onBeforeUnmount, onDeactivated, onMounted} from "vue";
|
import {nextTick, onActivated, onBeforeUnmount, onDeactivated, onMounted} from "vue";
|
||||||
import {init, EChartsOption} from 'echarts'
|
import {init, EChartsOption} from 'echarts'
|
||||||
import resize from "@/utils/resize";
|
import resize from "@/utils/resize";
|
||||||
|
import * as echarts from "echarts";
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
id: {
|
id: {
|
||||||
@@ -54,7 +55,7 @@ function initChart() {
|
|||||||
fontSize: 18,
|
fontSize: 18,
|
||||||
fontStyle: 'normal',
|
fontStyle: 'normal',
|
||||||
fontWeight: 'bold',
|
fontWeight: 'bold',
|
||||||
color:'#096b92'
|
color: '#337ecc'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
grid: {
|
grid: {
|
||||||
@@ -74,13 +75,22 @@ function initChart() {
|
|||||||
center: ['50%', '50%'],
|
center: ['50%', '50%'],
|
||||||
roseType: 'area',
|
roseType: 'area',
|
||||||
itemStyle: {
|
itemStyle: {
|
||||||
borderRadius: 8
|
borderRadius: 6,
|
||||||
|
normal: {
|
||||||
|
color: function (params: any) {
|
||||||
|
//自定义颜色
|
||||||
|
const colorList = [
|
||||||
|
'#409EFF', '#67C23A', '#E6A23C', '#F56C6C'
|
||||||
|
];
|
||||||
|
return colorList[params.dataIndex]
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
data: [
|
data: [
|
||||||
{ value: 26, name: '家用电器' },
|
{value: 26, name: '家用电器'},
|
||||||
{ value: 27, name: '户外运动' },
|
{value: 27, name: '户外运动'},
|
||||||
{ value: 24, name: '汽车用品' },
|
{value: 24, name: '汽车用品'},
|
||||||
{ value: 23, name: '手机数码' }
|
{value: 23, name: '手机数码'}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ function initChart() {
|
|||||||
fontSize: 18,
|
fontSize: 18,
|
||||||
fontStyle: 'normal',
|
fontStyle: 'normal',
|
||||||
fontWeight: 'bold',
|
fontWeight: 'bold',
|
||||||
color:'#096b92'
|
color:'#337ecc'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
grid: {
|
grid: {
|
||||||
@@ -84,6 +84,18 @@ function initChart() {
|
|||||||
{
|
{
|
||||||
name: 'Budget vs spending',
|
name: 'Budget vs spending',
|
||||||
type: 'radar',
|
type: 'radar',
|
||||||
|
itemStyle: {
|
||||||
|
borderRadius: 6,
|
||||||
|
normal: {
|
||||||
|
color: function (params: any) {
|
||||||
|
//自定义颜色
|
||||||
|
const colorList = [
|
||||||
|
'#409EFF', '#67C23A', '#E6A23C', '#F56C6C'
|
||||||
|
];
|
||||||
|
return colorList[params.dataIndex]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
data: [
|
data: [
|
||||||
{
|
{
|
||||||
value: [4200, 10000, 20000, 35000, 50000, 18000],
|
value: [4200, 10000, 20000, 35000, 50000, 18000],
|
||||||
|
|||||||
Reference in New Issue
Block a user