NEZ-1838 fix:柱状图 Y轴 未进行单位转化

This commit is contained in:
zhangyu
2022-04-26 14:58:25 +08:00
parent 1d6f29b0de
commit 133d76d80e
2 changed files with 14 additions and 1 deletions

View File

@@ -28,6 +28,7 @@ import { formatScientificNotation, getMetricTypeValue } from '@/components/commo
import chartDataFormat from '@/components/chart/chartDataFormat'
import { initColor } from '@/components/chart/chart/tools'
import lodash from 'lodash'
import bus from "@/libs/bus";
export default {
name: 'chart-bar',
@@ -107,6 +108,13 @@ export default {
}
}
}
chartOption.yAxis.axisLabel.formatter = function (val, index) {
const value = formatScientificNotation(val, 6)
let chartUnit = self.chartInfo.unit
chartUnit = chartUnit || 2
const unit = chartDataFormat.getUnit(chartUnit)
return unit.compute(value, index, -1, 2)
}
chartOption.tooltip.formatter = this.formatterFunc
chartOption.tooltip.position = this.tooltipPosition
/* 使用setTimeout延迟渲染图表避免样式错乱 */

View File

@@ -43,7 +43,12 @@ const chartBarOption = {
}
},
yAxis: {
type: 'value'
type: 'value',
axisLabel: {
show: true,
fontSize: 10
// formatter: 动态生成
}
},
series: [
{