提交 555de253 authored 作者: junjun's avatar junjun

feat: 轴值格式化

上级 e51b0d76
...@@ -88,6 +88,32 @@ ...@@ -88,6 +88,32 @@
<el-option v-for="option in fontSize" :key="option.value" :label="option.name" :value="option.value" /> <el-option v-for="option in fontSize" :key="option.value" :label="option.name" :value="option.value" />
</el-select> </el-select>
</el-form-item> </el-form-item>
<span v-show="chart.type && chart.type.includes('horizontal')">
<el-form-item :label="$t('chart.value_formatter_type')" class="form-item">
<el-select v-model="axisForm.axisLabelFormatter.type" @change="changeXAxisStyle">
<el-option v-for="type in typeList" :key="type.value" :label="$t('chart.' + type.name)" :value="type.value" />
</el-select>
</el-form-item>
<el-form-item v-show="axisForm.axisLabelFormatter.type !== 'auto'" :label="$t('chart.value_formatter_decimal_count')" class="form-item">
<el-input-number v-model="axisForm.axisLabelFormatter.decimalCount" :precision="0" :min="0" :max="10" size="mini" @change="changeXAxisStyle" />
</el-form-item>
<el-form-item v-show="axisForm.axisLabelFormatter.type !== 'percent'" :label="$t('chart.value_formatter_unit')" class="form-item">
<el-select v-model="axisForm.axisLabelFormatter.unit" :placeholder="$t('chart.pls_select_field')" size="mini" @change="changeXAxisStyle">
<el-option v-for="item in unitList" :key="item.value" :label="$t('chart.' + item.name)" :value="item.value" />
</el-select>
</el-form-item>
<el-form-item :label="$t('chart.value_formatter_suffix')" class="form-item">
<el-input v-model="axisForm.axisLabelFormatter.suffix" size="mini" clearable :placeholder="$t('commons.input_content')" @change="changeXAxisStyle" />
</el-form-item>
<el-form-item :label="$t('chart.value_formatter_thousand_separator')" class="form-item">
<el-checkbox v-model="axisForm.axisLabelFormatter.thousandSeparator" @change="changeXAxisStyle" />
</el-form-item>
</span>
</span> </span>
<el-divider v-if="showProperty('axisLabel')" /> <el-divider v-if="showProperty('axisLabel')" />
<el-form-item v-show="showProperty('axisLabel')" :label="$t('chart.content_formatter')" class="form-item"> <el-form-item v-show="showProperty('axisLabel')" :label="$t('chart.content_formatter')" class="form-item">
...@@ -101,6 +127,7 @@ ...@@ -101,6 +127,7 @@
<script> <script>
import { COLOR_PANEL, DEFAULT_XAXIS_STYLE } from '../../chart/chart' import { COLOR_PANEL, DEFAULT_XAXIS_STYLE } from '../../chart/chart'
import { formatterType, unitList } from '@/views/chart/chart/formatter'
export default { export default {
name: 'XAxisSelector', name: 'XAxisSelector',
...@@ -126,7 +153,9 @@ export default { ...@@ -126,7 +153,9 @@ export default {
axisForm: JSON.parse(JSON.stringify(DEFAULT_XAXIS_STYLE)), axisForm: JSON.parse(JSON.stringify(DEFAULT_XAXIS_STYLE)),
isSetting: false, isSetting: false,
fontSize: [], fontSize: [],
predefineColors: COLOR_PANEL predefineColors: COLOR_PANEL,
typeList: formatterType,
unitList: unitList
} }
}, },
watch: { watch: {
...@@ -161,6 +190,9 @@ export default { ...@@ -161,6 +190,9 @@ export default {
if (!this.axisForm.axisValue) { if (!this.axisForm.axisValue) {
this.axisForm.axisValue = JSON.parse(JSON.stringify(DEFAULT_XAXIS_STYLE.axisValue)) this.axisForm.axisValue = JSON.parse(JSON.stringify(DEFAULT_XAXIS_STYLE.axisValue))
} }
if (!this.axisForm.axisLabelFormatter) {
this.axisForm.axisLabelFormatter = JSON.parse(JSON.stringify(DEFAULT_XAXIS_STYLE.axisLabelFormatter))
}
} }
} }
}, },
......
...@@ -81,6 +81,32 @@ ...@@ -81,6 +81,32 @@
<el-option v-for="option in fontSize" :key="option.value" :label="option.name" :value="option.value" /> <el-option v-for="option in fontSize" :key="option.value" :label="option.name" :value="option.value" />
</el-select> </el-select>
</el-form-item> </el-form-item>
<span v-show="chart.type && chart.type.includes('horizontal')">
<el-form-item :label="$t('chart.value_formatter_type')" class="form-item">
<el-select v-model="axisForm.axisLabelFormatter.type" @change="changeXAxisStyle">
<el-option v-for="type in typeList" :key="type.value" :label="$t('chart.' + type.name)" :value="type.value" />
</el-select>
</el-form-item>
<el-form-item v-show="axisForm.axisLabelFormatter.type !== 'auto'" :label="$t('chart.value_formatter_decimal_count')" class="form-item">
<el-input-number v-model="axisForm.axisLabelFormatter.decimalCount" :precision="0" :min="0" :max="10" size="mini" @change="changeXAxisStyle" />
</el-form-item>
<el-form-item v-show="axisForm.axisLabelFormatter.type !== 'percent'" :label="$t('chart.value_formatter_unit')" class="form-item">
<el-select v-model="axisForm.axisLabelFormatter.unit" :placeholder="$t('chart.pls_select_field')" size="mini" @change="changeXAxisStyle">
<el-option v-for="item in unitList" :key="item.value" :label="$t('chart.' + item.name)" :value="item.value" />
</el-select>
</el-form-item>
<el-form-item :label="$t('chart.value_formatter_suffix')" class="form-item">
<el-input v-model="axisForm.axisLabelFormatter.suffix" size="mini" clearable :placeholder="$t('commons.input_content')" @change="changeXAxisStyle" />
</el-form-item>
<el-form-item :label="$t('chart.value_formatter_thousand_separator')" class="form-item">
<el-checkbox v-model="axisForm.axisLabelFormatter.thousandSeparator" @change="changeXAxisStyle" />
</el-form-item>
</span>
</span> </span>
</div> </div>
</el-form> </el-form>
...@@ -90,6 +116,7 @@ ...@@ -90,6 +116,7 @@
<script> <script>
import { COLOR_PANEL, DEFAULT_XAXIS_STYLE } from '../../chart/chart' import { COLOR_PANEL, DEFAULT_XAXIS_STYLE } from '../../chart/chart'
import { formatterType, unitList } from '@/views/chart/chart/formatter'
export default { export default {
name: 'XAxisSelectorAntV', name: 'XAxisSelectorAntV',
...@@ -115,7 +142,9 @@ export default { ...@@ -115,7 +142,9 @@ export default {
axisForm: JSON.parse(JSON.stringify(DEFAULT_XAXIS_STYLE)), axisForm: JSON.parse(JSON.stringify(DEFAULT_XAXIS_STYLE)),
isSetting: false, isSetting: false,
fontSize: [], fontSize: [],
predefineColors: COLOR_PANEL predefineColors: COLOR_PANEL,
typeList: formatterType,
unitList: unitList
} }
}, },
watch: { watch: {
...@@ -150,6 +179,9 @@ export default { ...@@ -150,6 +179,9 @@ export default {
if (!this.axisForm.axisValue) { if (!this.axisForm.axisValue) {
this.axisForm.axisValue = JSON.parse(JSON.stringify(DEFAULT_XAXIS_STYLE.axisValue)) this.axisForm.axisValue = JSON.parse(JSON.stringify(DEFAULT_XAXIS_STYLE.axisValue))
} }
if (!this.axisForm.axisLabelFormatter) {
this.axisForm.axisLabelFormatter = JSON.parse(JSON.stringify(DEFAULT_XAXIS_STYLE.axisLabelFormatter))
}
} }
} }
}, },
......
...@@ -88,6 +88,32 @@ ...@@ -88,6 +88,32 @@
<el-option v-for="option in fontSize" :key="option.value" :label="option.name" :value="option.value" /> <el-option v-for="option in fontSize" :key="option.value" :label="option.name" :value="option.value" />
</el-select> </el-select>
</el-form-item> </el-form-item>
<span v-show="chart.type && !chart.type.includes('horizontal')">
<el-form-item :label="$t('chart.value_formatter_type')" class="form-item">
<el-select v-model="axisForm.axisLabelFormatter.type" @change="changeYAxisStyle">
<el-option v-for="type in typeList" :key="type.value" :label="$t('chart.' + type.name)" :value="type.value" />
</el-select>
</el-form-item>
<el-form-item v-show="axisForm.axisLabelFormatter.type !== 'auto'" :label="$t('chart.value_formatter_decimal_count')" class="form-item">
<el-input-number v-model="axisForm.axisLabelFormatter.decimalCount" :precision="0" :min="0" :max="10" size="mini" @change="changeYAxisStyle" />
</el-form-item>
<el-form-item v-show="axisForm.axisLabelFormatter.type !== 'percent'" :label="$t('chart.value_formatter_unit')" class="form-item">
<el-select v-model="axisForm.axisLabelFormatter.unit" :placeholder="$t('chart.pls_select_field')" size="mini" @change="changeYAxisStyle">
<el-option v-for="item in unitList" :key="item.value" :label="$t('chart.' + item.name)" :value="item.value" />
</el-select>
</el-form-item>
<el-form-item :label="$t('chart.value_formatter_suffix')" class="form-item">
<el-input v-model="axisForm.axisLabelFormatter.suffix" size="mini" clearable :placeholder="$t('commons.input_content')" @change="changeYAxisStyle" />
</el-form-item>
<el-form-item :label="$t('chart.value_formatter_thousand_separator')" class="form-item">
<el-checkbox v-model="axisForm.axisLabelFormatter.thousandSeparator" @change="changeYAxisStyle" />
</el-form-item>
</span>
</span> </span>
<el-divider v-if="showProperty('axisLabel')" /> <el-divider v-if="showProperty('axisLabel')" />
<el-form-item v-show="showProperty('axisLabel')" :label="$t('chart.content_formatter')" class="form-item"> <el-form-item v-show="showProperty('axisLabel')" :label="$t('chart.content_formatter')" class="form-item">
...@@ -101,6 +127,7 @@ ...@@ -101,6 +127,7 @@
<script> <script>
import { COLOR_PANEL, DEFAULT_YAXIS_EXT_STYLE } from '../../chart/chart' import { COLOR_PANEL, DEFAULT_YAXIS_EXT_STYLE } from '../../chart/chart'
import { formatterType, unitList } from '@/views/chart/chart/formatter'
export default { export default {
name: 'YAxisExtSelector', name: 'YAxisExtSelector',
...@@ -126,7 +153,9 @@ export default { ...@@ -126,7 +153,9 @@ export default {
axisForm: JSON.parse(JSON.stringify(DEFAULT_YAXIS_EXT_STYLE)), axisForm: JSON.parse(JSON.stringify(DEFAULT_YAXIS_EXT_STYLE)),
isSetting: false, isSetting: false,
fontSize: [], fontSize: [],
predefineColors: COLOR_PANEL predefineColors: COLOR_PANEL,
typeList: formatterType,
unitList: unitList
} }
}, },
watch: { watch: {
...@@ -164,6 +193,9 @@ export default { ...@@ -164,6 +193,9 @@ export default {
if (!this.axisForm.axisValue) { if (!this.axisForm.axisValue) {
this.axisForm.axisValue = JSON.parse(JSON.stringify(DEFAULT_YAXIS_EXT_STYLE.axisValue)) this.axisForm.axisValue = JSON.parse(JSON.stringify(DEFAULT_YAXIS_EXT_STYLE.axisValue))
} }
if (!this.axisForm.axisLabelFormatter) {
this.axisForm.axisLabelFormatter = JSON.parse(JSON.stringify(DEFAULT_YAXIS_EXT_STYLE.axisLabelFormatter))
}
} }
} }
}, },
......
...@@ -81,6 +81,32 @@ ...@@ -81,6 +81,32 @@
<el-option v-for="option in fontSize" :key="option.value" :label="option.name" :value="option.value" /> <el-option v-for="option in fontSize" :key="option.value" :label="option.name" :value="option.value" />
</el-select> </el-select>
</el-form-item> </el-form-item>
<span v-show="chart.type && !chart.type.includes('horizontal')">
<el-form-item :label="$t('chart.value_formatter_type')" class="form-item">
<el-select v-model="axisForm.axisLabelFormatter.type" @change="changeYAxisStyle">
<el-option v-for="type in typeList" :key="type.value" :label="$t('chart.' + type.name)" :value="type.value" />
</el-select>
</el-form-item>
<el-form-item v-show="axisForm.axisLabelFormatter.type !== 'auto'" :label="$t('chart.value_formatter_decimal_count')" class="form-item">
<el-input-number v-model="axisForm.axisLabelFormatter.decimalCount" :precision="0" :min="0" :max="10" size="mini" @change="changeYAxisStyle" />
</el-form-item>
<el-form-item v-show="axisForm.axisLabelFormatter.type !== 'percent'" :label="$t('chart.value_formatter_unit')" class="form-item">
<el-select v-model="axisForm.axisLabelFormatter.unit" :placeholder="$t('chart.pls_select_field')" size="mini" @change="changeYAxisStyle">
<el-option v-for="item in unitList" :key="item.value" :label="$t('chart.' + item.name)" :value="item.value" />
</el-select>
</el-form-item>
<el-form-item :label="$t('chart.value_formatter_suffix')" class="form-item">
<el-input v-model="axisForm.axisLabelFormatter.suffix" size="mini" clearable :placeholder="$t('commons.input_content')" @change="changeYAxisStyle" />
</el-form-item>
<el-form-item :label="$t('chart.value_formatter_thousand_separator')" class="form-item">
<el-checkbox v-model="axisForm.axisLabelFormatter.thousandSeparator" @change="changeYAxisStyle" />
</el-form-item>
</span>
</span> </span>
</div> </div>
</el-form> </el-form>
...@@ -90,6 +116,7 @@ ...@@ -90,6 +116,7 @@
<script> <script>
import { COLOR_PANEL, DEFAULT_YAXIS_EXT_STYLE } from '../../chart/chart' import { COLOR_PANEL, DEFAULT_YAXIS_EXT_STYLE } from '../../chart/chart'
import { formatterType, unitList } from '@/views/chart/chart/formatter'
export default { export default {
name: 'YAxisExtSelectorAntV', name: 'YAxisExtSelectorAntV',
...@@ -115,7 +142,9 @@ export default { ...@@ -115,7 +142,9 @@ export default {
axisForm: JSON.parse(JSON.stringify(DEFAULT_YAXIS_EXT_STYLE)), axisForm: JSON.parse(JSON.stringify(DEFAULT_YAXIS_EXT_STYLE)),
isSetting: false, isSetting: false,
fontSize: [], fontSize: [],
predefineColors: COLOR_PANEL predefineColors: COLOR_PANEL,
typeList: formatterType,
unitList: unitList
} }
}, },
watch: { watch: {
...@@ -153,6 +182,9 @@ export default { ...@@ -153,6 +182,9 @@ export default {
if (!this.axisForm.axisValue) { if (!this.axisForm.axisValue) {
this.axisForm.axisValue = JSON.parse(JSON.stringify(DEFAULT_YAXIS_EXT_STYLE.axisValue)) this.axisForm.axisValue = JSON.parse(JSON.stringify(DEFAULT_YAXIS_EXT_STYLE.axisValue))
} }
if (!this.axisForm.axisLabelFormatter) {
this.axisForm.axisLabelFormatter = JSON.parse(JSON.stringify(DEFAULT_YAXIS_EXT_STYLE.axisLabelFormatter))
}
} }
} }
}, },
......
...@@ -88,6 +88,32 @@ ...@@ -88,6 +88,32 @@
<el-option v-for="option in fontSize" :key="option.value" :label="option.name" :value="option.value" /> <el-option v-for="option in fontSize" :key="option.value" :label="option.name" :value="option.value" />
</el-select> </el-select>
</el-form-item> </el-form-item>
<span v-show="chart.type && !chart.type.includes('horizontal')">
<el-form-item :label="$t('chart.value_formatter_type')" class="form-item">
<el-select v-model="axisForm.axisLabelFormatter.type" @change="changeYAxisStyle">
<el-option v-for="type in typeList" :key="type.value" :label="$t('chart.' + type.name)" :value="type.value" />
</el-select>
</el-form-item>
<el-form-item v-show="axisForm.axisLabelFormatter.type !== 'auto'" :label="$t('chart.value_formatter_decimal_count')" class="form-item">
<el-input-number v-model="axisForm.axisLabelFormatter.decimalCount" :precision="0" :min="0" :max="10" size="mini" @change="changeYAxisStyle" />
</el-form-item>
<el-form-item v-show="axisForm.axisLabelFormatter.type !== 'percent'" :label="$t('chart.value_formatter_unit')" class="form-item">
<el-select v-model="axisForm.axisLabelFormatter.unit" :placeholder="$t('chart.pls_select_field')" size="mini" @change="changeYAxisStyle">
<el-option v-for="item in unitList" :key="item.value" :label="$t('chart.' + item.name)" :value="item.value" />
</el-select>
</el-form-item>
<el-form-item :label="$t('chart.value_formatter_suffix')" class="form-item">
<el-input v-model="axisForm.axisLabelFormatter.suffix" size="mini" clearable :placeholder="$t('commons.input_content')" @change="changeYAxisStyle" />
</el-form-item>
<el-form-item :label="$t('chart.value_formatter_thousand_separator')" class="form-item">
<el-checkbox v-model="axisForm.axisLabelFormatter.thousandSeparator" @change="changeYAxisStyle" />
</el-form-item>
</span>
</span> </span>
<el-divider v-if="showProperty('axisLabel')" /> <el-divider v-if="showProperty('axisLabel')" />
<el-form-item v-show="showProperty('axisLabel')" :label="$t('chart.content_formatter')" class="form-item"> <el-form-item v-show="showProperty('axisLabel')" :label="$t('chart.content_formatter')" class="form-item">
...@@ -101,6 +127,7 @@ ...@@ -101,6 +127,7 @@
<script> <script>
import { COLOR_PANEL, DEFAULT_YAXIS_STYLE } from '../../chart/chart' import { COLOR_PANEL, DEFAULT_YAXIS_STYLE } from '../../chart/chart'
import { formatterType, unitList } from '@/views/chart/chart/formatter'
export default { export default {
name: 'YAxisSelector', name: 'YAxisSelector',
...@@ -126,7 +153,9 @@ export default { ...@@ -126,7 +153,9 @@ export default {
axisForm: JSON.parse(JSON.stringify(DEFAULT_YAXIS_STYLE)), axisForm: JSON.parse(JSON.stringify(DEFAULT_YAXIS_STYLE)),
isSetting: false, isSetting: false,
fontSize: [], fontSize: [],
predefineColors: COLOR_PANEL predefineColors: COLOR_PANEL,
typeList: formatterType,
unitList: unitList
} }
}, },
watch: { watch: {
...@@ -161,6 +190,9 @@ export default { ...@@ -161,6 +190,9 @@ export default {
if (!this.axisForm.axisValue) { if (!this.axisForm.axisValue) {
this.axisForm.axisValue = JSON.parse(JSON.stringify(DEFAULT_YAXIS_STYLE.axisValue)) this.axisForm.axisValue = JSON.parse(JSON.stringify(DEFAULT_YAXIS_STYLE.axisValue))
} }
if (!this.axisForm.axisLabelFormatter) {
this.axisForm.axisLabelFormatter = JSON.parse(JSON.stringify(DEFAULT_YAXIS_STYLE.axisLabelFormatter))
}
} }
} }
}, },
......
...@@ -92,6 +92,32 @@ ...@@ -92,6 +92,32 @@
<el-option v-for="option in fontSize" :key="option.value" :label="option.name" :value="option.value" /> <el-option v-for="option in fontSize" :key="option.value" :label="option.name" :value="option.value" />
</el-select> </el-select>
</el-form-item> </el-form-item>
<span v-show="chart.type && !chart.type.includes('horizontal')">
<el-form-item :label="$t('chart.value_formatter_type')" class="form-item">
<el-select v-model="axisForm.axisLabelFormatter.type" @change="changeYAxisStyle">
<el-option v-for="type in typeList" :key="type.value" :label="$t('chart.' + type.name)" :value="type.value" />
</el-select>
</el-form-item>
<el-form-item v-show="axisForm.axisLabelFormatter.type !== 'auto'" :label="$t('chart.value_formatter_decimal_count')" class="form-item">
<el-input-number v-model="axisForm.axisLabelFormatter.decimalCount" :precision="0" :min="0" :max="10" size="mini" @change="changeYAxisStyle" />
</el-form-item>
<el-form-item v-show="axisForm.axisLabelFormatter.type !== 'percent'" :label="$t('chart.value_formatter_unit')" class="form-item">
<el-select v-model="axisForm.axisLabelFormatter.unit" :placeholder="$t('chart.pls_select_field')" size="mini" @change="changeYAxisStyle">
<el-option v-for="item in unitList" :key="item.value" :label="$t('chart.' + item.name)" :value="item.value" />
</el-select>
</el-form-item>
<el-form-item :label="$t('chart.value_formatter_suffix')" class="form-item">
<el-input v-model="axisForm.axisLabelFormatter.suffix" size="mini" clearable :placeholder="$t('commons.input_content')" @change="changeYAxisStyle" />
</el-form-item>
<el-form-item :label="$t('chart.value_formatter_thousand_separator')" class="form-item">
<el-checkbox v-model="axisForm.axisLabelFormatter.thousandSeparator" @change="changeYAxisStyle" />
</el-form-item>
</span>
</span> </span>
</div> </div>
</el-form> </el-form>
...@@ -101,6 +127,7 @@ ...@@ -101,6 +127,7 @@
<script> <script>
import { COLOR_PANEL, DEFAULT_YAXIS_STYLE } from '../../chart/chart' import { COLOR_PANEL, DEFAULT_YAXIS_STYLE } from '../../chart/chart'
import { formatterType, unitList } from '@/views/chart/chart/formatter'
export default { export default {
name: 'YAxisSelectorAntV', name: 'YAxisSelectorAntV',
...@@ -126,7 +153,9 @@ export default { ...@@ -126,7 +153,9 @@ export default {
axisForm: JSON.parse(JSON.stringify(DEFAULT_YAXIS_STYLE)), axisForm: JSON.parse(JSON.stringify(DEFAULT_YAXIS_STYLE)),
isSetting: false, isSetting: false,
fontSize: [], fontSize: [],
predefineColors: COLOR_PANEL predefineColors: COLOR_PANEL,
typeList: formatterType,
unitList: unitList
} }
}, },
watch: { watch: {
...@@ -161,6 +190,9 @@ export default { ...@@ -161,6 +190,9 @@ export default {
if (!this.axisForm.axisValue) { if (!this.axisForm.axisValue) {
this.axisForm.axisValue = JSON.parse(JSON.stringify(DEFAULT_YAXIS_STYLE.axisValue)) this.axisForm.axisValue = JSON.parse(JSON.stringify(DEFAULT_YAXIS_STYLE.axisValue))
} }
if (!this.axisForm.axisLabelFormatter) {
this.axisForm.axisLabelFormatter = JSON.parse(JSON.stringify(DEFAULT_YAXIS_STYLE.axisLabelFormatter))
}
} }
} }
}, },
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论