|
@@ -2,71 +2,92 @@
|
|
<div class="charTheme-setting-option">
|
|
<div class="charTheme-setting-option">
|
|
<ul class="options-wrapper">
|
|
<ul class="options-wrapper">
|
|
<li v-for="key in Object.keys(themeOptions)" :key="key">
|
|
<li v-for="key in Object.keys(themeOptions)" :key="key">
|
|
- <label>{{labelMap.get(key)}}</label>
|
|
|
|
|
|
+ <label class="option-title">{{ key ==='lineOptions'?typeLabelMap[chartType].label:labelMap.get(key)}}</label>
|
|
|
|
|
|
<ul class="option-list">
|
|
<ul class="option-list">
|
|
<!-- 线条设置 -->
|
|
<!-- 线条设置 -->
|
|
<template v-if="key==='lineOptions'">
|
|
<template v-if="key==='lineOptions'">
|
|
<li class="option-item">
|
|
<li class="option-item">
|
|
<label class="el-form-item__label">颜色</label>
|
|
<label class="el-form-item__label">颜色</label>
|
|
- <!-- <el-color-picker
|
|
|
|
|
|
+ <el-color-picker
|
|
v-model="themeOptions[key].colors[themeOptions[key].colorIndex]"
|
|
v-model="themeOptions[key].colors[themeOptions[key].colorIndex]"
|
|
show-alpha
|
|
show-alpha
|
|
:predefine="predefineColors"
|
|
:predefine="predefineColors"
|
|
style="width: 90px"
|
|
style="width: 90px"
|
|
- /> -->
|
|
|
|
|
|
+ @change="changeLineColor"
|
|
|
|
+ />
|
|
</li>
|
|
</li>
|
|
<li class="option-item">
|
|
<li class="option-item">
|
|
<label class="el-form-item__label">顺序</label>
|
|
<label class="el-form-item__label">顺序</label>
|
|
- <!-- <el-select
|
|
|
|
|
|
+ <el-select
|
|
v-model="themeOptions[key].colorIndex"
|
|
v-model="themeOptions[key].colorIndex"
|
|
style="width: 90px"
|
|
style="width: 90px"
|
|
>
|
|
>
|
|
<el-option
|
|
<el-option
|
|
v-for="(item,index) in themeOptions[key].colors"
|
|
v-for="(item,index) in themeOptions[key].colors"
|
|
:key="index"
|
|
:key="index"
|
|
- :label="`第${index+1}根`"
|
|
|
|
|
|
+ :label="`第${index+1}${typeLabelMap[chartType].lineLabel}`"
|
|
:value="index"
|
|
:value="index"
|
|
/>
|
|
/>
|
|
- </el-select> -->
|
|
|
|
- </li>
|
|
|
|
- <li class="option-item">
|
|
|
|
- <label class="el-form-item__label">线型</label>
|
|
|
|
- <el-select
|
|
|
|
- v-model="themeOptions[key].dashStyle"
|
|
|
|
- style="width: 90px"
|
|
|
|
- >
|
|
|
|
- <el-option
|
|
|
|
- v-for="item in lineStylesOpts"
|
|
|
|
- :key="item.value"
|
|
|
|
- :label="item.label"
|
|
|
|
- :value="item.value"
|
|
|
|
- />
|
|
|
|
- </el-select>
|
|
|
|
- </li>
|
|
|
|
- <li class="option-item">
|
|
|
|
- <label class="el-form-item__label">粗细</label>
|
|
|
|
- <el-input
|
|
|
|
- v-model="themeOptions[key].lineWidth"
|
|
|
|
- style="width: 90px"
|
|
|
|
- type="number"
|
|
|
|
- :min="1"
|
|
|
|
- />
|
|
|
|
- </li>
|
|
|
|
- <li class="option-item">
|
|
|
|
- <label class="el-form-item__label">平滑线</label>
|
|
|
|
- <el-select
|
|
|
|
- v-model="themeOptions[key].isSpline"
|
|
|
|
- style="width: 90px"
|
|
|
|
- >
|
|
|
|
- <el-option label="是" :value="1"/>
|
|
|
|
- <el-option label="否" :value="0"/>
|
|
|
|
</el-select>
|
|
</el-select>
|
|
</li>
|
|
</li>
|
|
|
|
+
|
|
|
|
+ <!-- 曲线额外配置 -->
|
|
|
|
+ <template v-if="[1,2].includes(chartType)">
|
|
|
|
+ <li class="option-item">
|
|
|
|
+ <label class="el-form-item__label">线型</label>
|
|
|
|
+ <el-select
|
|
|
|
+ v-model="themeOptions[key].dashStyle"
|
|
|
|
+ style="width: 90px"
|
|
|
|
+ >
|
|
|
|
+ <el-option
|
|
|
|
+ v-for="item in lineStylesOpts"
|
|
|
|
+ :key="item.value"
|
|
|
|
+ :value="item.value"
|
|
|
|
+ :label="item.label"
|
|
|
|
+ >
|
|
|
|
+ <svg width="60" height="10" viewBox="0 0 60 10" fill="none" xmlns="http://www.w3.org/2000/svg" v-html="item.svg">
|
|
|
|
+ </svg>
|
|
|
|
+ </el-option>
|
|
|
|
+ </el-select>
|
|
|
|
+ </li>
|
|
|
|
+ <li class="option-item">
|
|
|
|
+ <label class="el-form-item__label">粗细</label>
|
|
|
|
+ <el-input
|
|
|
|
+ v-model="themeOptions[key].lineWidth"
|
|
|
|
+ style="width: 90px"
|
|
|
|
+ type="number"
|
|
|
|
+ :min="1"
|
|
|
|
+ />
|
|
|
|
+ </li>
|
|
|
|
+ <li class="option-item">
|
|
|
|
+ <label class="el-form-item__label">平滑线</label>
|
|
|
|
+ <el-select
|
|
|
|
+ v-model="themeOptions[key].isSpline"
|
|
|
|
+ style="width: 90px"
|
|
|
|
+ >
|
|
|
|
+ <el-option label="是" :value="1"/>
|
|
|
|
+ <el-option label="否" :value="0"/>
|
|
|
|
+ </el-select>
|
|
|
|
+ </li>
|
|
|
|
+ </template>
|
|
|
|
+
|
|
|
|
+ <!-- 散点额外配置 -->
|
|
|
|
+ <template v-else-if="[4,7].includes(chartType)">
|
|
|
|
+ <li class="option-item">
|
|
|
|
+ <label class="el-form-item__label">大小</label>
|
|
|
|
+ <el-input
|
|
|
|
+ v-model="themeOptions[key].radius"
|
|
|
|
+ style="width: 90px"
|
|
|
|
+ type="number"
|
|
|
|
+ :min="3"
|
|
|
|
+ />
|
|
|
|
+ </li>
|
|
|
|
+ </template>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<!-- 图例设置 -->
|
|
<!-- 图例设置 -->
|
|
- <template v-if="key==='legendOptions'">
|
|
|
|
|
|
+ <template v-else-if="key==='legendOptions'">
|
|
<li class="option-item">
|
|
<li class="option-item">
|
|
<label class="el-form-item__label">颜色</label>
|
|
<label class="el-form-item__label">颜色</label>
|
|
<el-color-picker
|
|
<el-color-picker
|
|
@@ -102,7 +123,7 @@
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<!-- 标题设置 -->
|
|
<!-- 标题设置 -->
|
|
- <template v-if="key==='titleOptions'">
|
|
|
|
|
|
+ <template v-else-if="key==='titleOptions'">
|
|
<li class="option-item">
|
|
<li class="option-item">
|
|
<label class="el-form-item__label">颜色</label>
|
|
<label class="el-form-item__label">颜色</label>
|
|
<el-color-picker
|
|
<el-color-picker
|
|
@@ -137,7 +158,7 @@
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<!-- 标记文字 横轴 纵轴设置 -->
|
|
<!-- 标记文字 横轴 纵轴设置 -->
|
|
- <template v-if="['markerOptions','xAxisOptions','yAxisOptions'].includes(key)">
|
|
|
|
|
|
+ <template v-else-if="['markerOptions','xAxisOptions','yAxisOptions'].includes(key)">
|
|
<li class="option-item">
|
|
<li class="option-item">
|
|
<label class="el-form-item__label">颜色</label>
|
|
<label class="el-form-item__label">颜色</label>
|
|
<el-color-picker
|
|
<el-color-picker
|
|
@@ -159,7 +180,7 @@
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<!-- 绘图区设置 -->
|
|
<!-- 绘图区设置 -->
|
|
- <template v-if="key==='drawOption'">
|
|
|
|
|
|
+ <template v-else-if="key==='drawOption'">
|
|
<li class="option-item">
|
|
<li class="option-item">
|
|
<label class="el-form-item__label">背景色</label>
|
|
<label class="el-form-item__label">背景色</label>
|
|
<el-color-picker
|
|
<el-color-picker
|
|
@@ -177,8 +198,12 @@
|
|
</template>
|
|
</template>
|
|
<script>
|
|
<script>
|
|
import { defaultETAOptions,verticalPositions,predefineColors,lineStylesOpts,alignPositions } from '../common/config'
|
|
import { defaultETAOptions,verticalPositions,predefineColors,lineStylesOpts,alignPositions } from '../common/config'
|
|
-console.log(defaultETAOptions)
|
|
|
|
export default {
|
|
export default {
|
|
|
|
+ props: {
|
|
|
|
+ chartType: {
|
|
|
|
+ type:Number
|
|
|
|
+ }
|
|
|
|
+ },
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
predefineColors,
|
|
predefineColors,
|
|
@@ -186,19 +211,35 @@ export default {
|
|
alignPositions,
|
|
alignPositions,
|
|
/* 可配置options*/
|
|
/* 可配置options*/
|
|
themeOptions: {
|
|
themeOptions: {
|
|
- lineOptions: {
|
|
|
|
- colors: defaultETAOptions.colorsOptions,
|
|
|
|
- dashStyle: defaultETAOptions.lineOptions.dashStyle,
|
|
|
|
- color: defaultETAOptions.colorsOptions[0],
|
|
|
|
- colorIndex:0,
|
|
|
|
- lineWidth: defaultETAOptions.lineOptions.lineWidth,
|
|
|
|
- isSpline: defaultETAOptions.lineOptions.isSpline
|
|
|
|
- },
|
|
|
|
- ...defaultETAOptions
|
|
|
|
|
|
+ lineOptions: {
|
|
|
|
+ dashStyle: defaultETAOptions.lineOptions.dashStyle,
|
|
|
|
+ colors: defaultETAOptions.colorsOptions,
|
|
|
|
+ color: defaultETAOptions.colorsOptions[0],
|
|
|
|
+ colorIndex:0,
|
|
|
|
+ lineWidth: defaultETAOptions.lineOptions.lineWidth,
|
|
|
|
+ isSpline: defaultETAOptions.lineOptions.isSpline,
|
|
|
|
+ radius: defaultETAOptions.lineOptions.radius,
|
|
|
|
+ },
|
|
|
|
+ legendOptions: defaultETAOptions.legendOptions,
|
|
|
|
+ titleOptions: defaultETAOptions.titleOptions,
|
|
|
|
+ markerOptions: defaultETAOptions.markerOptions,
|
|
|
|
+ xAxisOptions: defaultETAOptions.xAxisOptions,
|
|
|
|
+ yAxisOptions: defaultETAOptions.yAxisOptions,
|
|
|
|
+ drawOption: defaultETAOptions.drawOption
|
|
},
|
|
},
|
|
lengendPositions: verticalPositions.filter(_ => _.value!=='middle'),
|
|
lengendPositions: verticalPositions.filter(_ => _.value!=='middle'),
|
|
|
|
+ typeLabelMap: {
|
|
|
|
+ 1: {label:'线条设置',lineLabel: '条'},
|
|
|
|
+ 2: {label:'线条设置',lineLabel: '条'},
|
|
|
|
+ 3: {label:'柱形设置',lineLabel: '根'},
|
|
|
|
+ 4: {label:'散点设置',lineLabel: '系列'},
|
|
|
|
+ 5: {label:'线条、柱形设置',lineLabel: '系列'},
|
|
|
|
+ 6: {label:'柱形设置',lineLabel: '根'},
|
|
|
|
+ 7: {label:'散点设置',lineLabel: '系列'},
|
|
|
|
+ },
|
|
labelMap: new Map([
|
|
labelMap: new Map([
|
|
['lineOptions','线条设置'],
|
|
['lineOptions','线条设置'],
|
|
|
|
+ ['scatterOptions','散点设置'],
|
|
['legendOptions','图例设置'],
|
|
['legendOptions','图例设置'],
|
|
['titleOptions','标题设置'],
|
|
['titleOptions','标题设置'],
|
|
['markerOptions','标记文字设置(来源,标识)'],
|
|
['markerOptions','标记文字设置(来源,标识)'],
|
|
@@ -210,7 +251,6 @@ export default {
|
|
}
|
|
}
|
|
},
|
|
},
|
|
mounted(){
|
|
mounted(){
|
|
-
|
|
|
|
},
|
|
},
|
|
methods:{
|
|
methods:{
|
|
|
|
|
|
@@ -228,6 +268,17 @@ export default {
|
|
margin: 10px 0;
|
|
margin: 10px 0;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ .option-title{
|
|
|
|
+ position: relative;
|
|
|
|
+ &:before {
|
|
|
|
+ content: "*";
|
|
|
|
+ font-size: 18px;
|
|
|
|
+ color: #f00;
|
|
|
|
+ position: absolute;
|
|
|
|
+ left: -10px;
|
|
|
|
+ top: 2px;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
.el-form-item__label {
|
|
.el-form-item__label {
|
|
width: 70px;
|
|
width: 70px;
|
|
text-align: left;
|
|
text-align: left;
|