原图:
原echarts代码
修改后效果如下:
html代码如下:
<div
ref="radarChart"
:style="{ width: width + 'px', height: height + 'px' }"
class="chart-panelBar"
></div>
使用了typescript代码如下:
<script lang="ts">
import {
useStore } from 'vuex'
import {
StateType as BigStoreType } from '../store'
import {
defineComponent,
ref,
onMounted,
computed,
watch,
onBeforeUnmount,
reactive,
} from 'vue'
import {
BIG_SCREEN_STORE } from '../constant'
import {
color, EChartsOption, format, graphic, number } from 'echarts'
import useEcharts from '@/composables/useEcharts'
export default defineComponent({
props: {
cityCode: {
type: String,
default: () => '',
},
width: {
type: Number,
default: 300,
},
height: {
type: Number,
// default: 200,
default: 200,
},
},
setup(props) {
/**
* 从store中拿取数据,使用store
*/
const bigStoreStore = useStore<{
BigScreen: BigStoreType }>()
const currentIndustryType = ref<number>(0)
/**
* echarts中需要的颜色,可自行配置
*/
// const color = ['#FECC2A', '#00F508', '#00F5DC']
const color = ['#0F9BEC', '#FFB301', '#00F5DC']
/**
* 创建一个响应式的变量用来存当前的要改变的echarts的下标
*/
const currentIndex = ref<number>(0)
const updatelineData = () => {
const inSialtyBar = bigStoreStore.state.BigScreen