|
@@ -1,44 +1,203 @@
|
|
|
<template>
|
|
|
- <div>
|
|
|
- <ul class="list in configOptions">
|
|
|
- <li v-for="key in Object.keys(chartCanSetOptions)" :key="key">
|
|
|
+ <div class="charTheme-setting-option">
|
|
|
+ <ul class="options-wrapper">
|
|
|
+ <li v-for="key in Object.keys(themeOptions)" :key="key">
|
|
|
<label>{{labelMap.get(key)}}</label>
|
|
|
|
|
|
- <!-- 图例设置 -->
|
|
|
- <template v-if="key==='legendOptionsSet'">
|
|
|
<ul class="option-list">
|
|
|
- <li class="option-item">
|
|
|
- <label>位置</label>
|
|
|
- <el-select v-model="chartCanSetOptions[key].verticalAlign">
|
|
|
- <el-option
|
|
|
- v-for="item in lengendPositions"
|
|
|
- :key="item.value"
|
|
|
- :label="item.label"
|
|
|
- :value="item.value"
|
|
|
- />
|
|
|
- </el-select>
|
|
|
- </li>
|
|
|
+ <!-- 线条设置 -->
|
|
|
+ <template v-if="key==='lineOptions'">
|
|
|
+ <li class="option-item">
|
|
|
+ <label class="el-form-item__label">颜色</label>
|
|
|
+ <el-color-picker
|
|
|
+ v-model="themeOptions[key].color"
|
|
|
+ show-alpha
|
|
|
+ :predefine="predefineColors"
|
|
|
+ style="width: 90px"
|
|
|
+ />
|
|
|
+ </li>
|
|
|
+ <li class="option-item">
|
|
|
+ <label class="el-form-item__label">顺序</label>
|
|
|
+ <el-select
|
|
|
+ v-model="themeOptions[key].verticalAlign"
|
|
|
+ style="width: 90px"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in lengendPositions"
|
|
|
+ :key="item.value"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value"
|
|
|
+ />
|
|
|
+ </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>
|
|
|
+ </li>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <!-- 图例设置 -->
|
|
|
+ <template v-if="key==='legendOptions'">
|
|
|
+ <li class="option-item">
|
|
|
+ <label class="el-form-item__label">颜色</label>
|
|
|
+ <el-color-picker
|
|
|
+ v-model="themeOptions[key].itemStyle.color"
|
|
|
+ show-alpha
|
|
|
+ :predefine="predefineColors"
|
|
|
+ style="width: 90px"
|
|
|
+ />
|
|
|
+ </li>
|
|
|
+ <li class="option-item">
|
|
|
+ <label class="el-form-item__label">位置</label>
|
|
|
+ <el-select
|
|
|
+ v-model="themeOptions[key].verticalAlign"
|
|
|
+ style="width: 90px"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in lengendPositions"
|
|
|
+ :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].itemStyle.fontSize"
|
|
|
+ style="width: 90px"
|
|
|
+ type="number"
|
|
|
+ :min="1"
|
|
|
+ />
|
|
|
+ </li>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <!-- 标题设置 -->
|
|
|
+ <template v-if="key==='titleOptions'">
|
|
|
+ <li class="option-item">
|
|
|
+ <label class="el-form-item__label">颜色</label>
|
|
|
+ <el-color-picker
|
|
|
+ v-model="themeOptions[key].style.color"
|
|
|
+ show-alpha
|
|
|
+ :predefine="predefineColors"
|
|
|
+ style="width: 90px"
|
|
|
+ />
|
|
|
+ </li>
|
|
|
+ <li class="option-item">
|
|
|
+ <label class="el-form-item__label">字号</label>
|
|
|
+ <el-input
|
|
|
+ v-model="themeOptions[key].style.fontSize"
|
|
|
+ style="width: 90px"
|
|
|
+ type="number"
|
|
|
+ :min="1"
|
|
|
+ />
|
|
|
+ </li>
|
|
|
+ <li class="option-item">
|
|
|
+ <label class="el-form-item__label">对齐方式</label>
|
|
|
+ <!-- <el-input
|
|
|
+ v-model="themeOptions[key].itemStyle.fontSize"
|
|
|
+ style="width: 90px"
|
|
|
+ type="number"
|
|
|
+ :min="1"
|
|
|
+ /> -->
|
|
|
+ </li>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <!-- 标记文字 横轴 纵轴设置 -->
|
|
|
+ <template v-if="['markerOptions','xAxisOptions','yAxisOptions'].includes(key)">
|
|
|
+ <li class="option-item">
|
|
|
+ <label class="el-form-item__label">颜色</label>
|
|
|
+ <el-color-picker
|
|
|
+ v-model="themeOptions[key].labels.style.color"
|
|
|
+ show-alpha
|
|
|
+ :predefine="predefineColors"
|
|
|
+ style="width: 90px"
|
|
|
+ />
|
|
|
+ </li>
|
|
|
+ <li class="option-item">
|
|
|
+ <label class="el-form-item__label">字号</label>
|
|
|
+ <el-input
|
|
|
+ v-model="themeOptions[key].labels.style.fontSize"
|
|
|
+ style="width: 90px"
|
|
|
+ type="number"
|
|
|
+ :min="1"
|
|
|
+ />
|
|
|
+ </li>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <!-- 绘图区设置 -->
|
|
|
+ <template v-if="key==='drawOption'">
|
|
|
+ <li class="option-item">
|
|
|
+ <label class="el-form-item__label">背景色</label>
|
|
|
+ <el-color-picker
|
|
|
+ v-model="themeOptions[key].backgroundColor"
|
|
|
+ show-alpha
|
|
|
+ :predefine="predefineColors"
|
|
|
+ style="width: 90px"
|
|
|
+ />
|
|
|
+ </li>
|
|
|
+ </template>
|
|
|
</ul>
|
|
|
- </template>
|
|
|
</li>
|
|
|
</ul>
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
-import { chartCanSetOptions,verticalPositions } from '../common/config'
|
|
|
+import { defaultETAOptions,verticalPositions,predefineColors,lineStylesOpts } from '../common/config'
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
- chartCanSetOptions,
|
|
|
+ predefineColors,
|
|
|
+ lineStylesOpts,
|
|
|
+ /* 可配置options*/
|
|
|
+ themeOptions: {
|
|
|
+ lineOptions: {
|
|
|
+ colors: defaultETAOptions.colorsOptions,
|
|
|
+ dashStyle: defaultETAOptions.lineOptions.dashStyle,
|
|
|
+ color: '',
|
|
|
+ lineWidth: defaultETAOptions.lineOptions.lineWidth,
|
|
|
+ isSpline: defaultETAOptions.lineOptions.isSpline
|
|
|
+ },
|
|
|
+ ...defaultETAOptions
|
|
|
+ },
|
|
|
lengendPositions: verticalPositions.filter(_ => _.value!=='middle'),
|
|
|
labelMap: new Map([
|
|
|
- ['lineOptionsSet','线条设置'],
|
|
|
- ['legendOptionsSet','图例设置'],
|
|
|
- ['titleOptionsSet','标题设置'],
|
|
|
- ['markerOptionsSet','标记文字设置(来源,标识)'],
|
|
|
- ['xAxisOptionsSet','横轴设置'],
|
|
|
- ['yAxisOptionsSet','纵轴设置'],
|
|
|
- ['drawOptionSet','绘图区设置'],
|
|
|
+ ['lineOptions','线条设置'],
|
|
|
+ ['legendOptions','图例设置'],
|
|
|
+ ['titleOptions','标题设置'],
|
|
|
+ ['markerOptions','标记文字设置(来源,标识)'],
|
|
|
+ ['xAxisOptions','横轴设置'],
|
|
|
+ ['yAxisOptions','纵轴设置'],
|
|
|
+ ['drawOption','绘图区设置'],
|
|
|
]),
|
|
|
configOptions: []
|
|
|
}
|
|
@@ -52,5 +211,26 @@ export default {
|
|
|
}
|
|
|
</script>
|
|
|
<style scoped lang='scss'>
|
|
|
+.options-wrapper {
|
|
|
+ display: flex;
|
|
|
+ flex-wrap: wrap;
|
|
|
+ gap: 40px;
|
|
|
+ .option-list {
|
|
|
+ margin-top: 20px;
|
|
|
+ .option-item {
|
|
|
+ margin: 10px 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .el-form-item__label {
|
|
|
+ width: 80px;
|
|
|
+ text-align: left;
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|
|
|
|
|
|
+<style lang="scss">
|
|
|
+ .charTheme-setting-option {
|
|
|
+ .el-color-picker__trigger { width: 100%;padding: 0;border-radius: 4px; }
|
|
|
+
|
|
|
+ }
|
|
|
</style>
|