8000 [Bug] 图例配置field字段后报错不绘制 · Issue #2926 · VisActor/VChart · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
[Bug] 图例配置field字段后报错不绘制 #2926
Closed
@skie1997

Description

@skie1997

Version

1.11.8

Link to Minimal Reproduction

vscreen

Steps to Reproduce

const spec = {
    "type": "bar",
    "xField": [
        "HqlYadRdHJ5c",
        "lVJjODjSpsSs"
    ],
    "yField": [
        "10002"
    ],
    "direction": "vertical",
    "sortDataByAxis": true,
    "seriesField": "lVJjODjSpsSs",
    "padding": {
        "left": 6,
        "right": 6,
        "top": 6,
        "bottom": 6
    },
    "labelLayout": "region",
    "data": [
        {
            "id": "data",
            "values": [
                {
                    "10001": "Sales",
                    "10002": 30,
                    "10003": "Tn97A7q0XVDq",
                    "30001": "2023",
                    "HqlYadRdHJ5c": "Labels",
                    "lVJjODjSpsSs": 30,
                    "Tn97A7q0XVDq": 30,
                    "7ti8XuX4kcY1": "2023"
                },
                {
                    "10001": "Sales",
                    "10002": 24,
                    "10003": "Tn97A7q0XVDq",
                    "30001": "2022",
                    "HqlYadRdHJ5c": "Labels",
                    "lVJjODjSpsSs": 24,
                    "Tn97A7q0XVDq": 24,
                    "7ti8XuX4kcY1": "2022"
                },
                {
                    "10001": "Sales",
                    "10002": 20,
                    "10003": "Tn97A7q0XVDq",
                    "30001": "2023",
                    "HqlYadRdHJ5c": "Tables",
                    "lVJjODjSpsSs": 20,
                    "Tn97A7q0XVDq": 20,
                    "7ti8XuX4kcY1": "2023"
                },
                {
                    "10001": "Sales",
                    "10002": 10,
                    "10003": "Tn97A7q0XVDq",
                    "30001": "2022",
                    "HqlYadRdHJ5c": "Tables",
                    "lVJjODjSpsSs": 10,
                    "Tn97A7q0XVDq": 10,
                    "7ti8XuX4kcY1": "2022"
                },
                {
                    "10001": "Sales",
                    "10002": 40,
                    "10003": "Tn97A7q0XVDq",
                    "30001": "2023",
                    "HqlYadRdHJ5c": "Storage",
                    "lVJjODjSpsSs": 40,
                    "Tn97A7q0XVDq": 40,
                    "7ti8XuX4kcY1": "2023"
                },
                {
                    "10001": "Sales",
                    "10002": 20,
                    "10003": "Tn97A7q0XVDq",
                    "30001": "2022",
                    "HqlYadRdHJ5c": "Storage",
                    "lVJjODjSpsSs": 20,
                    "Tn97A7q0XVDq": 20,
                    "7ti8XuX4kcY1": "2022"
                },
                {
                    "10001": "Sales",
                    "10002": 10,
                    "10003": "Tn97A7q0XVDq",
                    "30001": "2023",
                    "HqlYadRdHJ5c": "Furn",
                    "lVJjODjSpsSs": 10,
                    "Tn97A7q0XVDq": 10,
                    "7ti8XuX4kcY1": "2023"
                },
                {
                    "10001": "Sales",
                    "10002": 10,
                    "10003": "Tn97A7q0XVDq",
                    "30001": "2022",
                    "HqlYadRdHJ5c": "Furn",
                    "lVJjODjSpsSs": 10,
                    "Tn97A7q0XVDq": 10,
                    "7ti8XuX4kcY1": "2022"
                },
                {
                    "10001": "Sales",
                    "10002": 50,
                    "10003": "Tn97A7q0XVDq",
                    "30001": "2023",
                    "HqlYadRdHJ5c": "Art",
                    "lVJjODjSpsSs": 50,
                    "Tn97A7q0XVDq": 50,
                    "7ti8XuX4kcY1": "2023"
                },
                {
                    "10001": "Sales",
                    "10002": 30,
                    "10003": "Tn97A7q0XVDq",
                    "30001": "2022",
                    "HqlYadRdHJ5c": "Art",
                    "lVJjODjSpsSs": 30,
                    "Tn97A7q0XVDq": 30,
                    "7ti8XuX4kcY1": "2022"
                }
            ],
            "fields": {
                "10001": {
                    "alias": "指标名称"
                },
                "10002": {
                    "alias": <
F438
span class="pl-s">"指标值"
                },
                "30001": {
                    "alias": "图例项",
                    "domain": [
                        "2023",
                        "2022"
                    ],
                    "sortIndex": 0,
                    "lockStatisticsByDomain": true
                },
                "lVJjODjSpsSs": {
                    "alias": "Sales"
                },
                "HqlYadRdHJ5c": {
                    "alias": "Product",
                    "domain": [
                        "Labels",
                        "Labels",
                        "Tables",
                        "Tables",
                        "Storage",
                        "Storage",
                        "Furn",
                        "Furn",
                        "Art",
                        "Art"
                    ],
                    "sortIndex": 0,
                    "lockStatisticsByDomain": true
                },
                "7ti8XuX4kcY1": {
                    "alias": "Year"
                },
                "Tn97A7q0XVDq": {
                    "alias": "Sales"
                }
            }
        }
    ],
    "stackInverse": true,
    "axes": [
        {
            "type": "band",
            "tick": {
                "style": {
                    "strokeOpacity": 0.2
                },
                "visible": false
            },
            "grid": {
                "visible": false,
                "style": {
                    "zIndex": 150,
                    "stroke": "#FFFFFF",
                    "lineWidth": 1,
                    "lineDash": []
                }
            },
            "orient": "bottom",
            "visible": true,
            "domainLine": {
                "visible": false,
                "style": {
                    "lineWidth": 1,
                    "stroke": "#d5d7e2"
                }
            },
            "title": {
                "visible": false,
                "space": 5,
                "text": "",
                "style": {
                    "fontSize": 12,
                    "fill": "rgba(255,255,255,0.5)",
                    "fontFamily": "D-DIN",
                    "fontWeight": "normal"
                }
            },
            "maxHeight": null,
            "autoIndent": false,
            "sampling": false,
            "zIndex": 200,
            "label": {
                "visible": true,
                "space": 4,
                "style": {
                    "fontSize": 12,
                    "fill": "rgba(255,255,255,0.65)",
                    "angle": 0,
                    "fontFamily": "D-DIN",
                    "fontWeight": "normal",
                    "direction": "horizontal",
                    "maxLineWidth": 174
                },
                "autoHide": true,
                "autoHideMethod": "greedy",
                "flush": true,
                "lastVisible": true,
                "autoHideSeparation": 4
            },
            "hover": true,
            "background": {
                "visible": true,
                "state": {
                    "hover": {
                        "fillOpacity": 0.08,
                        "fill": "#141414"
                    },
                    "hover_reverse": {
                        "fillOpacity": 0.08,
                        "fill": "#141414"
                    }
                }
            },
            "paddingInner": 0.18,
            "paddingOuter": 0.18,
            "ticks": true
        },
        {
            "type": "linear",
            "tick": {
                "size": 4,
                "visible": true,
                "tickMode": "d3"
            },
            "niceType": "rough",
            "zIndex": 200,
            "grid": {
                "visible": true
            },
            "orient": "left",
            "visible": true,
            "domainLine": {
                "visible": false,
                "style": {
                    "lineWidth": 1,
                    "stroke": "#d5d7e2"
                }
            },
            "title": {
                "visible": false,
                "text": "",
                "space": 8,
                "style": {
                    "fontSize": 12,
                    "fill": "rgba(255,255,255,0.5)",
                    "fontFamily": "D-DIN",
                    "fontWeight": "normal"
                }
            },
            "autoIndent": false,
            "sampling": false,
            "label": {
                "visible": true,
                "space": 6,
                "flush": true,
                "padding": 0,
                "style": {
                    "fontSize": 12,
                    "maxLineWidth": 174,
                    "fill": "rgba(255,255,255,0.65)",
                    "angle": 0,
                    "fontFamily": "D-DIN",
                    "fontWeight": "normal",
                    "dy": -1,
                    "direction": "horizontal"
                },
                "autoHide": true,
                "autoHideMethod": "greedy",
                "autoHideSeparation": 4,
                "rotateAngle": [
                    null
                ],
                "labelOverlap": "custom",
                "tighten": false
            },
            "background": {
                "visible": true,
                "state": {
                    "hover": {
                        "fillOpacity": 0.08,
                        "fill": "#141414"
                    },
                    "hover_reverse": {
                        "fillOpacity": 0.08,
                        "fill": "#141414"
                    }
                }
            },
            "innerOffset": {
                "top": 0
            },
            "zero": true,
            "nice": true,
            "paddingInner": 0.18,
            "paddingOuter": 0.18,
            "maxWidth": 180,
            "ticks": true
        },
        {
            "type": "linear",
            "tick": {
                "size": 4,
                "visible": true,
                "tickMode": "d3"
            },
            "niceType": "rough",
            "zIndex": 200,
            "grid": {
                "visible": false
            },
            "orient": "right",
            "visible": true,
            "domainLine": {
                "visible": false
            },
            "title": {
                "visible": false
            },
            "autoIndent": false,
            "sampling": false,
            "label": {
                "visible": true,
                "space": 6,
                "flush": true,
                "padding": 0,
                "style": {
                    "visible": false,
                    "fontSize": 12,
                    "maxLineWidth": 174,
                    "fill": "rgba(255,255,255,0.65)",
                    "angle": 0,
                    "fontFamily": "D-DIN",
                    "fontWeight": "normal",
                    "dy": -1,
                    "direction": "horizontal"
                },
                "autoHide": true,
                "autoHideMethod": "greedy",
                "autoHideSeparation": 4,
                "rotateAngle": [
                    null
                ],
                "labelOverlap": "custom",
                "tighten": false
            },
            "background": {
                "visible": true,
                "state": {
                    "hover": {
                        "fillOpacity": 0.08,
                        "fill": "#141414"
                    },
                    "hover_reverse": {
                        "fillOpacity": 0.08,
                        "fill": "#141414"
                    }
                }
            },
            "innerOffset": {
                "top": 0
            },
            "zero": true,
            "nice": true,
            "paddingInner": 0.18,
            "paddingOuter": 0.18,
            "maxWidth": 180,
            "ticks": true
        }
    ],
    "color": {
        "field": "lVJjODjSpsSs",
        "type": "linear",
        "range": [
            "#05C7D9",
            "#0104FF"
        ],
        "domain": [
            10,
            50
        ]
    },
    "legends": [
        {
            "type": "color",
            "visible": true,
            "slidable": true,
            "title": {
                "0": "S",
                "1": "a",
                "2": "l",
                "3": "e",
                "4": "s",
                "textStyle": {
                    "fontSize": 12,
                    "fill": "rgba(255,255,255,0.45)",
                    "fontFamily": "D-DIN",
                    "fontWeight": "normal"
                },
                "space": 0
            },
            "id": "legend-color",
            "orient": "top",
            "position": "end",
            "layoutType": "normal",
            // "field": [
            //     "lVJjODjSpsSs"
            // ],
            "layoutLevel": 50,
            "maxHeight": 130,
            "rail": {
                "width": 200,
                "height": 4,
                "style": {
                    "fill": "rgba(0,0,0,0.04)"
                }
            },
            "handler": {
                "style": {
                    "shadowBlur": 0,
                    "shadowColor": false,
                    "stroke": "#fff",
                    "lineWidth": 3,
                    "size": 9,
                    "outerBorder": {
                        "distance": 1.5,
                        "lineWidth": 0.5,
                        "stroke": "#cccccc"
                    }
                }
            },
            "align": "left",
            "alignSelf": "end",
            "handlerText": {
                "style": {
                    "maxLineWidth": 200,
                    "fontSize": 12,
                    "fill": "rgba(255,255,255,0.45)",
                    "textAlign": "center",
                    "dx": 0,
                    "fontFamily": "D-DIN",
                    "fontWeight": "normal"
                }
            },
            "startText": {
                "visible": false
            },
            "endText": {
                "visible": false
            },
            "padding": {
                "left": 10,
                "right": 0,
                "top": 0,
                "bottom": 12
            }
        }
    ],
    "label": {
        "visible": false,
        "offset": 3,
        "overlap": {
            "hideOnHit": true,
            "avoidBaseMark": false,
            "strategy": [
                {
                    "type": "position",
                    "position": []
                }
            ],
            "clampForce": true
        },
        "style": {
            "fontSize": 10,
            "fontFamily": "D-DIN",
            "fontWeight": "normal",
            "zIndex": 400,
            "lineHeight": "100%",
            "fill": "rgba(255,255,255,1)",
            "strokeOpacity": 0
        },
        "position": "outside",
        "smartInvert": false,
        "fontWeight": "normal"
    },
    "tooltip": {
        "visible": true,
        "renderMode": "canvas",
        "mark": {
            "visible": true
        },
        "style": {
            "panel": {
                "padding": {
                    "top": 5,
                    "bottom": 10,
                    "left": 10,
                    "right": 10
                },
                "backgroundColor": "rgba(8, 28, 48, 0.95)",
                "border": {
                    "color": "#CFCFCF",
                    "width": 0,
                    "radius": 2
                },
                "shadow": {
                    "x": 0,
                    "y": 4,
                    "blur": 12,
                    "spread": 0,
                    "color": "rgba(0, 0, 0, 0.2)"
                }
            },
            "titleLabel": {
                "fontSize": 14,
                "fontColor": "#FFF",
                "fontWeight": "bold",
                "fontFamily": "D-DIN",
                "align": "left",
                "lineHeight": 18
            },
            "keyLabel": {
                "fontSize": 12,
                "fontColor": "rgba(255,255,255,0.65)",
                "fontWeight": "normal",
                "fontFamily": "SourceHanSansCN-Normal",
                "align": "left",
                "lineHeight": 18
            },
            "valueLabel": {
                "fontSize": 12,
                "fontColor": "#FFF",
                "fontWeight": "normal",
                "fontFamily": "D-DIN",
                "align": "right",
                "lineHeight": 18
            },
            "shape": {
                "size": 10,
                "spacing": 10
            },
            "spaceRow": 10
        },
        "dimension": {
            "visible": true
        }
    },
    "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(0, 0, 0, 1)",
    "animation": false,
    "crosshair": {
        "xField": {
            "visible": true,
            "line": {
                "type": "rect",
                "style": {
                    "fillOpacity": 1,
                    "fill": "rgba(80,156,255,0.1)"
                }
            }
        },
        "gridZIndex": 100,
        "yField": {
            "line": {
                "style": {
                    "fillOpacity": 1,
                    "fill": "rgba(80,156,255,0.1)"
                }
            },
            "visible": false
        }
    },
    "morph": {
        "enable": false
    },
    "fillOpacity": {
        "fillOpacity": 1
    },
    "axesPadding": true,
    "plotLayout": {
        "clip": false
    },
    "barWidth": "40%",
    "barBackground": {
        "fieldLevel": 0,
        "visible": false,
        "interactive": false,
        "style": {
            "cornerRadius": 0,
            "fill": "rgba(255,255,255,1)",
            "fillOpacity": 0.1
        }
    },
    "animationAppear": {
        "bar": {
            "type": "growHeightIn",
            "oneByOne": false,
            "controlOptions": {
                "immediatelyApply": true
            },
            "easing": "circInOut",
            "duration": 1000
        }
    },
    "animationNormal": {
        "bar": [
            {
                "type": "growHeightIn",
                "oneByOne": false,
                "controlOptions": {
                    "immediatelyApply": false
                },
                "startTime": 5000,
                "easing": "circInOut",
                "duration": 1000,
                "delayAfter": 6000,
                "loop": true
            },
            {
                "loop": true,
                "startTime": 5000,
                "delay": 1000,
                "delayAfter": 5000,
                "duration": 1000,
                "easing": "circInOut",
                "customParameters": {
                    "isHorizontal": false,
                    "attribute": {
                        "fill": {
                            "gradient": "linear",
                            "x0": 0,
                            "x1": 6.123233995736766e-17,
                            "y1": 0,
                            "y0": 1,
                            "stops": [
                                {
                                    "offset": 0,
                                    "color": "rgba(255,255,255,0)"
                                },
                                {
                                    "offset": 1,
                                    "color": "rgba(255,255,255,0.3)"
                                }
                            ]
                        },
                        "blur": 0,
                        "shadowColor": "rgba(0,0,0,0)"
                    }
                }
            }
        ]
    },
    "animationEnter": {
        "bar": {
            "easing": "circInOut",
            "duration": 1000
        }
    },
    "animationUpdate": {
        "bar": {
            "easing": "circInOut",
            "duration": 1000
        }
    },
    "animationExit": {},
    "hash": "a2d02843422ebe299315c73823c0059f",
    "width": 400,
    "height": 225
}

Current Behavior

image

Expected Behavior

image

Environment

- OS:
- Browser:
- Framework:

Any additional comments?

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0