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] 条形图 x轴zero配置失效. #2226

Closed
youngwinds opened this issue Feb 5, 2024 · 1 comment · Fixed by #2234
Closed

[Bug] 条形图 x轴zero配置失效. #2226

youngwinds opened this issue Feb 5, 2024 · 1 comment · Fixed by #2234
Assignees
Labels
bp bug Something isn't working

Comments

@youngwinds
Copy link
Contributor

x轴 zero 配置失效.

const spec = {
    "type": "bar",
    "xField": [
        "10002"
    ],
    "yField": [
        "240129195712051",
        "10001"
    ],
    "direction": "horizontal",
    "sortDataByAxis": true,
    "seriesField": "20001",
    "padding": 0,
    "labelLayout": "region",
    "data": [
        {
            "id": "data",
            "values": [
                {
                    "10001": "销售额",
                    "10002": "67945.47236633301",
                    "10003": "240129195712034",
                    "20001": "销售额",
                    "240129195712034": "67945.47236633301",
                    "240129195712051": "2019-12-15"
                },
                {
                    "10001": "销售额",
                    "10002": "64472.49899291992",
                    "10003": "240129195712034",
                    "20001": "销售额",
                    "240129195712034": "64472.49899291992",
                    "240129195712051": "2016-05-13"
                },
                {
                    "10001": "销售额",
                    "10002": "62229.83255004883",
                    "10003": "240129195712034",
                    "20001": "销售额",
                    "240129195712034": "62229.83255004883",
                    "240129195712051": "2016-06-23"
                },
                {
                    "10001": "销售额",
                    "10002": "60143.46823120117",
                    "10003": "240129195712034",
                    "20001": "销售额",
                    "240129195712034": "60143.46823120117",
                    "240129195712051": "2017-11-26"
                },
                {
                    "10001": "销售额",
                    "10002": "59793.35633850098",
                    "10003": "240129195712034",
                    "20001": "销售额",
                    "240129195712034": "59793.35633850098",
                    "240129195712051": "2019-05-26"
                },
                {
                    "10001": "销售额",
                    "10002": "57666.2811126709",
                    "10003": "240129195712034",
                    "20001": "销售额",
                    "240129195712034": "57666.2811126709",
                    "240129195712051": "2017-05-17"
                },
                {
                    "10001": "销售额",
                    "10002": "57637.215911865234",
                    "10003": "240129195712034",
                    "20001": "销售额",
                    "240129195712034": "57637.215911865234",
                    "240129195712051": "2017-05-24"
                },
                {
                    "10001": "销售额",
                    "10002": "56853.07646179199",
                    "10003": "240129195712034",
                    "20001": "销售额",
                    "240129195712034": "56853.07646179199",
                    "240129195712051": "2019-07-21"
                },
                {
                    "10001": "销售额",
                    "10002": "56453.403341293335",
                    "10003": "240129195712034",
                    "20001": "销售额",
                    "240129195712034": "56453.403341293335",
                    "240129195712051": "2019-08-05"
                },
                {
                    "10001": "销售额",
                    "10002": "55603.380447387695",
                    "10003": "240129195712034",
                    "20001": "销售额",
                    "240129195712034": "55603.380447387695",
                    "240129195712051": "2019-08-30"
                },
                {
                    "10001": "销售额",
                    "10002": "55394.77934265137",
                    "10003": "240129195712034",
                    "20001": "销售额",
                    "240129195712034": "55394.77934265137",
                    "240129195712051": "2018-12-26"
                },
                {
                    "10001": "销售额",
                    "10002": "55178.22871398926",
                    "10003": "240129195712034",
                    "20001": "销售额",
                    "240129195712034": "55178.22871398926",
                    "240129195712051": "2016-11-25"
                },
                {
                    "10001": "销售额",
                    "10002": "54270.00604248047",
                    "10003": "240129195712034",
                    "20001": "销售额",
                    "240129195712034": "54270.00604248047",
                    "240129195712051": "2018-06-18"
                },
                {
                    "10001": "销售额",
                    "10002": "53944.577003479004",
                    "10003": "240129195712034",
                    "20001": "销售额",
                    "240129195712034": "53944.577003479004",
                    "240129195712051": "2019-05-08"
                },
                {
                    "10001": "销售额",
                    "10002": "52947.748542785645",
                    "10003": "240129195712034",
                    "20001": "销售额",
                    "240129195712034": "52947.748542785645",
                    "240129195712051": "2019-10-23"
                },
                {
                    "10001": "销售额",
                    "10002": "52784.92848968506",
                    "10003": "240129195712034",
                    "20001": "销售额",
                    "240129195712034": "52784.92848968506",
                    "240129195712051": "2018-11-22"
                },
                {
                    "10001": "销售额",
                    "10002": "51852.55563354492",
                    "10003": "240129195712034",
                    "20001": "销售额",
                    "240129195712034": "51852.55563354492",
                    "240129195712051": "2018-06-14"
                },
                {
                    "10001": "销售额",
                    "10002": "50896.64973068237",
                    "10003": "240129195712034",
                    "20001": "销售额",
                    "240129195712034": "50896.64973068237",
                    "240129195712051": "2019-08-25"
                },
                {
                    "10001": "销售额",
                    "10002": "50419.32034301758",
                    "10003": "240129195712034",
                    "20001": "销售额",
                    "240129195712034": "50419.32034301758",
                    "240129195712051": "2017-08-29"
                },
                {
                    "10001": "销售额",
                    "10002": "48955.563385009766",
                    "10003": "240129195712034",
                    "20001": "销售额",
                    "240129195712034": "48955.563385009766",
                    "240129195712051": "2019-12-04"
                },
                {
                    "10001": "销售额",
                    "10002": "48766.48059844971",
                    "10003": "240129195712034",
                    "20001": "销售额",
                    "240129195712034": "48766.48059844971",
                    "240129195712051": "2017-11-22"
                },
                {
                    "10001": "销售额",
                    "10002": "47459.63493347168",
                    "10003": "240129195712034",
                    "20001": "销售额",
                    "240129195712034": "47459.63493347168",
                    "240129195712051": "2018-06-24"
                },
                {
                    "10001": "销售额",
                    "10002": "47166.16131591797",
                    "10003": "240129195712034",
                    "20001": "销售额",
                    "240129195712034": "47166.16131591797",
                    "240129195712051": "2016-09-15"
                },
                {
                    "10001": "销售额",
                    "10002": "46600.53935241699",
                    "10003": "240129195712034",
                    "20001": "销售额",
                    "240129195712034": "46600.53935241699",
                    "240129195712051": "2017-09-21"
                },
                {
                    "10001": "销售额",
                    "10002": "46346.57984542847",
                    "10003": "240129195712034",
                    "20001": "销售额",
                    "240129195712034": "46346.57984542847",
                    "240129195712051": "2019-10-19"
                },
                {
                    "10001": "销售额",
                    "10002": "45215.80058479309",
                    "10003": "240129195712034",
                    "20001": "销售额",
                    "240129195712034": "45215.80058479309",
                    "240129195712051": "2017-08-10"
                },
                {
                    "10001": "销售额",
                    "10002": "45159.66036224365",
                    "10003": "240129195712034",
                    "20001": "销售额",
                    "240129195712034": "45159.66036224365",
                    "240129195712051": "2018-10-12"
                },
                {
                    "10001": "销售额",
                    "10002": "44979.20053100586",
                    "10003": "240129195712034",
                    "20001": "销售额",
                    "240129195712034": "44979.20053100586",
                    "240129195712051": "2018-12-16"
                },
                {
                    "10001": "销售额",
                    "10002": "44976.81964111328",
                    "10003": "240129195712034",
                    "20001": "销售额",
                    "240129195712034": "44976.81964111328",
                    "240129195712051": "2018-11-13"
                },
                {
                    "10001": "销售额",
                    "10002": "44403.422103881836",
                    "10003": "240129195712034",
                    "20001": "销售额",
                    "240129195712034": "44403.422103881836",
                    "240129195712051": "2019-09-17"
                },
                {
                    "10001": "销售额",
                    "10002": "44062.17208099365",
                    "10003": "240129195712034",
                    "20001": "销售额",
                    "240129195712034": "44062.17208099365",
                    "240129195712051": "2019-09-04"
                },
                {
                    "10001": "销售额",
                    "10002": "43703.09975814819",
                    "10003": "240129195712034",
                    "20001": "销售额",
                    "240129195712034": "43703.09975814819",
                    "240129195712051": "2016-09-25"
                },
                {
                    "10001": "销售额",
                    "10002": "43223.711460113525",
                    "10003": "240129195712034",
                    "20001": "销售额",
                    "240129195712034": "43223.711460113525",
                    "240129195712051": "2019-06-13"
                },
                {
                    "10001": "销售额",
                    "10002": "43141.056632995605",
                    "10003": "240129195712034",
                    "20001": "销售额",
                    "240129195712034": "43141.056632995605",
                    "240129195712051": "2017-12-12"
                },
                {
                    "10001": "销售额",
                    "10002": "43082.17283630371",
                    "10003": "240129195712034",
                    "20001": "销售额",
                    "240129195712034": "43082.17283630371",
                    "240129195712051": "2017-09-28"
                },
                {
                    "10001": "销售额",
                    "10002": "43030.62413597107",
                    "10003": "240129195712034",
                    "20001": "销售额",
                    "240129195712034": "43030.62413597107",
                    "240129195712051": "2019-05-21"
                },
                {
                    "10001": "销售额",
                    "10002": "42088.56360244751",
                    "10003": "240129195712034",
                    "20001": "销售额",
                    "240129195712034": "42088.56360244751",
                    "240129195712051": "2019-04-30"
                },
                {
                    "10001": "销售额",
                    "10002": "41914.67081451416",
                    "10003": "240129195712034",
                    "20001": "销售额",
                    "240129195712034": "41914.67081451416",
                    "240129195712051": "2019-04-01"
                },
                {
                    "10001": "销售额",
                    "10002": "41791.31644439697",
                    "10003": "240129195712034",
                    "20001": "销售额",
                    "240129195712034": "41791.31644439697",
                    "240129195712051": "2019-09-11"
                },
                {
                    "10001": "销售额",
                    "10002": "41614.916412353516",
                    "10003": "240129195712034",
                    "20001": "销售额",
                    "240129195712034": "41614.916412353516",
                    "240129195712051": "2019-04-13"
                },
                {
                    "10001": "销售额",
                    "10002": "41519.324588775635",
                    "10003": "240129195712034",
                    "20001": "销售额",
                    "240129195712034": "41519.324588775635",
                    "240129195712051": "2019-05-15"
                },
                {
                    "10001": "销售额",
                    "10002": "41170.835540771484",
                    "10003": "240129195712034",
                    "20001": "销售额",
                    "240129195712034": "41170.835540771484",
                    "240129195712051": "2017-05-15"
                },
                {
                    "10001": "销售额",
                    "10002": "40885.71197891235",
                    "10003": "240129195712034",
                    "20001": "销售额",
                    "240129195712034": "40885.71197891235",
                    "240129195712051": "2018-10-31"
                },
                {
                    "10001": "销售额",
                    "10002": "40670.37717437744",
                    "10003": "240129195712034",
                    "20001": "销售额",
                    "240129195712034": "40670.37717437744",
                    "240129195712051": "2017-06-20"
                },
                {
                    "10001": "销售额",
                    "10002": "40638.275451660156",
                    "10003": "240129195712034",
                    "20001": "销售额",
                    "240129195712034": "40638.275451660156",
                    "240129195712051": "2019-11-06"
                },
                {
                    "10001": "销售额",
                    "10002": "40461.7639503479",
                    "10003": "240129195712034",
                    "20001": "销售额",
                    "240129195712034": "40461.7639503479",
                    "240129195712051": "2018-06-25"
                },
                {
                    "10001": "销售额",
                    "10002": "40424.1319732666",
                    "10003": "240129195712034",
                    "20001": "销售额",
                    "240129195712034": "40424.1319732666",
                    "240129195712051": "2017-06-26"
                },
                {
                    "10001": "销售额",
                    "10002": "39917.80751037598",
                    "10003": "240129195712034",
                    "20001": "销售额",
                    "240129195712034": "39917.80751037598",
                    "240129195712051": "2016-08-20"
                },
                {
                    "10001": "销售额",
                    "10002": "39769.66060638428",
                    "10003": "240129195712034",
                    "20001": "销售额",
                    "240129195712034": "39769.66060638428",
                    "240129195712051": "2019-06-19"
                },
                {
                    "10001": "销售额",
                    "10002": "39735.95463562012",
                    "10003": "240129195712034",
                    "20001": "销售额",
                    "240129195712034": "39735.95463562012",
                    "240129195712051": "2018-10-24"
                }
            ],
            "fields": {
                "10001": {
                    "alias": "指标名称 "
                },
                "10002": {
                    "alias": "指标值 "
                },
                "20001": {
                    "alias": "图例项 ",
                    "domain": [
                        "销售额"
                    ],
                    "sortIndex": 0,
                    "lockStatisticsByDomain": true
                },
                "240129195712034": {
                    "alias": "销售额"
                },
                "240129195712051": {
                    "alias": "订单日期",
                    "domain": [
                        "2016-05-13",
                        "2016-06-23",
                        "2016-08-20",
                        "2016-09-15",
                        "2016-09-25",
                        "2016-11-25",
                        "2017-05-15",
                        "2017-05-17",
                        "2017-05-24",
                        "2017-06-20",
                        "2017-06-26",
                        "2017-08-10",
                        "2017-08-29",
                        "2017-09-21",
                        "2017-09-28",
                        "2017-11-22",
                        "2017-11-26",
                        "2017-12-12",
                        "2018-06-14",
                        "2018-06-18",
                        "2018-06-24",
                        "2018-06-25",
                        "2018-10-12",
                        "2018-10-24",
                        "2018-10-31",
                        "2018-11-13",
                        "2018-11-22",
                        "2018-12-16",
                        "2018-12-26",
                        "2019-04-01",
                        "2019-04-13",
                        "2019-04-30",
                        "2019-05-08",
                        "2019-05-15",
                        "2019-05-21",
                        "2019-05-26",
                        "2019-06-13",
                        "2019-06-19",
                        "2019-07-21",
                        "2019-08-05",
                        "2019-08-25",
                        "2019-08-30",
                        "2019-09-04",
                        "2019-09-11",
                        "2019-09-17",
                        "2019-10-19",
                        "2019-10-23",
                        "2019-11-06",
                        "2019-12-04",
                        "2019-12-15"
                    ],
                    "sortIndex": 0,
                    "lockStatisticsByDomain": true
                }
            }
        }
    ],
    "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,
                "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": "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": -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": false,
            "nice": true
        }
    ],
    "color": {
        "field": "20001",
        "type": "ordinal",
        "range": [
            "#2E62F1"
        ],
        "specified": {},
        "domain": [
            "销售额"
        ]
    },
    "legends": [
        {
            "type": "discrete",
            "visible": true,
            "id": "legend-discrete",
            "orient": "right",
            "position": "start",
            "layoutType": "normal",
            "maxCol": 1,
            "title": {
                "textStyle": {
                    "fontSize": 12,
                    "fill": "#6F6F6F"
                }
            },
            "layoutLevel": 60,
            "item": {
                "focus": true,
                "focusIconStyle": {
                    "size": 14
                },
                "maxWidth": 368,
                "spaceRow": 0,
                "spaceCol": 0,
                "padding": {
                    "top": 1,
                    "bottom": 2,
                    "left": 3,
                    "right": 2
                },
                "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": {
                    "left": -18
                },
                "textStyle": {},
                "space": 0,
                "handler": {
                    "preShape": "triangleLeft",
                    "nextShape": "triangleRight",
                    "style": {},
                    "state": {
                        "disable": {}
                    }
                }
            },
            "padding": {
                "top": 0,
                "bottom": 0,
                "left": 16,
                "right": 0
            }
        }
    ],
    "label": {
        "visible": true,
        "offset": 3,
        "overlap": {
            "hideOnHit": true,
            "avoidBaseMark": false,
            "strategy": [
                {
                    "type": "position",
                    "position": []
                }
            ],
            "clampForce": true
        },
        "style": {
            "fontSize": 12,
            "fontWeight": "normal",
            "zIndex": 400,
            "lineHeight": "100%",
            "fill": null,
            "lineWidth": 0,
            "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,
                "strokeWidth": 0.3
            }
        }
    },
    "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
        }
    },
    "crosshair": {
        "yField": {
            "visible": true,
            "line": {
                "type": "rect",
                "style": {
                    "fillOpacity": 0.2,
                    "fill": "#b2bacf"
                }
            }
        },
        "gridZIndex": 100
    },
    "hash": "35c13da6cb126af1f802d5f7ffb1b818"
}

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

// Just for the convenience of console debugging, DO NOT COPY!
window['vchart'] = vchart;
@youngwinds youngwinds added bug Something isn't working bp labels Feb 5, 2024
@skie1997
Copy link
Contributor

skie1997 commented Feb 5, 2024

img_v3_027p_c3e5ee88-19c3-4206-af3e-469ae562f82g
初步排查: 如果这段逻辑中, xAxis和yAxis用相同的处理方式就能生效
img_v3_027p_5d422de6-cd7f-4c68-853b-471c7ea080eg

@skie1997 skie1997 mentioned this issue Feb 6, 2024
20 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bp bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants