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] legend render error in pie chart #744

Closed
youngwinds opened this issue Sep 1, 2023 · 2 comments · Fixed by #764
Closed

[Bug] legend render error in pie chart #744

youngwinds opened this issue Sep 1, 2023 · 2 comments · Fixed by #764
Assignees
Labels
bp bug Something isn't working
Milestone

Comments

@youngwinds
Copy link
Contributor

version: 1.3.0

Image

spec:

{
    "type": "pie",
    "categoryField": "20001",
    "valueField": "230901153400105",
    "seriesField": "20001",
    "padding": 0,
    "data": [
        {
            "id": "data",
            "values": [
                {
                    "20001": "华东",
                    "230901144537180": "华东",
                    "230901153400105": "4684506.442247391"
                },
                {
                    "20001": "中南",
                    "230901144537180": "中南",
                    "230901153400105": "4137415.0951108932"
                },
                {
                    "20001": "地区-dongbei",
                    "230901144537180": "地区-dongbei",
                    "230901153400105": "2681567.4745378494"
                },
                {
                    "20001": "华北",
                    "230901144537180": "华北",
                    "230901153400105": "2447301.0141382217"
                },
                {
                    "20001": "西南",
                    "230901144537180": "西南",
                    "230901153400105": "1303124.5089645386"
                },
                {
                    "20001": "西北",
                    "230901144537180": "西北",
                    "230901153400105": "815039.5979347229"
                }
            ],
            "fields": {
                "20001": {
                    "alias": "图例项 ",
                    "domain": [
                        "华东",
                        "中南",
                        "地区-dongbei",
                        "华北",
                        "西南",
                        "西北"
                    ],
                    "lockStatisticsByDomain": true
                },
                "230901144537180": {
                    "alias": "地区"
                },
                "230901153400105": {
                    "alias": "销售额"
                }
            }
        }
    ],
    "outerRadius": 0.9,
    "label": {
        "visible": true,
        "overlap": {
            "hideOnHit": true
        },
        "style": {
            "fontSize": 12,
            "fill": null,
            "lineWidth": 0,
            "strokeOpacity": 1
        },
        "position": "outside",
        "interactive": false
    },
    "color": {
        "field": "20001",
        "type": "ordinal",
        "range": [
            "#2E62F1",
            "#4DC36A",
            "#FF8406",
            "#FFCC00",
            "#4F44CF",
            "#5AC8FA"
        ],
        "specified": {},
        "domain": [
            "华东",
            "中南",
            "地区-dongbei",
            "华北",
            "西南",
            "西北"
        ]
    },
    "legends": [
        {
            "type": "discrete",
            "id": "legend",
            "orient": "left",
            "position": "middle",
            "layoutType": "normal",
            "visible": true,
            "maxCol": 2,
            "title": {
                "textStyle": {
                    "fontSize": 64,
                    "fill": "#6F6F6F"
                }
            },
            "item": {
                "focus": true,
                "focusIconStyle": {
                    "size": 14
                },
                "maxWidth": 325,
                "spaceRow": 0,
                "spaceCol": 0,
                "padding": {
                    "top": 1,
                    "bottom": 1,
                    "left": 2,
                    "right": 2
                },
                "background": {
                    "visible": false,
                    "style": {
                        "fillOpacity": 0.001
                    }
                },
                "label": {
                    "style": {
                        "fontSize": 64,
                        "fill": "#6F6F6F"
                    }
                },
                "shape": {
                    "style": {
                        "lineWidth": 0,
                        "symbolType": "square"
                    }
                }
            },
            "pager": {
                "textStyle": {},
                "handler": {
                    "style": {},
                    "state": {
                        "disable": {}
                    }
                }
            },
            "padding": {
                "top": 0,
                "bottom": 0,
                "left": 0,
                "right": 16
            }
        }
    ],
    "hover": {
        "enable": true
    },
    "select": {
        "enable": true
    },
    "pie": {
        "state": {
            "hover": {
                "cursor": "pointer",
                "fillOpacity": 0.8,
                "stroke": "#58595B",
                "lineWidth": 1,
                "zIndex": 500,
                "outerRadius": 0.9500000000000001
            },
            "selected": {
                "cursor": "pointer",
                "fillOpacity": 1,
                "stroke": "#58595B",
                "lineWidth": 1,
                "outerRadius": 0.9500000000000001
            },
            "selected_reverse": {
                "fillOpacity": 0.3,
                "strokeWidth": 0.3
            }
        }
    },
    "tooltip": {
        "handler": {}
    },
    "background": "rgba(255, 255, 255, 0)",
    "rose": {},
    "animation": false,
    "hash": "6471b6473be791f1637e37cd77acf154"
}
@youngwinds youngwinds added bug Something isn't working bp labels Sep 1, 2023
@kkxxkk2019
Copy link
Collaborator

找到原因了,是因为 1.3.0 新主题里写死了文本的 lineHeight 导致的

@kkxxkk2019 kkxxkk2019 assigned zamhown and unassigned kkxxkk2019 Sep 1, 2023
@kkxxkk2019 kkxxkk2019 added this to the v1.3.1 milestone Sep 1, 2023
@zamhown
Copy link
Member

zamhown commented Sep 1, 2023

修复策略:

  • 同步给设计师,将主题规范里出现的 lineHeight 全部替换成比例值
  • VChart 侧使 lineHeight 支持字符串类型表达比例值,如 “120%” 表示 1.2 倍行距。比例值转换为绝对值的逻辑先放 VChart,后面同步 VRender 对 lineHeight 比例值进行支持
  • 更新默认主题,将 lineHeight 全部改为比例值

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