Merge pull request #9346 from dataease/pr@dev-v2@chart-quadrant-fix

fix(图表-象限图): 修复象限图无法跳转、联动、下钻的问题
This commit is contained in:
jianneng-fit2cloud 2024-04-25 16:55:41 +08:00 committed by GitHub
commit 0438fa0187
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -149,6 +149,8 @@ export class Quadrant extends G2PlotChartView<ScatterOptions, G2Scatter> {
const dataLength = chart.data?.data.length / chart.data?.fields.length
for (let index = 0; index < dataLength; index++) {
const tmpData = {
dimensionList: groupedData[xFieldObj.name][index].dimensionList,
quotaList: groupedData[xFieldObj.name][index].quotaList,
[xFieldObj.name]: groupedData[xFieldObj.name][index].value
}
if (groupedData[yFieldObj.name]) {
@ -168,15 +170,23 @@ export class Quadrant extends G2PlotChartView<ScatterOptions, G2Scatter> {
}
// x轴基准线 默认值
const xBaseline = (
data.reduce((valueSoFar, currentItem) => {
(data.reduce((valueSoFar, currentItem) => {
return Math.max(valueSoFar, currentItem[xFieldObj.name])
}, 0) / 2
}, 0) +
data.reduce((valueSoFar, currentItem) => {
return Math.min(valueSoFar, currentItem[xFieldObj.name])
}, Infinity)) /
2
).toFixed()
// y轴基准线 默认值
const yBaseline = (
data.reduce((valueSoFar, currentItem) => {
(data.reduce((valueSoFar, currentItem) => {
return Math.max(valueSoFar, currentItem[yFieldObj.name])
}, 0) / 2
}, 0) +
data.reduce((valueSoFar, currentItem) => {
return Math.min(valueSoFar, currentItem[yFieldObj.name])
}, Infinity)) /
2
).toFixed()
const defaultBaselineQuadrant = {
...chart.customAttr['quadrant']