mirror of
https://github.com/dataease/dataease.git
synced 2026-06-16 11:21:44 +08:00
fix(图表): 优化雷达图点击事件处理逻辑,确保数据正确传递
This commit is contained in:
@@ -103,18 +103,24 @@ export class Radar extends G2ChartView {
|
||||
const newChart = new G2Chart({ container })
|
||||
handleChartDashboardHidden(chart, options)
|
||||
newChart.options(options)
|
||||
newChart.on('point:click', action)
|
||||
if (options.children[0].labels?.length) {
|
||||
newChart.on('label:click', e => {
|
||||
action({
|
||||
x: e.x,
|
||||
y: e.y,
|
||||
data: {
|
||||
data: e.target.attrs.data
|
||||
}
|
||||
})
|
||||
const handleClick = e => {
|
||||
const pointData = e?.data?.data
|
||||
if (!pointData) {
|
||||
return
|
||||
}
|
||||
action({
|
||||
...e,
|
||||
x: e.x,
|
||||
y: e.y,
|
||||
data: {
|
||||
data: pointData
|
||||
}
|
||||
})
|
||||
}
|
||||
newChart.on('point:click', handleClick)
|
||||
if (options.children[0].labels?.length) {
|
||||
newChart.on('label:click', handleClick)
|
||||
}
|
||||
return newChart
|
||||
}
|
||||
|
||||
@@ -182,8 +188,12 @@ export class Radar extends G2ChartView {
|
||||
|
||||
if (radarShowPoint) {
|
||||
options.children.push({
|
||||
zIndex: 2,
|
||||
type: 'point',
|
||||
encode: {
|
||||
x: 'field',
|
||||
y: 'value',
|
||||
color: 'category',
|
||||
shape: 'point',
|
||||
size: radarPointSize
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user