fix(视图-雷达图): 雷达图最小值取实际最小值
This commit is contained in:
parent
88b47ca368
commit
8e4d32b8c9
@ -1482,7 +1482,7 @@ export default {
|
|||||||
dimension_letter_space: 'Name Letter Space',
|
dimension_letter_space: 'Name Letter Space',
|
||||||
font_family: 'Font Family',
|
font_family: 'Font Family',
|
||||||
font_family_tip: 'The font will only take effect if it is installed on the operating system',
|
font_family_tip: 'The font will only take effect if it is installed on the operating system',
|
||||||
radar_max_tip: 'If the maximum value of the actual data is greater than the custom maximum value, the maximum value of the actual data will prevail.',
|
radar_min_max_tip: 'If the minimum value of the actual data is less than the custom minimum value, or the maximum value is greater than the custom maximum value, the actual data will prevail.',
|
||||||
letter_space: 'Letter Space',
|
letter_space: 'Letter Space',
|
||||||
font_shadow: 'Font Shadow',
|
font_shadow: 'Font Shadow',
|
||||||
chart_area: 'Area',
|
chart_area: 'Area',
|
||||||
|
|||||||
@ -1479,7 +1479,7 @@ export default {
|
|||||||
dimension_letter_space: '名稱字間距',
|
dimension_letter_space: '名稱字間距',
|
||||||
font_family: '字體',
|
font_family: '字體',
|
||||||
font_family_tip: '只有操作系統上已安裝該字體才能生效',
|
font_family_tip: '只有操作系統上已安裝該字體才能生效',
|
||||||
radar_max_tip: '如果實際數據的最大值大於自定義的最大值,將以實際數據的最大值為準。',
|
radar_min_max_tip: '如果實際數據的最小值小於自定義的最小值,或者最大值大於自定義的最大值,將以實際數據為準。',
|
||||||
letter_space: '字間距',
|
letter_space: '字間距',
|
||||||
font_shadow: '字體陰影',
|
font_shadow: '字體陰影',
|
||||||
chart_area: '面積圖',
|
chart_area: '面積圖',
|
||||||
|
|||||||
@ -1479,7 +1479,7 @@ export default {
|
|||||||
dimension_letter_space: '名称字间距',
|
dimension_letter_space: '名称字间距',
|
||||||
font_family: '字体',
|
font_family: '字体',
|
||||||
font_family_tip: '只有操作系统上已安装该字体才能生效',
|
font_family_tip: '只有操作系统上已安装该字体才能生效',
|
||||||
radar_max_tip: '如果实际数据的最大值大于自定义的最大值,将以实际数据的最大值为准。',
|
radar_min_max_tip: '如果实际数据的最小值小于自定义的最小值,或者最大值大于自定义的最大值,将以实际数据为准。',
|
||||||
letter_space: '字间距',
|
letter_space: '字间距',
|
||||||
font_shadow: '字体阴影',
|
font_shadow: '字体阴影',
|
||||||
chart_area: '面积图',
|
chart_area: '面积图',
|
||||||
|
|||||||
@ -31,6 +31,7 @@ export function baseRadarOption(chart_option, chart) {
|
|||||||
if (chart.data) {
|
if (chart.data) {
|
||||||
chart_option.title.text = chart.title
|
chart_option.title.text = chart.title
|
||||||
const maxValues = []
|
const maxValues = []
|
||||||
|
const minValues = []
|
||||||
for (let i = 0; i < chart.data.series.length; i++) {
|
for (let i = 0; i < chart.data.series.length; i++) {
|
||||||
const y = chart.data.series[i]
|
const y = chart.data.series[i]
|
||||||
if (y.data.length === 0) {
|
if (y.data.length === 0) {
|
||||||
@ -63,12 +64,13 @@ export function baseRadarOption(chart_option, chart) {
|
|||||||
chart_option.series.push(d)
|
chart_option.series.push(d)
|
||||||
|
|
||||||
maxValues.push(Math.max.apply(null, y.value))
|
maxValues.push(Math.max.apply(null, y.value))
|
||||||
|
minValues.push(Math.min.apply(null, y.value))
|
||||||
}
|
}
|
||||||
let max = Math.max.apply(null, maxValues)
|
let max = Math.max.apply(null, maxValues)
|
||||||
let min
|
let min = Math.min.apply(null, minValues)
|
||||||
const customStyle = JSON.parse(chart.customStyle)
|
const customStyle = JSON.parse(chart.customStyle)
|
||||||
if (customStyle?.split?.axisValue?.auto === false) {
|
if (customStyle?.split?.axisValue?.auto === false) {
|
||||||
min = customStyle.split.axisValue.min
|
min = Math.min(customStyle.split.axisValue.min, min)
|
||||||
max = Math.max(customStyle.split.axisValue.max, max)
|
max = Math.max(customStyle.split.axisValue.max, max)
|
||||||
}
|
}
|
||||||
chart.data.x.forEach(function(ele) {
|
chart.data.x.forEach(function(ele) {
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
import { getLabel, getLegend, getPadding, getTheme, getTooltip } from '@/views/chart/chart/common/common_antv'
|
import { getLabel, getLegend, getPadding, getTheme, getTooltip } from '@/views/chart/chart/common/common_antv'
|
||||||
import { Radar } from '@antv/g2plot'
|
import { Radar } from '@antv/g2plot'
|
||||||
import { antVCustomColor } from '@/views/chart/chart/util'
|
import { antVCustomColor } from '@/views/chart/chart/util'
|
||||||
|
import { minBy, maxBy } from 'lodash'
|
||||||
|
|
||||||
export function baseRadarOptionAntV(plot, container, chart, action) {
|
export function baseRadarOptionAntV(plot, container, chart, action) {
|
||||||
// theme
|
// theme
|
||||||
@ -124,8 +125,9 @@ export function baseRadarOptionAntV(plot, container, chart, action) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (s.axisValue?.auto === false) {
|
if (s.axisValue?.auto === false) {
|
||||||
yAxis.min = yAxis.minLimit = s.axisValue.min
|
const dataMin = minBy(data, 'value')
|
||||||
const dataMax = _.maxBy(data, 'value')
|
yAxis.min = yAxis.minLimit = Math.min(s.axisValue.min, dataMin.value)
|
||||||
|
const dataMax = maxBy(data, 'value')
|
||||||
yAxis.max = yAxis.maxLimit = Math.max(s.axisValue.max, dataMax.value)
|
yAxis.max = yAxis.maxLimit = Math.max(s.axisValue.max, dataMax.value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -161,7 +161,7 @@
|
|||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
slot="content"
|
slot="content"
|
||||||
v-html="$t('chart.radar_max_tip')"
|
v-html="$t('chart.radar_min_max_tip')"
|
||||||
/>
|
/>
|
||||||
<i
|
<i
|
||||||
class="el-icon-info"
|
class="el-icon-info"
|
||||||
|
|||||||
@ -80,7 +80,7 @@
|
|||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
slot="content"
|
slot="content"
|
||||||
v-html="$t('chart.radar_max_tip')"
|
v-html="$t('chart.radar_min_max_tip')"
|
||||||
/>
|
/>
|
||||||
<i
|
<i
|
||||||
class="el-icon-info"
|
class="el-icon-info"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user