<template>
<div class="pwgh-card">
<div class="chart" ref="chart"></div>
</div>
</template>
<script>
import {
mapActions, mapState, mapGetters } from 'vuex'
import {
chunk, slice } from 'lodash'
import * as echarts from 'echarts'
export default {
name: 'LinesCard',
props: ['list', 'deptType'],
data() {
return {
}
},
created() {
},
mounted() {
this.initChart()
this.refreshChart()
},
watch: {
list() {
this.initChart()
this.refreshChart()
},
theme() {
this.initChart()
this.refreshChart()
},
},
computed: {
...mapState(['theme']),
},
methods: {
initChart() {
echarts.registerTheme('light', {
color: ['#19D4AE', '#D9D9D9'],
title: {
textStyle: {
color: '#464646',
},
},
legend: {
textStyle: {
color: '#4D4D4D',
},
},
categoryAxis: {
axisLabel: {
show: true,
color: '#4D4D4D',
},
},
valueAxis: {
axisLabel: {
show: true,
color: '#4D4D4D',
},
},
line: {
itemStyle: {
color: '#5AB1EF',
},
areaStyle: {
color: new echarts.graphic.LinearGradient(0, 1, 0, 0, [
{
offset: 0,
color: 'rgba(128, 186, 231, 0)',
},
{
offset: 1,
color: 'rgba(90, 177, 239, 0.76)',
},
]),
},
},
})
echarts.registerTheme('green', {
color: ['#19D4AE', '#D9D9D9'],
title: {
textStyle: {
color: '#fff',
},
},
legend: {
textStyle: {
color: '#fff',
},
},
categoryAxis: {
axisLabel: {
show: true,
color: '#fff',
},
},
valueAxis: {
axisLabel: {
show: true,
color: '#fff',
},
nameTextStyle: {
color: '#fff',
},
},
bar: {
itemStyle: {
// color: 'rgba(118, 201, 85, 1)'
},
label:</
Echarts实现甘特图功能(完整实现代码)
于 2023-12-12 14:18:20 首次发布