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

[Feature]AreaChart start from zero #647

Closed
youngwinds opened this issue Aug 24, 2023 · 0 comments
Closed

[Feature]AreaChart start from zero #647

youngwinds opened this issue Aug 24, 2023 · 0 comments
Assignees
Labels

Comments

@youngwinds
Copy link
Contributor

youngwinds commented Aug 24, 2023

English: Expected graphics are stacked and drawn in both positive and negative directions from the zero axis, rather than starting from negative values.

Chinese: 期望图形分别从0轴向正负2个方向堆叠和绘制, 而非从负值开始.


Current:
Image

Expected:

Image

{
    "type": "area",
    "xField": [
        "230829114249033"
    ],
    "yField": [
        "10002"
    ],
    "direction": "vertical",
    "seriesField": "20001",
    "padding": 0,
    "data": [
        {
            "id": "data",
            "values": [
                {
                    "10001": "销售额",
                    "10002": "291776.911403656",
                    "10003": "230829110552014",
                    "20001": "销售额",
                    "230829110552014": "291776.911403656",
                    "230829114249033": "装订机"
                },
                {
                    "10001": "利润",
                    "10002": "42758.4918590039",
                    "10003": "230829114249028",
                    "20001": "利润",
                    "230829114249028": "42758.4918590039",
                    "230829114249033": "装订机"
                },
                {
                    "10001": "销售额",
                    "10002": "129010.72777748108",
                    "10003": "230829110552014",
                    "20001": "销售额",
                    "230829110552014": "129010.72777748108",
                    "230829114249033": "系固件"
                },
                {
                    "10001": "利润",
                    "10002": "18628.98805011809",
                    "10003": "230829114249028",
                    "20001": "利润",
                    "230829114249028": "18628.98805011809",
                    "230829114249033": "系固件"
                },
                {
                    "10001": "销售额",
                    "10002": "1152527.742767334",
                    "10003": "230829110552014",
                    "20001": "销售额",
                    "230829110552014": "1152527.742767334",
                    "230829114249033": "收纳具"
                },
                {
                    "10001": "利润",
                    "10002": "316843.37965106964",
                    "10003": "230829114249028",
                    "20001": "利润",
                    "230829114249028": "316843.37965106964",
                    "230829114249033": "收纳具"
                },
                {
                    "10001": "销售额",
                    "10002": "1991498.876586914",
                    "10003": "230829110552014",
                    "20001": "销售额",
                    "230829110552014": "1991498.876586914",
                    "230829114249033": "复印机"
                },
                {
                    "10001": "利润",
                    "10002": "252897.25975105166",
                    "10003": "230829114249028",
                    "20001": "利润",
                    "230829114249028": "252897.25975105166",
                    "230829114249033": "复印机"
                },
                {
                    "10001": "销售额",
                    "10002": "1799653.4683990479",
                    "10003": "230829110552014",
                    "20001": "销售额",
                    "230829110552014": "1799653.4683990479",
                    "230829114249033": "电话"
                },
                {
                    "10001": "利润",
                    "10002": "223349.64341315627",
                    "10003": "230829114249028",
                    "20001": "利润",
                    "230829114249028": "223349.64341315627",
                    "230829114249033": "电话"
                },
                {
                    "10001": "销售额",
                    "10002": "862010.4298400879",
                    "10003": "230829110552014",
                    "20001": "销售额",
                    "230829110552014": "862010.4298400879",
                    "230829114249033": "桌子"
                },
                {
                    "10001": "利润",
                    "10002": "-133405.67106357217",
                    "10003": "230829114249028",
                    "20001": "利润",
                    "230829114249028": "-133405.67106357217",
                    "230829114249033": "桌子"
                },
                {
                    "10001": "销售额",
                    "10002": "287486.07971572876",
                    "10003": "230829110552014",
                    "20001": "销售额",
                    "230829110552014": "287486.07971572876",
                    "230829114249033": "信封"
                },
                {
                    "10001": "利润",
                    "10002": "72505.02035200596",
                    "10003": "230829114249028",
                    "20001": "利润",
                    "230829114249028": "72505.02035200596",
                    "230829114249033": "信封"
                },
                {
                    "10001": "销售额",
                    "10002": "874465.1429748535",
                    "10003": "230829110552014",
                    "20001": "销售额",
                    "230829110552014": "874465.1429748535",
                    "230829114249033": "设备"
                },
                {
                    "10001": "利润",
                    "10002": "144110.62463903427",
                    "10003": "230829114249028",
                    "20001": "利润",
                    "230829114249028": "144110.62463903427",
                    "230829114249033": "设备"
                },
                {
                    "10001": "销售额",
                    "10002": "263334.11975860596",
                    "10003": "230829110552014",
                    "20001": "销售额",
                    "230829110552014": "263334.11975860596",
                    "230829114249033": "纸张"
                },
                {
                    "10001": "利润",
                    "10002": "61622.26008081436",
                    "10003": "230829114249028",
                    "20001": "利润",
                    "230829114249028": "61622.26008081436",
                    "230829114249033": "纸张"
                },
                {
                    "10001": "销售额",
                    "10002": "97077.9601020813",
                    "10003": "230829110552014",
                    "20001": "销售额",
                    "230829110552014": "97077.9601020813",
                    "230829114249033": "标签"
                },
                {
                    "10001": "利润",
                    "10002": "23945.739994108677",
                    "10003": "230829114249028",
                    "20001": "利润",
                    "230829114249028": "23945.739994108677",
                    "230829114249033": "标签"
                },
                {
                    "10001": "销售额",
                    "10002": "479691.2120742798",
                    "10003": "230829110552014",
                    "20001": "销售额",
                    "230829110552014": "479691.2120742798",
                    "230829114249033": "用具"
                },
                {
                    "10001": "利润",
                    "10002": "85167.71222690493",
                    "10003": "230829114249028",
                    "20001": "利润",
                    "230829114249028": "85167.71222690493",
                    "230829114249033": "用具"
                },
                {
                    "10001": "销售额",
                    "10002": "2085435.9713897705",
                    "10003": "230829110552014",
                    "20001": "销售额",
                    "230829110552014": "2085435.9713897705",
                    "230829114249033": "椅子"
                },
                {
                    "10001": "利润",
                    "10002": "325836.72820635885",
                    "10003": "230829114249028",
                    "20001": "利润",
                    "230829114249028": "325836.72820635885",
                    "230829114249033": "椅子"
                },
                {
                    "10001": "销售额",
                    "10002": "287970.4799003601",
                    "10003": "230829110552014",
                    "20001": "销售额",
                    "230829110552014": "287970.4799003601",
                    "230829114249033": "用品"
                },
                {
                    "10001": "利润",
                    "10002": "40576.34017910063",
                    "10003": "230829114249028",
                    "20001": "利润",
                    "230829114249028": "40576.34017910063",
                    "230829114249033": "用品"
                },
                {
                    "10001": "销售额",
                    "10002": "196222.767827034",
                    "10003": "230829110552014",
                    "20001": "销售额",
                    "230829110552014": "196222.767827034",
                    "230829114249033": "美术"
                },
                {
                    "10001": "利润",
                    "10002": "-18266.891820274293",
                    "10003": "230829114249028",
                    "20001": "利润",
                    "230829114249028": "-18266.891820274293",
                    "230829114249033": "美术"
                },
                {
                    "10001": "销售额",
                    "10002": "803406.0171890259",
                    "10003": "230829110552014",
                    "20001": "销售额",
                    "230829110552014": "803406.0171890259",
                    "230829114249033": "配件"
                },
                {
                    "10001": "利润",
                    "10002": "130805.41636949778",
                    "10003": "230829114249028",
                    "20001": "利润",
                    "230829114249028": "130805.41636949778",
                    "230829114249033": "配件"
                },
                {
                    "10001": "销售额",
                    "10002": "2160183.010536194",
                    "10003": "230829110552014",
                    "20001": "销售额",
                    "230829110552014": "2160183.010536194",
                    "230829114249033": "器具"
                },
                {
                    "10001": "利润",
                    "10002": "199027.02529846132",
                    "10003": "230829114249028",
                    "20001": "利润",
                    "230829114249028": "199027.02529846132",
                    "230829114249033": "器具"
                },
                {
                    "10001": "销售额",
                    "10002": "2307203.214691162",
                    "10003": "230829110552014",
                    "20001": "销售额",
                    "230829110552014": "2307203.214691162",
                    "230829114249033": "书架"
                },
                {
                    "10001": "利润",
                    "10002": "361136.8599413857",
                    "10003": "230829114249028",
                    "20001": "利润",
                    "230829114249028": "361136.8599413857",
                    "230829114249033": "书架"
                }
            ],
            "fields": {
                "10001": {
                    "alias": "指标名称 "
                },
                "10002": {
                    "alias": "指标值 "
                },
                "20001": {
                    "alias": "图例项 ",
                    "domain": [
                        "销售额",
                        "利润"
                    ],
                    "lockStatisticsByDomain": true
                },
                "230829110552014": {
                    "alias": "销售额"
                },
                "230829114249028": {
                    "alias": "利润"
                },
                "230829114249033": {
                    "alias": "子类别",
                    "domain": [
                        "标签",
                        "电话",
                        "复印机",
                        "美术",
                        "配件",
                        "器具",
                        "设备",
                        "收纳具",
                        "书架",
                        "系固件",
                        "信封",
                        "椅子",
                        "用具",
                        "用品",
                        "纸张",
                        "装订机",
                        "桌子"
                    ],
                    "lockStatisticsByDomain": true,
                    "sortIndex": 0
                }
            }
        }
    ],
    "stack": false,
    "axes": [
        {
            "type": "band",
            "tick": {
                "visible": false
            },
            "grid": {
                "visible": false,
                "style": {
                    "stroke": "#DADCDD",
                    "lineWidth": 1,
                    "lineDash": [
                        4,
                        2
                    ]
                }
            },
            "orient": "bottom",
            "visible": true,
            "domainLine": {
                "visible": true,
                "style": {
                    "lineWidth": 1,
                    "stroke": "#989999"
                }
            },
            "title": {
                "visible": false,
                "text": "子类别",
                "style": {
                    "fontSize": 12,
                    "fill": "#363839",
                    "fontWeight": "normal"
                }
            },
            "sampling": false,
            "label": {
                "visible": true,
                "space": 4,
                "style": {
                    "fontSize": 12,
                    "fill": "#6F6F6F",
                    "angle": 0,
                    "fontWeight": "normal"
                },
                "autoHide": true,
                "autoHideMethod": "greedy",
                "flush": true
            },
            "hover": true,
            "background": {
                "visible": false,
                "state": {
                    "hover": {
                        "fillOpacity": 0.08,
                        "fill": "#141414"
                    }
                }
            },
            "paddingInner": [
                0.15,
                0
            ],
            "paddingOuter": [
                0.075,
                0
            ]
        },
        {
            "type": "linear",
            "tick": {
                "visible": false,
                "style": {
                    "stroke": "rgba(255, 255, 255, 0)"
                }
            },
            "niceType": "accurateFirst",
            "grid": {
                "visible": true,
                "style": {
                    "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": "销售额",
                "style": {
                    "fontSize": 12,
                    "fill": "#363839",
                    "fontWeight": "normal"
                }
            },
            "sampling": false,
            "label": {
                "visible": true,
                "space": 8,
                "flush": true,
                "style": {
                    "fontSize": 12,
                    "fill": "#6F6F6F",
                    "angle": 0,
                    "fontWeight": "normal"
                },
                "autoHide": true,
                "autoHideMethod": "greedy"
            },
            "hover": true,
            "background": {
                "visible": true,
                "state": {
                    "hover": {
                        "fillOpacity": 0.08,
                        "fill": "#141414"
                    }
                }
            },
            "zero": true,
            "nice": true
        }
    ],
    "color": {
        "field": "20001",
        "type": "ordinal",
        "range": [
            "#009db5",
            "#f2b823"
        ],
        "specified": {},
        "domain": [
            "销售额",
            "利润"
        ]
    },
    "legends": [
        {
            "type": "discrete",
            "id": "legend",
            "orient": "bottom",
            "position": "start",
            "layoutType": "normal",
            "visible": true,
            "maxRow": 2,
            "title": {
                "textStyle": {
                    "fontSize": 12,
                    "fill": "#6F6F6F"
                }
            },
            "item": {
                "focus": true,
                "focusIconStyle": {
                    "size": 14
                },
                "maxWidth": 400,
                "spaceRow": 0,
                "spaceCol": 0,
                "padding": {
                    "top": 1,
                    "bottom": 1,
                    "left": 2,
                    "right": 2
                },
                "background": {
                    "visible": false,
                    "style": {
                        "fillOpacity": 0.001
                    }
                },
                "label": {
                    "style": {
                        "fontSize": 12,
                        "fill": "#6F6F6F"
                    }
                },
                "shape": {
                    "style": {
                        "symbolType": "square"
                    }
                }
            },
            "pager": {
                "textStyle": {},
                "handler": {
                    "style": {},
                    "state": {
                        "disable": {}
                    }
                }
            },
            "padding": {
                "top": 16,
                "bottom": 0,
                "left": 0,
                "right": 0
            }
        }
    ],
    "label": {
        "visible": false,
        "overlap": {
            "hideOnHit": true,
            "clampForce": true
        },
        "style": {
            "fontSize": 12,
            "fontWeight": "normal",
            "fill": "#363839",
            "stroke": "rgba(255, 255, 255, 0.8)",
            "lineWidth": 2,
            "strokeOpacity": 1
        },
        "position": "outside",
        "smartInvert": false
    },
    "tooltip": {
        "handler": {}
    },
    "background": "rgba(255, 255, 255, 0)",
    "point": {
        "style": {
            "shape": {
                "type": "ordinal",
                "field": "20001",
                "range": [
                    "circle"
                ],
                "domain": [
                    "销售额",
                    "利润"
                ]
            },
            "size": {
                "type": "ordinal",
                "field": "20001",
                "range": [
                    8
                ],
                "domain": [
                    "销售额",
                    "利润"
                ]
            },
            "fill": {
                "field": "20001",
                "type": "ordinal",
                "range": [
                    "#009db5",
                    "#f2b823"
                ],
                "specified": {},
                "domain": [
                    "销售额",
                    "利润"
                ]
            },
            "stroke": {
                "field": "20001",
                "type": "ordinal",
                "range": [
                    "#009db5",
                    "#f2b823"
                ],
                "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
            }
        }
    },
    "seriesMark": "point",
    "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": {
        "visible": true,
        "style": {
            "fillOpacity": 0.35,
            "curveType": {
                "type": "ordinal",
                "field": "20001",
                "range": [
                    "linear"
                ],
                "domain": [
                    "销售额",
                    "利润"
                ]
            }
        }
    },
    "invalidType": "break",
    "animation": false,
    "hash": "ba568eafdf5d5d5d1c7d2480346ebe87"
}

@youngwinds youngwinds added the bp label Aug 24, 2023
@youngwinds youngwinds changed the title [Feature]AreaChart negative stack [Feature]AreaChart start from zero Aug 24, 2023
@kkxxkk2019 kkxxkk2019 self-assigned this Sep 1, 2023
kkxxkk2019 added a commit that referenced this issue Sep 19, 2023
…onX1` and `dataToPositionY1` should use 0, close #647
@kkxxkk2019 kkxxkk2019 mentioned this issue Sep 19, 2023
20 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants