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] The precision issue of stack data calculation in waterfall chart. #721

Closed
xiaoluoHe opened this issue Aug 31, 2023 · 0 comments · Fixed by #844
Closed

[Bug] The precision issue of stack data calculation in waterfall chart. #721

xiaoluoHe opened this issue Aug 31, 2023 · 0 comments · Fixed by #844
Assignees
Labels
bug Something isn't working online biz
Milestone

Comments

@xiaoluoHe
Copy link
Contributor

Version

1.2.0

Link to Minimal Reproduction

none

Steps to Reproduce

const spec = {
    "type": "waterfall",
    "theme": {
        "background": "rgba(0,0,0,0)"
    },
    "color": [
        "#f76964",
        "#34c724",
        "#3370ff"
    ],
    "animation": false,
    "padding": 0,
    "data": {
        "id": "waterfallData",
        "values": [
            {
                "x": "张三",
                "y": 34,
                "abf71c0e-c5f9-461c-b000-dc22970f45b5-originData": "张三"
            },
            {
                "x": "王武",
                "y": -22.12,
                "abf71c0e-c5f9-461c-b000-dc22970f45b5-originData": "王武"
            },
            {
                "x": "赵六",
                "y": 23,
                "abf71c0e-c5f9-461c-b000-dc22970f45b5-originData": "赵六"
            },
            {
                "x": "(空)",
                "y": null,
                "abf71c0e-c5f9-461c-b000-dc22970f45b5-originData": null
            }
        ]
    },
    "height": 312,
    "width": 500,
    "barMaxWidth": 48,
    "barMinWidth": 8,
    "xField": "x",
    "yField": "y",
    "legends": {
        "visible": true,
        "interactive": true,
        "orient": "bottom",
        "position": "middle",
        "padding": {
            "top": 12
        },
        "maxRow": 1,
        "pager": {
            "padding": 0,
            "space": 0,
            "animation": false,
            "handler": {
                "space": 4,
                "preShape": "",
                "nextShape": "",
                "style": {
                    "fill": "#8F959E",
                    "size": 7
                },
                "state": {
                    "hover": {
                        "fill": "#336DF4"
                    },
                    "disable": {
                        "fill": "#BBBFC4"
                    }
                }
            },
            "textStyle": {
                "fill": "#8F959E",
                "fontSize": 12,
                "lineHeight": 20
            }
        },
        "item": {
            "spaceCol": 16,
            "spaceRow": 4,
            "background": {
                "visible": false
            },
            "label": {
                "style": {
                    "fontSize": 12,
                    "lineHeight": 20,
                    "maxLineWidth": 102.96000000000001,
                    "fill": "#646A73"
                }
            },
            "shape": {
                "space": 2,
                "style": {
                    "symbolType": "circle",
                    "size": 8
                }
            }
        }
    },
    "crosshair": {
        "trigger": "hover"
    },
    "bar": {
        "style": {
            "cornerRadius": [
                2,
                2,
                0,
                0
            ],
            "cursor": "pointer"
        },
        "state": {
            "hover": {
                "stroke": "#3370FF",
                "lineWidth": 1
            }
        }
    },
    "region": [
        {
            "style": {
                "cursor": "pointer"
            }
        }
    ],
    "axes": [
        {
            "orient": "left",
            "expand": {
                "max": 0.2
            },
            "title": {
                "text": "浮点数",
                "visible": true,
                "style": {
                    "fill": "#646A73",
                    "fontSize": 12,
                    "lineHeight": 20,
                    "maxLineWidth": 234
                },
                "space": 8
            },
            "label": {
                "visible": true,
                "space": 8,
                "style": {
                    "fill": "#646A73",
                    "fontSize": 12,
                    "lineHeight": 20,
                    "maxLineWidth": 165
                }
            },
            "grid": {
                "style": {
                    "lineDash": [
                        3,
                        3
                    ]
                }
            }
        },
        {
            "orient": "bottom",
            "sampling": false,
            "title": {
                "text": "文本",
                "visible": false,
                "style": {
                    "fill": "#646A73",
                    "fontSize": 12,
                    "lineHeight": 20,
                    "maxLineWidth": 335
                },
                "space": 4
            },
            "label": {
                "visible": true,
                "autoRotate": true,
                "autoHide": false,
                "autoRotateAngle": [
                    0,
                    45
                ],
                "space": 6,
                "style": {
                    "fill": "#646A73",
                    "fontSize": 12,
                    "lineHeight": 20,
                    "maxLineWidth": 202.8
                }
            }
        }
    ],
    "total": {},
    "tooltip": {
        "visible": true,
        "mark": {
            "content": {
                "shapeType": "circle"
            }
        },
        "dimension": {
            "content": {
                "shapeType": "circle"
            }
        },
        "minWidth": 120,
        "style": {
            "spaceRow": 2,
            "keyLabel": {
                "lineHeight": 20,
                "fontSize": 12,
                "fontColor": "#646A73",
                "textAlign": "left"
            },
            "valueLabel": {
                "lineHeight": 20,
                "fontSize": 12,
                "fontColor": "#646A73"
            },
            "titleLabel": {
                "fontSize": 12,
                "lineHeight": 20,
                "fontWeight": 400,
                "fontColor": "#1F2329"
            },
            "panel": {
                "padding": {
                    "top": 10,
                    "bottom": 10,
                    "left": 12,
                    "right": 12
                },
                "border": {
                    "color": "#EFF0F1",
                    "width": 1,
                    "radius": 6
                },
                "shadow": {
                    "x": 0,
                    "y": 4,
                    "blur": 16,
                    "spread": 4,
                    "color": "#1F232908"
                }
            },
            "shape": {
                "size": 8,
                "spacing": 5
            }
        }
    },
    "stackLabel": {
        "visible": true,
        "offset": 2,
        "position": "max",
        "smartInvert": {
            "contrastRatiosThreshold": 2
        },
        "style": {
            "fontSize": 12,
            "lineHeight": 20,
            "fontWeight": 700,
            "fontFamily": "DIN Alternate",
            "stroke": "",
            "textAlign": "center"
        }
    },
    "leaderLine": {
        "visible": false
    },
    "dataZoom": []
}

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

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

Current Behavior

image

Expected Behavior

the correct value of label should be 23

Environment

- OS:
- Browser:
- Framework:

Any additional comments?

No response

@xiaoluoHe xiaoluoHe added bug Something isn't working online biz labels Aug 31, 2023
@xiaoluoHe xiaoluoHe added this to the v1.3.1 milestone Sep 1, 2023
@kkxxkk2019 kkxxkk2019 modified the milestones: v1.3.1, v1.3.2 Sep 5, 2023
xuefei1313 added a commit that referenced this issue Sep 7, 2023
kkxxkk2019 pushed a commit that referenced this issue Sep 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working online biz
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants