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] 图例高度有小数点时, 会有空白 #2075

Closed
youngwinds opened this issue Jan 18, 2024 · 0 comments
Closed

[Bug] 图例高度有小数点时, 会有空白 #2075

youngwinds opened this issue Jan 18, 2024 · 0 comments
Assignees
Labels
bp bug Something isn't working

Comments

@youngwinds
Copy link
Contributor

youngwinds commented Jan 18, 2024

正常120

Image

错误120.1

Image

const spec = {
    width: 553, 
    height: 120,
    "type": "scatter",
    "xField": "231114203244032",
    "yField": "231114203244035",
    "invalidType": "ignore",
    "region": [
        {
            "clip": true
        }
    ],
    "padding": 0,
    "labelLayout": "region",
    "data": [
        {
            "id": "data",
            "values": [
                {
                    "30001": "二级",
                    "231114203244032": "901075",
                    "231114203244035": "1976",
                    "231114203244038": "二级",
                    "231114203244046": "126696.42283797264",
                    "240118181846021": "中南"
                },
                {
                    "30001": "二级",
                    "231114203244032": "259587",
                    "231114203244035": "464",
                    "231114203244038": "二级",
                    "231114203244046": "15753.807992637157",
                    "240118181846021": "西北"
                },
                {
                    "30001": "二级",
                    "231114203244032": "598431",
                    "231114203244035": "1490",
                    "231114203244038": "二级",
                    "231114203244046": "81022.12239571661",
                    "240118181846021": "东北"
                },
                {
                    "30001": "二级",
                    "231114203244032": "292023",
                    "231114203244035": "805",
                    "231114203244038": "二级",
                    "231114203244046": "14276.892123937607",
                    "240118181846021": "西南"
                },
                {
                    "30001": "标准级",
                    "231114203244032": "2308352",
                    "231114203244035": "5656",
                    "231114203244038": "标准级",
                    "231114203244046": "405503.38612772524",
                    "240118181846021": "中南"
                },
                {
                    "30001": "当日",
                    "231114203244032": "283410",
                    "231114203244035": "631",
                    "231114203244038": "当日",
                    "231114203244046": "48522.34814107418",
                    "240118181846021": "华东"
                },
                {
                    "30001": "一级",
                    "231114203244032": "318898",
                    "231114203244035": "648",
                    "231114203244038": "一级",
                    "231114203244046": "39590.215101480484",
                    "240118181846021": "华北"
                },
                {
                    "30001": "一级",
                    "231114203244032": "805574",
                    "231114203244035": "1893",
                    "231114203244038": "一级",
                    "231114203244046": "96535.90787857771",
                    "240118181846021": "华东"
                },
                {
                    "30001": "标准级",
                    "231114203244032": "1646783",
                    "231114203244035": "3882",
                    "231114203244038": "标准级",
                    "231114203244046": "136186.47037018836",
                    "240118181846021": "东北"
                },
                {
                    "30001": "当日",
                    "231114203244032": "121778",
                    "231114203244035": "236",
                    "231114203244038": "当日",
                    "231114203244046": "25848.84389448166",
                    "240118181846021": "华北"
                },
                {
                    "30001": "当日",
                    "231114203244032": "31018",
                    "231114203244035": "61",
                    "231114203244038": "当日",
                    "231114203244046": "8796.479988574982",
                    "240118181846021": "西北"
                },
                {
                    "30001": "标准级",
                    "231114203244032": "765964",
                    "231114203244035": "2020",
                    "231114203244038": "标准级",
                    "231114203244046": "64211.812408313155",
                    "240118181846021": "西南"
                },
                {
                    "30001": "一级",
                    "231114203244032": "62318",
                    "231114203244035": "220",
                    "231114203244038": "一级",
                    "231114203244046": "8545.179933540523",
                    "240118181846021": "西北"
                },
                {
                    "30001": "一级",
                    "231114203244032": "646982",
                    "231114203244035": "1501",
                    "231114203244038": "一级",
                    "231114203244046": "93077.6283235848",
                    "240118181846021": "中南"
                },
                {
                    "30001": "当日",
                    "231114203244032": "279732",
                    "231114203244035": "567",
                    "231114203244038": "当日",
                    "231114203244046": "45607.87652890384",
                    "240118181846021": "中南"
                },
                {
                    "30001": "标准级",
                    "231114203244032": "2689619",
                    "231114203244035": "6296",
                    "231114203244038": "标准级",
                    "231114203244046": "317412.48034618795",
                    "240118181846021": "华东"
                },
                {
                    "30001": "二级",
                    "231114203244032": "904484",
                    "231114203244035": "2221",
                    "231114203244038": "二级",
                    "231114203244046": "144747.94667682052",
                    "240118181846021": "华东"
                },
                {
                    "30001": "二级",
                    "231114203244032": "542105",
                    "231114203244035": "1228",
                    "231114203244038": "二级",
                    "231114203244046": "93391.96335756779",
                    "240118181846021": "华北"
                },
                {
                    "30001": "一级",
                    "231114203244032": "214335",
                    "231114203244035": "468",
                    "231114203244038": "一级",
                    "231114203244046": "20434.48344002664",
                    "240118181846021": "西南"
                },
                {
                    "30001": "当日",
                    "231114203244032": "80969",
                    "231114203244035": "239",
                    "231114203244038": "当日",
                    "231114203244046": "6885.221200786531",
                    "240118181846021": "东北"
                },
                {
                    "30001": "标准级",
                    "231114203244032": "1463851",
                    "231114203244035": "3034",
                    "231114203244038": "标准级",
                    "231114203244046": "272222.1951389015",
                    "240118181846021": "华北"
                },
                {
                    "30001": "标准级",
                    "231114203244032": "461894",
                    "231114203244035": "1040",
                    "231114203244038": "标准级",
                    "231114203244046": "65458.007603399456",
                    "240118181846021": "西北"
                },
                {
                    "30001": "一级",
                    "231114203244032": "354567",
                    "231114203244035": "852",
                    "231114203244038": "一级",
                    "231114203244046": "18097.695254683495",
                    "240118181846021": "东北"
                },
                {
                    "30001": "当日",
                    "231114203244032": "30348",
                    "231114203244035": "106",
                    "231114203244038": "当日",
                    "231114203244046": "-1286.4599368572235",
                    "240118181846021": "西南"
                }
            ],
            "fields": {
                "30001": {
                    "alias": "图例项 "
                },
                "231114203244032": {
                    "alias": "销售额"
                },
                "231114203244035": {
                    "alias": "数量"
                },
                "231114203244038": {
                    "alias": "邮寄方式"
                },
                "231114203244046": {
                    "alias": "利润"
                },
                "240118181846021": {
                    "alias": "地区",
                    "domain": [
                        "中南",
                        "西北",
                        "东北",
                        "西南",
                        "华东",
                        "华北"
                    ],
                    "sortIndex": 0
                }
            }
        }
    ],
    "axes": [
        {
            "type": "linear",
            "tick": {
                "visible": false,
                "tickMode": "d3",
                "style": {
                    "stroke": "#8D8D8D"
                }
            },
            "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": "#8D8D8D"
                }
            },
            "title": {
                "visible": false,
                "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
        },
        {
            "type": "linear",
            "tick": {
                "visible": false,
                "tickMode": "d3",
                "style": {
                    "stroke": "#8D8D8D"
                }
            },
            "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": "#8D8D8D"
                }
            },
            "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": true,
            "nice": true
        }
    ],
    "label": {
        "visible": false,
        "offset": 6,
        "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"
    },
    "legends": [
        {
            "type": "discrete",
            "visible": true,
            "id": "legend-discrete",
            "orient": "right",
            "position": "start",
            "layoutType": "normal-inline",
            "maxCol": 1,
            "title": {
                "textStyle": {
                    "fontSize": 12,
                    "fill": "#6F6F6F"
                }
            },
            "layoutLevel": 60,
            "item": {
                "focus": true,
                "focusIconStyle": {
                    "size": 14
                },
                "maxWidth": 267,
                "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": 12,
                "left": 16,
                "right": 0
            }
        },
        {
            "type": "size",
            "slidable": true,
            "visible": true,
            "title": {
                "visible": true,
                "text": "利润",
                "textStyle": {
                    "fontSize": 12,
                    "fill": "#6F6F6F"
                },
                "space": 0
            },
            "handlerText": {
                "style": {
                    "maxLineWidth": 50,
                    "fontSize": 12,
                    "fill": "#6F6F6F",
                    "textAlign": "start"
                }
            },
            "id": "legend-size",
            "orient": "right",
            "position": "start",
            "layoutType": "normal-inline",
            "field": [
                "231114203244046"
            ],
            "layoutLevel": 50,
            "maxHeight": 130,
            "track": {
                "style": {
                    "fill": "rgba(20,20,20,0.1)"
                }
            },
            "rail": {
                "height": 100
            },
            "handler": {
                "style": {
                    "symbolType": "M-5,0L-2.5,-3.5\n    h5\n    v7\n    h-5\n    Z",
                    "size": 8,
                    "shadowBlur": 0,
                    "shadowColor": false,
                    "outerBorder": {
                        "stroke": "#AEB8C6",
                        "lineWidth": 1,
                        "strokeOpacity": 0.5
                    }
                }
            },
            "startText": {
                "visible": false
            },
            "endText": {
                "visible": false
            },
            "padding": {
                "top": 0,
                "bottom": 12,
                "left": 16,
                "right": 0
            }
        }
    ],
    "seriesField": "240118181846021",
    "color": {
        "field": "240118181846021",
        "type": "ordinal",
        "range": [
            "#2E62F1",
            "#4DC36A",
            "#FF8406",
            "#FFCC00",
            "#4F44CF",
            "#5AC8FA"
        ],
        "specified": {},
        "domain": [
            "中南",
            "西北",
            "东北",
            "西南",
            "华东",
            "华北"
        ]
    },
    "sizeField": "231114203244046",
    "size": {
        "type": "linear",
        "range": [
            7.0898154036220635,
            28.359261614488254
        ]
    },
    "tooltip": {
        "handler": {}
    },
    "point": {
        "state": {
            "hover": {
                "cursor": "pointer",
                "fillOpacity": 0.8,
                "stroke": "#58595B",
                "lineWidth": 1,
                "zIndex": 500
            }
        }
    },
    "background": "rgba(255, 255, 15, 0.5)",
    "hover": {
        "enable": true
    },
    "select": {
        "enable": true
    },
    "animation": false,
    "brush": {
        "inBrush": {
            "fillOpacity": 1,
            "stroke": "#58595B",
            "lineWidth": 1,
            "strokeOpacity": 1,
            "colorAlpha": 1
        },
        "outOfBrush": {
            "colorAlpha": 0.2,
            "fillOpacity": 0.3,
            "strokeWidth": 0.3
        }
    },
    "hash": "2813c2c1d405b3c4046be2e3998d0da6"
}

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

// Just for the convenience of console debugging, DO NOT COPY!
window['vchart'] = vchart;
@youngwinds youngwinds added bug Something isn't working bp labels Jan 18, 2024
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

No branches or pull requests

2 participants