NEZ-1838 fix:柱状图 Y轴 未进行单位转化
This commit is contained in:
@@ -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延迟渲染图表,避免样式错乱 */
|
||||
|
||||
@@ -43,7 +43,12 @@ const chartBarOption = {
|
||||
}
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value'
|
||||
type: 'value',
|
||||
axisLabel: {
|
||||
show: true,
|
||||
fontSize: 10
|
||||
// formatter: 动态生成
|
||||
}
|
||||
},
|
||||
series: [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user