Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[perf] brush should clear linked graphics after clear #3765

Open
xile611 opened this issue Feb 28, 2025 · 3 comments
Open

[perf] brush should clear linked graphics after clear #3765

xile611 opened this issue Feb 28, 2025 · 3 comments
Assignees

Comments

@xile611
Copy link
Contributor

xile611 commented Feb 28, 2025

  1. clear 的时候没有清除关联元素的状态
Image
  1. 下面代码存在重复调用的问题
Image
@xile611
Copy link
Contributor Author

xile611 commented Mar 3, 2025

  1. brush 事件里面,现在返回model 和value, 需要增加 chart
  2. brush clearGraphic 也需要能够brush 导致的状态

@xile611 xile611 closed this as completed Mar 3, 2025
@xile611
Copy link
Contributor Author

xile611 commented Mar 3, 2025

brush 增加配置 onBrushChange: ({ }) => boolean ,返回值为true 的时候清楚当前brush

@xile611 xile611 reopened this Mar 3, 2025
@pairone
Copy link
Contributor

pairone commented Mar 4, 2025

条形图框选内容不太符合预期 辛苦看下框选选中图元的逻辑

Image

{
    "type": "bar",
    "xField": [
        "10002"
    ],
    "yField": [
        "241216184524145",
        "20001"
    ],
    "direction": "horizontal",
    "seriesField": "20001",
    "padding": 0,
    "labelLayout": "region",
    "data": [
        {
            "id": "data",
            "values": [
                {
                    "10001": "销售额",
                    "10002": "710386.2080000001",
                    "10003": "241216184524139",
                    "20001": "公司-销售额",
                    "241216184524139": "710386.2080000001",
                    "241216184524145": "2019",
                    "241216184524148": "公司"
                },
                {
                    "10001": "利润",
                    "10002": "96740.72800000002",
                    "10003": "241216184524142",
                    "20001": "公司-利润",
                    "241216184524142": "96740.72800000002",
                    "241216184524145": "2019",
                    "241216184524148": "公司"
                },
                {
                    "10001": "销售额",
                    "10002": "401978.82199999975",
                    "10003": "241216184524139",
                    "20001": "小型企业-销售额",
                    "241216184524139": "401978.82199999975",
                    "241216184524145": "2019",
                    "241216184524148": "小型企业"
                },
                {
                    "10001": "利润",
                    "10002": "70445.662",
                    "10003": "241216184524142",
                    "20001": "小型企业-利润",
                    "241216184524142": "70445.662",
                    "241216184524145": "2019",
                    "241216184524148": "小型企业"
                },
                {
                    "10001": "销售额",
                    "10002": "1209267.4509999994",
                    "10003": "241216184524139",
                    "20001": "消费者-销售额",
                    "241216184524139": "1209267.4509999994",
                    "241216184524145": "2019",
                    "241216184524148": "消费者"
                },
                {
                    "10001": "利润",
                    "10002": "130523.21100000004",
                    "10003": "241216184524142",
                    "20001": "消费者-利润",
                    "241216184524142": "130523.21100000004",
                    "241216184524145": "2019",
                    "241216184524148": "消费者"
                },
                {
                    "10001": "销售额",
                    "10002": "1194097.982",
                    "10003": "241216184524139",
                    "20001": "公司-销售额",
                    "241216184524139": "1194097.982",
                    "241216184524145": "2020",
                    "241216184524148": "公司"
                },
                {
                    "10001": "利润",
                    "10002": "156066.722",
                    "10003": "241216184524142",
                    "20001": "公司-利润",
                    "241216184524142": "156066.722",
                    "241216184524145": "2020",
                    "241216184524148": "公司"
                },
                {
                    "10001": "销售额",
                    "10002": "612662.176",
                    "10003": "241216184524139",
                    "20001": "小型企业-销售额",
                    "241216184524139": "612662.176",
                    "241216184524145": "2020",
                    "241216184524148": "小型企业"
                },
                {
                    "10001": "利润",
                    "10002": "70031.83600000002",
                    "10003": "241216184524142",
                    "20001": "小型企业-利润",
                    "241216184524142": "70031.83600000002",
                    "241216184524145": "2020",
                    "241216184524148": "小型企业"
                },
                {
                    "10001": "销售额",
                    "10002": "1547854.518",
                    "10003": "241216184524139",
                    "20001": "消费者-销售额",
                    "241216184524139": "1547854.518",
                    "241216184524145": "2020",
                    "241216184524148": "消费者"
                },
                {
                    "10001": "利润",
                    "10002": "224529.71799999976",
                    "10003": "241216184524142",
                    "20001": "消费者-利润",
                    "241216184524142": "224529.71799999976",
                    "241216184524145": "2020",
                    "241216184524148": "消费者"
                },
                {
                    "10001": "销售额",
                    "10002": "751827.4890000003",
                    "10003": "241216184524139",
                    "20001": "小型企业-销售额",
                    "241216184524139": "751827.4890000003",
                    "241216184524145": "2021",
                    "241216184524148": "小型企业"
                },
                {
                    "10001": "利润",
                    "10002": "104185.24900000016",
                    "10003": "241216184524142",
                    "20001": "小型企业-利润",
                    "241216184524142": "104185.24900000016",
                    "241216184524145": "2021",
                    "241216184524148": "小型企业"
                },
                {
                    "10001": "销售额",
                    "10002": "1232049.7069999985",
                    "10003": "241216184524139",
                    "20001": "公司-销售额",
                    "241216184524139": "1232049.7069999985",
                    "241216184524145": "2021",
                    "241216184524148": "公司"
                },
                {
                    "10001": "利润",
                    "10002": "170255.82699999984",
                    "10003": "241216184524142",
                    "20001": "公司-利润",
                    "241216184524142": "170255.82699999984",
                    "241216184524145": "2021",
                    "241216184524148": "公司"
                },
                {
                    "10001": "销售额",
                    "10002": "2009897.834",
                    "10003": "241216184524139",
                    "20001": "消费者-销售额",
                    "241216184524139": "2009897.834",
                    "241216184524145": "2021",
                    "241216184524148": "消费者"
                },
                {
                    "10001": "利润",
                    "10002": "297288.05400000047",
                    "10003": "241216184524142",
                    "20001": "消费者-利润",
                    "241216184524142": "297288.05400000047",
                    "241216184524145": "2021",
                    "241216184524148": "消费者"
                },
                {
                    "10001": "销售额",
                    "10002": "1707242.6979999992",
                    "10003": "241216184524139",
                    "20001": "公司-销售额",
                    "241216184524139": "1707242.6979999992",
                    "241216184524145": "2022",
                    "241216184524148": "公司"
                },
                {
                    "10001": "利润",
                    "10002": "198663.45799999998",
                    "10003": "241216184524142",
                    "20001": "公司-利润",
                    "241216184524142": "198663.45799999998",
                    "241216184524145": "2022",
                    "241216184524148": "公司"
                },
                {
                    "10001": "销售额",
                    "10002": "2849279.1179999993",
                    "10003": "241216184524139",
                    "20001": "消费者-销售额",
                    "241216184524139": "2849279.1179999993",
                    "241216184524145": "2022",
                    "241216184524148": "消费者"
                },
                {
                    "10001": "利润",
                    "10002": "378567.09799999924",
                    "10003": "241216184524142",
                    "20001": "消费者-利润",
                    "241216184524142": "378567.09799999924",
                    "241216184524145": "2022",
                    "241216184524148": "消费者"
                },
                {
                    "10001": "销售额",
                    "10002": "972806.0580000003",
                    "10003": "241216184524139",
                    "20001": "小型企业-销售额",
                    "241216184524139": "972806.0580000003",
                    "241216184524145": "2022",
                    "241216184524148": "小型企业"
                },
                {
                    "10001": "利润",
                    "10002": "146603.898",
                    "10003": "241216184524142",
                    "20001": "小型企业-利润",
                    "241216184524142": "146603.898",
                    "241216184524145": "2022",
                    "241216184524148": "小型企业"
                },
                {
                    "10001": "销售额",
                    "10002": "309016.701",
                    "10003": "241216184524139",
                    "20001": "公司-销售额",
                    "241216184524139": "309016.701",
                    "241216184524145": "2023",
                    "241216184524148": "公司"
                },
                {
                    "10001": "利润",
                    "10002": "60240.901000000005",
                    "10003": "241216184524142",
                    "20001": "公司-利润",
                    "241216184524142": "60240.901000000005",
                    "241216184524145": "2023",
                    "241216184524148": "公司"
                },
                {
                    "10001": "销售额",
                    "10002": "151814.09599999996",
                    "10003": "241216184524139",
                    "20001": "小型企业-销售额",
                    "241216184524139": "151814.09599999996",
                    "241216184524145": "2023",
                    "241216184524148": "小型企业"
                },
                {
                    "10001": "利润",
                    "10002": "21212.016",
                    "10003": "241216184524142",
                    "20001": "小型企业-利润",
                    "241216184524142": "21212.016",
                    "241216184524145": "2023",
                    "241216184524148": "小型企业"
                },
                {
                    "10001": "销售额",
                    "10002": "408773.2670000001",
                    "10003": "241216184524139",
                    "20001": "消费者-销售额",
                    "241216184524139": "408773.2670000001",
                    "241216184524145": "2023",
                    "241216184524148": "消费者"
                },
                {
                    "10001": "利润",
                    "10002": "22184.54699999999",
                    "10003": "241216184524142",
                    "20001": "消费者-利润",
                    "241216184524142": "22184.54699999999",
                    "241216184524145": "2023",
                    "241216184524148": "消费者"
                }
            ],
            "fields": {
                "10001": {
                    "alias": "指标名称 "
                },
                "10002": {
                    "alias": "指标值 "
                },
                "20001": {
                    "alias": "图例项 ",
                    "domain": [
                        "公司-销售额",
                        "小型企业-销售额",
                        "消费者-销售额",
                        "公司-利润",
                        "小型企业-利润",
                        "消费者-利润"
                    ],
                    "sortIndex": 0,
                    "lockStatisticsByDomain": true
                },
                "241216184524139": {
                    "alias": "销售额"
                },
                "241216184524142": {
                    "alias": "利润"
                },
                "241216184524145": {
                    "alias": "订单日期",
                    "domain": [
                        "2019",
                        "2020",
                        "2021",
                        "2022",
                        "2023"
                    ],
                    "sortIndex": 0,
                    "lockStatisticsByDomain": true
                },
                "241216184524148": {
                    "alias": "细分"
                }
            }
        }
    ],
    "stackInverse": true,
    "axes": [
        {
            "type": "band",
            "tick": {
                "visible": false
            },
            "grid": {
                "visible": false,
                "style": {
                    "zIndex": 150,
                    "stroke": "#DADCDD",
                    "lineWidth": 1,
                    "lineDash": [
                        4,
                        2
                    ]
                }
            },
            "orient": "left",
            "visible": true,
            "domainLine": {
                "visible": true,
                "style": {
                    "lineWidth": 1,
                    "stroke": "#989999"
                }
            },
            "title": {
                "visible": false,
                "space": 5,
                "text": "订单日期",
                "style": {
                    "fontSize": 12,
                    "fill": "#363839",
                    "fontWeight": "normal"
                }
            },
            "maxHeight": null,
            "autoIndent": false,
            "sampling": false,
            "zIndex": 200,
            "label": {
                "visible": true,
                "space": 8,
                "style": {
                    "fontSize": 12,
                    "fill": "#6F6F6F",
                    "angle": 0,
                    "fontWeight": "normal",
                    "direction": "horizontal",
                    "maxLineWidth": 174
                },
                "autoHide": true,
                "autoHideMethod": "greedy",
                "flush": true,
                "lastVisible": true
            },
            "hover": true,
            "background": {
                "visible": true,
                "state": {
                    "hover": {
                        "fillOpacity": 0.08,
                        "fill": "#141414"
                    },
                    "hover_reverse": {
                        "fillOpacity": 0.08,
                        "fill": "#141414"
                    }
                }
            },
            "paddingInner": [
                0.15,
                0.1
            ],
            "paddingOuter": [
                0.075,
                0.1
            ]
        },
        {
            "type": "linear",
            "tick": {
                "visible": false,
                "style": {
                    "stroke": "rgba(255, 255, 255, 0)"
                }
            },
            "niceType": "accurateFirst",
            "zIndex": 200,
            "grid": {
                "visible": true,
                "style": {
                    "zIndex": 150,
                    "stroke": "#DADCDD",
                    "lineWidth": 1,
                    "lineDash": [
                        4,
                        2
                    ]
                }
            },
            "orient": "bottom",
            "visible": true,
            "domainLine": {
                "visible": true,
                "style": {
                    "lineWidth": 1,
                    "stroke": "rgba(255, 255, 255, 0)"
                }
            },
            "title": {
                "visible": false,
                "text": "销售额",
                "space": 8,
                "style": {
                    "fontSize": 12,
                    "fill": "#363839",
                    "fontWeight": "normal"
                }
            },
            "autoIndent": false,
            "sampling": false,
            "label": {
                "visible": true,
                "space": 4,
                "flush": true,
                "padding": 0,
                "style": {
                    "fontSize": 12,
                    "maxLineWidth": 174,
                    "fill": "#6F6F6F",
                    "angle": 0,
                    "fontWeight": "normal",
                    "dy": 0,
                    "direction": "horizontal"
                },
                "autoHide": true,
                "autoHideMethod": "greedy"
            },
            "background": {
                "visible": true,
                "state": {
                    "hover": {
                        "fillOpacity": 0.08,
                        "fill": "#141414"
                    },
                    "hover_reverse": {
                        "fillOpacity": 0.08,
                        "fill": "#141414"
                    }
                }
            },
            "zero": true,
            "nice": true
        }
    ],
    "color": {
        "field": "20001",
        "type": "ordinal",
        "range": [
            "#2E62F1",
            "#4DC36A",
            "#FF8406",
            "#FFCC00",
            "#4F44CF",
            "#5AC8FA"
        ],
        "specified": {},
        "domain": [
            "公司-销售额",
            "小型企业-销售额",
            "消费者-销售额",
            "公司-利润",
            "小型企业-利润",
            "消费者-利润"
        ]
    },
    "legends": [
        {
            "type": "discrete",
            "visible": true,
            "id": "legend-discrete",
            "orient": "bottom",
            "position": "middle",
            "layoutType": "normal",
            "maxRow": 1,
            "title": {
                "textStyle": {
                    "fontSize": 12,
                    "fill": "#6F6F6F"
                }
            },
            "layoutLevel": 30,
            "item": {
                "focus": true,
                "focusIconStyle": {
                    "size": 14
                },
                "maxWidth": 400,
                "spaceRow": 0,
                "spaceCol": 0,
                "padding": {
                    "top": 1,
                    "bottom": 1,
                    "left": 1,
                    "right": 1
                },
                "background": {
                    "visible": false,
                    "style": {
                        "fillOpacity": 0.001
                    }
                },
                "label": {
                    "style": {
                        "fontSize": 12,
                        "fill": "#6F6F6F"
                    }
                },
                "shape": {
                    "style": {
                        "lineWidth": 0,
                        "symbolType": "square",
                        "size": 10,
                        "fillOpacity": 1
                    }
                }
            },
            "pager": {
                "type": "default",
                "layout": "horizontal",
                "padding": 0,
                "textStyle": {},
                "space": 0,
                "handler": {
                    "preShape": "triangleLeft",
                    "nextShape": "triangleRight",
                    "style": {},
                    "state": {
                        "disable": {}
                    }
                }
            },
            "alignSelf": "start",
            "padding": {
                "top": 16,
                "bottom": 0,
                "left": 0,
                "right": 0
            }
        }
    ],
    "label": {
        "visible": false,
        "offset": 3,
        "overlap": {
            "hideOnHit": true,
            "avoidBaseMark": false,
            "strategy": [
                {
                    "type": "position",
                    "position": []
                }
            ],
            "clampForce": true
        },
        "style": {
            "fontSize": 12,
            "fontWeight": "normal",
            "zIndex": 400,
            "lineHeight": "100%",
            "boundsPadding": [
                1,
                0,
                0,
                0
            ],
            "fill": "#363839",
            "stroke": "rgba(255, 255, 255, 0.8)",
            "lineWidth": 2,
            "strokeOpacity": 1
        },
        "position": "outside",
        "smartInvert": false
    },
    "tooltip": {
        "handler": {}
    },
    "hover": {
        "enable": true
    },
    "select": {
        "enable": true
    },
    "bar": {
        "state": {
            "hover": {
                "cursor": "pointer",
                "fillOpacity": 0.8,
                "stroke": "#58595B",
                "lineWidth": 1,
                "zIndex": 500
            },
            "selected": {
                "cursor": "pointer",
                "fillOpacity": 1,
                "stroke": "#58595B",
                "lineWidth": 1
            },
            "selected_reverse": {
                "fillOpacity": 0.3,
                "lineWidth": 0.3
            }
        },
        "style": {
            "cornerRadius": 0
        }
    },
    "region": [
        {
            "clip": true
        }
    ],
    "background": "rgba(255, 255, 255, 0)",
    "animation": false,
    "brush": {
        "inBrush": {
            "fillOpacity": 1,
            "stroke": "#58595B",
            "lineWidth": 1,
            "strokeOpacity": 1,
            "colorAlpha": 1
        },
        "outOfBrush": {
            "colorAlpha": 0.2,
            "fillOpacity": 0.3,
            "lineWidth": 0.3
        },
        "endTrigger": [
            "pointerup",
            "pointerupoutside"
        ]
    },
    "crosshair": {
        "yField": {
            "visible": true,
            "line": {
                "type": "rect",
                "style": {
                    "fillOpacity": 0.2,
                    "fill": "#b2bacf"
                }
            }
        },
        "gridZIndex": 100
    },
    "hash": "a1fc9f11b63b517f25ee509322421bb5"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants