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

[Bug] 2个系列的面积图同时堆叠, 异常. #2210

Closed
youngwinds opened this issue Feb 2, 2024 · 1 comment
Closed

[Bug] 2个系列的面积图同时堆叠, 异常. #2210

youngwinds opened this issue Feb 2, 2024 · 1 comment
Assignees

Comments

@youngwinds
Copy link
Contributor

const spec = {
    "type": "common",
    "region": [
        {
            "clip": true
        }
    ],
    "series": [
        {
            "id": "mainSeries",
            "type": "area",
            "xField": "240202164404028",
            "yField": "10011",
            "zIndex": 200,
            "seriesField": "20001",
            "data": {
                "id": "mainSeriesData",
                "values": [
                    {
                        "10001": "销售额",
                        "10003": "240202164404013",
                        "10011": "2930203",
                        "20001": "销售额",
                        "240202164404013": "2930203",
                        "240202164404028": "2016"
                    },
                    {
                        "10001": "数量",
                        "10003": "240202195429139",
                        "10011": "6710",
                        "20001": "数量",
                        "240202164404028": "2016",
                        "240202195429139": "6710"
                    },
                    {
                        "10001": "销售额",
                        "10003": "240202164404013",
                        "10011": "3430872",
                        "20001": "销售额",
                        "240202164404013": "3430872",
                        "240202164404028": "2017"
                    },
                    {
                        "10001": "数量",
                        "10003": "240202195429139",
                        "10011": "8012",
                        "20001": "数量",
                        "240202164404028": "2017",
                        "240202195429139": "8012"
                    },
                    {
                        "10001": "销售额",
                        "10003": "240202164404013",
                        "10011": "4242253",
                        "20001": "销售额",
                        "240202164404013": "4242253",
                        "240202164404028": "2018"
                    },
                    {
                        "10001": "数量",
                        "10003": "240202195429139",
                        "10011": "9901",
                        "20001": "数量",
                        "240202164404028": "2018",
                        "240202195429139": "9901"
                    },
                    {
                        "10001": "销售额",
                        "10003": "240202164404013",
                        "10011": "5460769",
                        "20001": "销售额",
                        "240202164404013": "5460769",
                        "240202164404028": "2019"
                    },
                    {
                        "10001": "数量",
                        "10003": "240202195429139",
                        "10011": "12911",
                        "20001": "数量",
                        "240202164404028": "2019",
                        "240202195429139": "12911"
                    }
                ],
                "fields": {
                    "10001": {
                        "alias": "指标名称 "
                    },
                    "10011": {
                        "alias": "指标值(主轴) "
                    },
                    "10012": {
                        "alias": "指标值(次轴) "
                    },
                    "20001": {
                        "alias": "图例项 ",
                        "domain": [
                            "销售额",
                            "数量",
                            "利润"
                        ],
                        "sortIndex": 0,
                        "lockStatisticsByDomain": true
                    },
                    "240202164404013": {
                        "alias": "销售额"
                    },
                    "240202164404028": {
                        "alias": "订单日期",
                        "domain": [
                            "2016",
                            "2017",
                            "2018",
                            "2019"
                        ],
                        "sortIndex": 0,
                        "lockStatisticsByDomain": true
                    },
                    "240202195429134": {
                        "alias": "利润"
                    },
                    "240202195429139": {
                        "alias": "数量"
                    }
                }
            },
            "stack": true,
            "stackInverse": true,
            "label": {
                "visible": false,
                "offset": 3,
                "overlap": {
                    "hideOnHit": true,
                    "avoidBaseMark": false,
                    "strategy": [
                        {
                            "type": "position",
                            "position": [
                                "top",
                                "bottom"
                            ]
                        }
                    ],
                    "clampForce": true
                },
                "style": {
                    "fontSize": 12,
                    "fontWeight": "normal",
                    "zIndex": 400,
                    "lineHeight": "100%",
                    "fill": "#363839",
                    "stroke": "rgba(255, 255, 255, 0.8)",
                    "lineWidth": 2,
                    "strokeOpacity": 1
                },
                "position": "top",
                "smartInvert": false
            },
            "line": {
                "style": {
                    "curveType": {
                        "type": "ordinal",
                        "field": "20001",
                        "range": [
                            "linear"
                        ],
                        "domain": [
                            "销售额",
                            "数量",
                            "利润"
                        ]
                    },
                    "lineWidth": {
                        "type": "ordinal",
                        "field": "20001",
                        "range": [
                            3
                        ],
                        "domain": [
                            "销售额",
                            "数量",
                            "利润"
                        ]
                    },
                    "lineDash": {
                        "type": "ordinal",
                        "field": "20001",
                        "range": [
                            [
                                0,
                                0
                            ]
                        ],
                        "domain": [
                            "销售额",
                            "数量",
                            "利润"
                        ]
                    }
                }
            },
            "area": {
                "style": {
                    "fillOpacity": 0.35
                },
                "visible": true
            },
            "point": {
                "style": {
                    "shape": {
                        "type": "ordinal",
                        "field": "20001",
                        "range": [
                            "circle"
                        ],
                        "domain": [
                            "销售额",
                            "数量",
                            "利润"
                        ]
                    },
                    "size": {
                        "type": "ordinal",
                        "field": "20001",
                        "range": [
                            7.0898154036220635
                        ],
                        "domain": [
                            "销售额",
                            "数量",
                            "利润"
                        ]
                    },
                    "stroke": {
                        "field": "20001",
                        "type": "ordinal",
                        "range": [
                            "#2E62F1",
                            "#4DC36A",
                            "#FF8406"
                        ],
                        "specified": {},
                        "domain": [
                            "销售额",
                            "数量",
                            "利润"
                        ]
                    },
                    "strokeOpacity": {
                        "type": "ordinal",
                        "field": "20001",
                        "range": [
                            1
                        ],
                        "domain": [
                            "销售额",
                            "数量",
                            "利润"
                        ]
                    },
                    "fillOpacity": {
                        "type": "ordinal",
                        "field": "20001",
                        "range": [
                            1
                        ],
                        "domain": [
                            "销售额",
                            "数量",
                            "利润"
                        ]
                    }
                },
                "state": {
                    "hover": {
                        "lineWidth": 2,
                        "fillOpacity": 1,
                        "strokeOpacity": 1,
                        "scaleX": 1.5,
                        "scaleY": 1.5
                    }
                }
            },
            "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,
                        "strokeWidth": 0.3
                    }
                }
            },
            "invalidType": "break",
            "seriesMark": "line",
            "markOverlap": true,
            "region": [
                {
                    "clip": true
                }
            ],
            "background": "rgba(255, 255, 255, 0)",
            "animation": false
        },
        {
            "id": "subSeries",
            "type": "area",
            "xField": "240202164404028",
            "yField": "10012",
            "zIndex": 300,
            "seriesField": "20001",
            "data": {
                "id": "subSeriesData",
                "values": [
                    {
                        "10001": "利润",
                        "10003": "240202195429134",
                        "10012": "373011.27633811533",
                        "20001": "利润",
                        "240202164404028": "2016",
                        "240202195429134": "373011.27633811533"
                    },
                    {
                        "10001": "利润",
                        "10003": "240202195429134",
                        "10012": "471470.2235544026",
                        "20001": "利润",
                        "240202164404028": "2017",
                        "240202195429134": "471470.2235544026"
                    },
                    {
                        "10001": "利润",
                        "10003": "240202195429134",
                        "10012": "621943.0008896366",
                        "20001": "利润",
                        "240202164404028": "2018",
                        "240202195429134": "621943.0008896366"
                    },
                    {
                        "10001": "利润",
                        "10003": "240202195429134",
                        "10012": "681114.4263460711",
                        "20001": "利润",
                        "240202164404028": "2019",
                        "240202195429134": "681114.4263460711"
                    }
                ],
                "fields": {
                    "10001": {
                        "alias": "指标名称 "
                    },
                    "10011": {
                        "alias": "指标值(主轴) "
                    },
                    "10012": {
                        "alias": "指标值(次轴) "
                    },
                    "20001": {
                        "alias": "图例项 ",
                        "domain": [
                            "销售额",
                            "数量",
                            "利润"
                        ],
                        "sortIndex": 0,
                        "lockStatisticsByDomain": true
                    },
                    "240202164404013": {
                        "alias": "销售额"
                    },
                    "240202164404028": {
                        "alias": "订单日期",
                        "domain": [
                            "2016",
                            "2017",
                            "2018",
                            "2019"
                        ],
                        "sortIndex": 0,
                        "lockStatisticsByDomain": true
                    },
                    "240202195429134": {
                        "alias": "利润"
                    },
                    "240202195429139": {
                        "alias": "数量"
                    }
                }
            },
            "stackInverse": true,
            "label": {
                "visible": false,
                "offset": 3,
                "overlap": {
                    "hideOnHit": true,
                    "avoidBaseMark": false,
                    "strategy": [
                        {
                            "type": "position",
                            "position": [
                                "top",
                                "bottom"
                            ]
                        }
                    ],
                    "clampForce": true
                },
                "style": {
                    "fontSize": 12,
                    "fontWeight": "normal",
                    "zIndex": 400,
                    "lineHeight": "100%",
                    "fill": "#363839",
                    "stroke": "rgba(255, 255, 255, 0.8)",
                    "lineWidth": 2,
                    "strokeOpacity": 1
                },
                "position": "top",
                "smartInvert": false
            },
            "line": {
                "style": {
                    "curveType": {
                        "type": "ordinal",
                        "field": "20001",
                        "range": [
                            "linear"
                        ],
                        "domain": [
                            "销售额",
                            "数量",
                            "利润"
                        ]
                    },
                    "lineWidth": {
                        "type": "ordinal",
                        "field": "20001",
                        "range": [
                            3
                        ],
                        "domain": [
                            "销售额",
                            "数量",
                            "利润"
                        ]
                    },
                    "lineDash": {
                        "type": "ordinal",
                        "field": "20001",
                        "range": [
                            [
                                0,
                                0
                            ]
                        ],
                        "domain": [
                            "销售额",
                            "数量",
                            "利润"
                        ]
                    }
                }
            },
            "area": {
                "style": {
                    "fillOpacity": 0.35
                },
                "visible": true
            },
            "point": {
                "style": {
                    "shape": {
                        "type": "ordinal",
                        "field": "20001",
                        "range": [
                            "circle"
                        ],
                        "domain": [
                            "销售额",
                            "数量",
                            "利润"
                        ]
                    },
                    "size": {
                        "type": "ordinal",
                        "field": "20001",
                        "range": [
                            7.0898154036220635
                        ],
                        "domain": [
                            "销售额",
                            "数量",
                            "利润"
                        ]
                    },
                    "stroke": {
                        "field": "20001",
                        "type": "ordinal",
                        "range": [
                            "#2E62F1",
                            "#4DC36A",
                            "#FF8406"
                        ],
                        "specified": {},
                        "domain": [
                            "销售额",
                            "数量",
                            "利润"
                        ]
                    },
                    "strokeOpacity": {
                        "type": "ordinal",
                        "field": "20001",
                        "range": [
                            1
                        ],
                        "domain": [
                            "销售额",
                            "数量",
                            "利润"
                        ]
                    },
                    "fillOpacity": {
                        "type": "ordinal",
                        "field": "20001",
                        "range": [
                            1
                        ],
                        "domain": [
                            "销售额",
                            "数量",
                            "利润"
                        ]
                    }
                },
                "state": {
                    "hover": {
                        "lineWidth": 2,
                        "fillOpacity": 1,
                        "strokeOpacity": 1,
                        "scaleX": 1.5,
                        "scaleY": 1.5
                    }
                }
            },
            "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,
                        "strokeWidth": 0.3
                    }
                }
            },
            "invalidType": "break",
            "seriesMark": "line",
            "markOverlap": true,
            "region": [
                {
                    "clip": true
                }
            ],
            "background": "rgba(255, 255, 255, 0)",
            "animation": false
        }
    ],
    "padding": 0,
    "labelLayout": "region",
    "data": [
        {
            "id": "data",
            "values": [
                {
                    "10001": "销售额",
                    "10003": "240202164404013",
                    "10011": "2930203",
                    "20001": "销售额",
                    "240202164404013": "2930203",
                    "240202164404028": "2016"
                },
                {
                    "10001": "数量",
                    "10003": "240202195429139",
                    "10011": "6710",
                    "20001": "数量",
                    "240202164404028": "2016",
                    "240202195429139": "6710"
                },
                {
                    "10001": "销售额",
                    "10003": "240202164404013",
                    "10011": "3430872",
                    "20001": "销售额",
                    "240202164404013": "3430872",
                    "240202164404028": "2017"
                },
                {
                    "10001": "数量",
                    "10003": "240202195429139",
                    "10011": "8012",
                    "20001": "数量",
                    "240202164404028": "2017",
                    "240202195429139": "8012"
                },
                {
                    "10001": "销售额",
                    "10003": "240202164404013",
                    "10011": "4242253",
                    "20001": "销售额",
                    "240202164404013": "4242253",
                    "240202164404028": "2018"
                },
                {
                    "10001": "数量",
                    "10003": "240202195429139",
                    "10011": "9901",
                    "20001": "数量",
                    "240202164404028": "2018",
                    "240202195429139": "9901"
                },
                {
                    "10001": "销售额",
                    "10003": "240202164404013",
                    "10011": "5460769",
                    "20001": "销售额",
                    "240202164404013": "5460769",
                    "240202164404028": "2019"
                },
                {
                    "10001": "数量",
                    "10003": "240202195429139",
                    "10011": "12911",
                    "20001": "数量",
                    "240202164404028": "2019",
                    "240202195429139": "12911"
                },
                {
                    "10001": "利润",
                    "10003": "240202195429134",
                    "10012": "373011.27633811533",
                    "20001": "利润",
                    "240202164404028": "2016",
                    "240202195429134": "373011.27633811533"
                },
                {
                    "10001": "利润",
                    "10003": "240202195429134",
                    "10012": "471470.2235544026",
                    "20001": "利润",
                    "240202164404028": "2017",
                    "240202195429134": "471470.2235544026"
                },
                {
                    "10001": "利润",
                    "10003": "240202195429134",
                    "10012": "621943.0008896366",
                    "20001": "利润",
                    "240202164404028": "2018",
                    "240202195429134": "621943.0008896366"
                },
                {
                    "10001": "利润",
                    "10003": "240202195429134",
                    "10012": "681114.4263460711",
                    "20001": "利润",
                    "240202164404028": "2019",
                    "240202195429134": "681114.4263460711"
                }
            ],
            "fields": {
                "10001": {
                    "alias": "指标名称 "
                },
                "10011": {
                    "alias": "指标值(主轴) "
                },
                "10012": {
                    "alias": "指标值(次轴) "
                },
                "20001": {
                    "alias": "图例项 ",
                    "domain": [
                        "销售额",
                        "数量",
                        "利润"
                    ],
                    "sortIndex": 0,
                    "lockStatisticsByDomain": true
                },
                "240202164404013": {
                    "alias": "销售额"
                },
                "240202164404028": {
                    "alias": "订单日期",
                    "domain": [
                        "2016",
                        "2017",
                        "2018",
                        "2019"
                    ],
                    "sortIndex": 0,
                    "lockStatisticsByDomain": true
                },
                "240202195429134": {
                    "alias": "利润"
                },
                "240202195429139": {
                    "alias": "数量"
                }
            }
        }
    ],
    "stackInverse": true,
    "axes": [
        {
            "id": "dimensionAxis",
            "type": "band",
            "tick": {
                "visible": false
            },
            "grid": {
                "visible": false,
                "style": {
                    "zIndex": 150,
                    "stroke": "#DADCDD",
                    "lineWidth": 1,
                    "lineDash": [
                        4,
                        2
                    ]
                }
            },
            "orient": "bottom",
            "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": 4,
                "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
            ]
        },
        {
            "id": "measureAxisLeft",
            "type": "linear",
            "tick": {
                "visible": false,
                "tickMode": "d3",
                "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": "left",
            "visible": true,
            "domainLine": {
                "visible": true,
                "style": {
                    "lineWidth": 1,
                    "stroke": "rgba(255, 255, 255, 0)"
                }
            },
            "title": {
                "visible": true,
                "text": "销售额 & 数量",
                "space": 8,
                "style": {
                    "fontSize": 12,
                    "fill": "#363839",
                    "fontWeight": "normal"
                }
            },
            "autoIndent": false,
            "sampling": false,
            "label": {
                "visible": true,
                "space": 6,
                "flush": true,
                "padding": 0,
                "style": {
                    "fontSize": 12,
                    "maxLineWidth": 174,
                    "fill": "#6F6F6F",
                    "angle": 0,
                    "fontWeight": "normal",
                    "dy": -1,
                    "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,
            "seriesId": "mainSeries"
        },
        {
            "id": "measureAxisRight",
            "type": "linear",
            "tick": {
                "visible": false,
                "tickMode": "d3",
                "style": {
                    "stroke": "rgba(255, 255, 255, 0)"
                }
            },
            "niceType": "accurateFirst",
            "zIndex": 200,
            "grid": {
                "visible": false,
                "style": {
                    "zIndex": 150,
                    "stroke": "#DADCDD",
                    "lineWidth": 1,
                    "lineDash": [
                        4,
                        2
                    ]
                }
            },
            "orient": "right",
            "visible": true,
            "domainLine": {
                "visible": true,
                "style": {
                    "lineWidth": 1,
                    "stroke": "rgba(255, 255, 255, 0)"
                }
            },
            "title": {
                "visible": true,
                "text": "利润",
                "space": 8,
                "style": {
                    "fontSize": 12,
                    "fill": "#363839",
                    "fontWeight": "normal"
                }
            },
            "autoIndent": false,
            "sampling": false,
            "label": {
                "visible": true,
                "space": 6,
                "flush": true,
                "padding": 0,
                "style": {
                    "fontSize": 12,
                    "maxLineWidth": 174,
                    "fill": "#6F6F6F",
                    "angle": 0,
                    "fontWeight": "normal",
                    "dy": -1,
                    "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,
            "seriesId": "subSeries",
            "sync": {
                "axisId": "measureAxisLeft",
                "zeroAlign": true
            }
        }
    ],
    "seriesField": "20001",
    "color": {
        "field": "20001",
        "type": "ordinal",
        "range": [
            "#2E62F1",
            "#4DC36A",
            "#FF8406"
        ],
        "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": {
                "layout": "horizontal",
                "padding": 0,
                "textStyle": {},
                "space": 0,
                "handler": {
                    "preShape": "triangleLeft",
                    "nextShape": "triangleRight",
                    "style": {},
                    "state": {
                        "disable": {}
                    }
                }
            },
            "padding": {
                "top": 16,
                "bottom": 0,
                "left": 0,
                "right": 0
            }
        }
    ],
    "tooltip": {
        "handler": {}
    },
    "crosshair": {
        "xField": {
            "visible": true,
            "line": {
                "type": "rect",
                "style": {
                    "fillOpacity": 0.2,
                    "fill": "#b2bacf"
                }
            }
        },
        "gridZIndex": 100
    },
    "background": "rgba(255, 255, 255, 0)",
    "brush": {
        "inBrush": {
            "fillOpacity": 1,
            "strokeOpacity": 1,
            "colorAlpha": 1
        },
        "outOfBrush": {
            "colorAlpha": 0.2,
            "fillOpacity": 0.3
        }
    },
    "hash": "a7a438e49be26cb707d46ef9467a1583"
}

const vchart = new VChart(spec, { dom: CONTAINER_ID });
vchart.renderSync();

// Just for the convenience of console debugging, DO NOT COPY!
window['vchart'] = vchart;
@xile611
Copy link
Contributor

xile611 commented Feb 22, 2024

fixed in #2213

@xile611 xile611 closed this as completed Feb 22, 2024
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

2 participants