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] axis nice domain are incorrect #2050

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

[Bug] axis nice domain are incorrect #2050

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

Comments

@youngwinds
Copy link
Contributor

youngwinds commented Jan 16, 2024

开启nice后, niceDomain值过大.

1.8.7

Image

1.6.7

Image

const spec = {
    "type": "scatter",
    "xField": "231107142804429",
    "yField": "240116192454018",
    "invalidType": "ignore",
    "region": [
        {
            "clip": true
        }
    ],
    "padding": 0,
    "labelLayout": "region",
    "data": [
        {
            "id": "data",
            "values": [
                {
                    "231107142804429": "广东",
                    "231107142804517": "834",
                    "231107142804560": "19.850000239908695",
                    "240116192454018": "1452929.5144729614"
                },
                {
                    "231107142804429": "辽宁",
                    "231107142804517": "686",
                    "231107142804560": "220.0000034570694",
                    "240116192454018": "862569.7392129898"
                },
                {
                    "231107142804429": "贵州",
                    "231107142804517": "82",
                    "231107142804560": "1.2000000178813934",
                    "240116192454018": "108141.60027313232"
                },
                {
                    "231107142804429": "黑龙江",
                    "231107142804517": "636",
                    "231107142804560": "9.350000083446503",
                    "240116192454018": "1178801.1639633179"
                },
                {
                    "231107142804429": "安徽",
                    "231107142804517": "347",
                    "231107142804560": "5.500000059604645",
                    "240116192454018": "628965.1919708252"
                },
                {
                    "231107142804429": "重庆",
                    "231107142804517": "232",
                    "231107142804560": "4.200000062584877",
                    "240116192454018": "361761.9318008423"
                },
                {
                    "231107142804429": "湖北",
                    "231107142804517": "577",
                    "231107142804560": "184.6000028848648",
                    "240116192454018": "621960.3305253983"
                },
                {
                    "231107142804429": "浙江",
                    "231107142804517": "415",
                    "231107142804560": "134.2000021636486",
                    "240116192454018": "452108.242269516"
                },
                {
                    "231107142804429": "陕西",
                    "231107142804517": "236",
                    "231107142804560": "1.600000023841858",
                    "240116192454018": "457688.1689968109"
                },
                {
                    "231107142804429": "甘肃",
                    "231107142804517": "145",
                    "231107142804560": "49.80000078678131",
                    "240116192454018": "179270.02758216858"
                },
                {
                    "231107142804429": "吉林",
                    "231107142804517": "344",
                    "231107142804560": "5.400000050663948",
                    "240116192454018": "640196.5713615417"
                },
                {
                    "231107142804429": "上海",
                    "231107142804517": "292",
                    "231107142804560": "2.0000000298023224",
                    "240116192454018": "582450.5663032532"
                },
                {
                    "231107142804429": "湖南",
                    "231107142804517": "432",
                    "231107142804560": "10.950000144541264",
                    "240116192454018": "723442.2084827423"
                },
                {
                    "231107142804429": "云南",
                    "231107142804517": "166",
                    "231107142804560": "2.600000038743019",
                    "240116192454018": "360925.76978874207"
                },
                {
                    "231107142804429": "福建",
                    "231107142804517": "259",
                    "231107142804560": "1.2000000178813934",
                    "240116192454018": "546903.5310325623"
                },
                {
                    "231107142804429": "内蒙古",
                    "231107142804517": "224",
                    "231107142804560": "68.60000109672546",
                    "240116192454018": "273453.012925148"
                },
                {
                    "231107142804429": "山东",
                    "231107142804517": "914",
                    "231107142804560": "2.8000000417232513",
                    "240116192454018": "1586782.9900550842"
                },
                {
                    "231107142804429": "天津",
                    "231107142804517": "304",
                    "231107142804560": "1.5",
                    "240116192454018": "549906.6289558411"
                },
                {
                    "231107142804429": "北京",
                    "231107142804517": "252",
                    "231107142804560": "0",
                    "240116192454018": "409147.19856643677"
                },
                {
                    "231107142804429": "宁夏",
                    "231107142804517": "38",
                    "231107142804560": "0.800000011920929",
                    "240116192454018": "58121.000633239746"
                },
                {
                    "231107142804429": "新疆",
                    "231107142804517": "38",
                    "231107142804560": "0.800000011920929",
                    "240116192454018": "70097.020778656"
                },
                {
                    "231107142804429": "河北",
                    "231107142804517": "388",
                    "231107142804560": "3",
                    "240116192454018": "790915.4042472839"
                },
                {
                    "231107142804429": "青海",
                    "231107142804517": "21",
                    "231107142804560": "0.4000000059604645",
                    "240116192454018": "49863.379943847656"
                },
                {
                    "231107142804429": "广西",
                    "231107142804517": "219",
                    "231107142804560": "4.500000052154064",
                    "240116192454018": "377653.828125"
                },
                {
                    "231107142804429": "江西",
                    "231107142804517": "139",
                    "231107142804560": "0.800000011920929",
                    "240116192454018": "237328.70012283325"
                },
                {
                    "231107142804429": "山西",
                    "231107142804517": "201",
                    "231107142804560": "1",
                    "240116192454018": "423878.76944351196"
                },
                {
                    "231107142804429": "海南",
                    "231107142804517": "104",
                    "231107142804560": "2.1500000208616257",
                    "240116192454018": "169256.84245681763"
                },
                {
                    "231107142804429": "四川",
                    "231107142804517": "392",
                    "231107142804560": "126.00000196695328",
                    "240116192454018": "400877.59553718567"
                },
                {
                    "231107142804429": "河南",
                    "231107142804517": "454",
                    "231107142804560": "10.300000131130219",
                    "240116192454018": "853574.8028030396"
                },
                {
                    "231107142804429": "西藏自治区",
                    "231107142804517": "10",
                    "231107142804560": "0",
                    "240116192454018": "10015.179809570312"
                },
                {
                    "231107142804429": "江苏",
                    "231107142804517": "578",
                    "231107142804560": "184.6000028848648",
                    "240116192454018": "649967.2204933167"
                }
            ],
            "fields": {
                "231107142804429": {
                    "alias": "省/自治区",
                    "domain": [
                        "安徽",
                        "北京",
                        "重庆",
                        "福建",
                        "甘肃",
                        "广东",
                        "广西",
                        "贵州",
                        "海南",
                        "河北",
                        "河南",
                        "黑龙江",
                        "湖北",
                        "湖南",
                        "吉林",
                        "江苏",
                        "江西",
                        "辽宁",
                        "内蒙古",
                        "宁夏",
                        "青海",
                        "山东",
                        "山西",
                        "陕西",
                        "上海",
                        "四川",
                        "天津",
                        "西藏自治区",
                        "新疆",
                        "云南",
                        "浙江"
                    ],
                    "sortIndex": 0,
                    "lockStatisticsByDomain": true
                },
                "231107142804517": {
                    "alias": "行 ID"
                },
                "231107142804560": {
                    "alias": "折扣"
                },
                "240116192454018": {
                    "alias": "销售额"
                }
            }
        }
    ],
    "axes": [
        {
            "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.36249999999999993,
            "paddingOuter": 0.175
        },
        {
            "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": 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
        }
    ],
    "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",
            "lineWidth": 2,
            "strokeOpacity": 1
        },
        "position": "center"
    },
    "legends": [
        {
            "type": "color",
            "slidable": true,
            "title": {
                "visible": true,
                "text": "折扣",
                "textStyle": {
                    "fontSize": 12,
                    "fill": "#6F6F6F"
                },
                "space": 0
            },
            "visible": true,
            "id": "legend-color",
            "orient": "bottom",
            "position": "middle",
            "layoutType": "normal-inline",
            "field": [
                "231107142804560"
            ],
            "layoutLevel": 50,
            "maxHeight": 130,
            "rail": {
                "width": 200
            },
            "handler": {
                "style": {
                    "shadowBlur": 0,
                    "shadowColor": false,
                    "stroke": "#fff",
                    "lineWidth": 3,
                    "size": 9,
                    "outerBorder": {
                        "distance": 1.5,
                        "lineWidth": 0.5,
                        "stroke": "#cccccc"
                    }
                }
            },
            "align": "left",
            "handlerText": {
                "style": {
                    "maxLineWidth": 200,
                    "fontSize": 12,
                    "fill": "#6F6F6F",
                    "textAlign": "center",
                    "dx": 0
                }
            },
            "startText": {
                "visible": false
            },
            "endText": {
                "visible": false
            },
            "padding": {
                "top": 16,
                "bottom": 0,
                "left": 0,
                "right": 0
            }
        },
        {
            "type": "size",
            "slidable": true,
            "visible": true,
            "title": {
                "visible": true,
                "text": "行 ID",
                "textStyle": {
                    "fontSize": 12,
                    "fill": "#6F6F6F"
                },
                "space": 0
            },
            "handlerText": {
                "style": {
                    "maxLineWidth": 200,
                    "fontSize": 12,
                    "fill": "#6F6F6F",
                    "textAlign": "center",
                    "dx": 0
                }
            },
            "id": "legend-size",
            "orient": "bottom",
            "position": "middle",
            "layoutType": "normal-inline",
            "field": [
                "231107142804517"
            ],
            "layoutLevel": 40,
            "maxHeight": 130,
            "track": {
                "style": {
                    "fill": "rgba(20,20,20,0.1)"
                }
            },
            "rail": {
                "width": 200
            },
            "handler": {
                "style": {
                    "symbolType": "M0,6L-3.5,2.5\n    v-5\n    h7\n    v5\n    Z",
                    "size": 8,
                    "shadowBlur": 0,
                    "shadowColor": false,
                    "outerBorder": {
                        "stroke": "#AEB8C6",
                        "lineWidth": 1,
                        "strokeOpacity": 0.5
                    }
                }
            },
            "align": "left",
            "startText": {
                "visible": false
            },
            "endText": {
                "visible": false
            },
            "padding": {
                "top": 16,
                "bottom": 0,
                "left": 25,
                "right": 0
            }
        }
    ],
    "seriesField": "231107142804560",
    "color": {
        "field": "231107142804560",
        "type": "linear",
        "range": [
            "#000",
            "#000"
        ],
        "domain": [
            {
                "dataId": "data",
                "fields": [
                    "231107142804560"
                ]
            }
        ]
    },
    "sizeField": "231107142804517",
    "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, 255, 0)",
    "hover": {
        "enable": true
    },
    "select": {
        "enable": true
    },
    "animation": false,
    "hash": "09898580da5b2cd4a19c5209ed848d64"
}

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 16, 2024
xile611 added a commit that referenced this issue Jan 18, 2024
fix: fix the bug of nice when tickCount is a function, fix #2050
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