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] Radar Chart render error #654

Closed
youngwinds opened this issue Aug 24, 2023 · 1 comment
Closed

[Bug] Radar Chart render error #654

youngwinds opened this issue Aug 24, 2023 · 1 comment
Assignees
Labels
bp bug Something isn't working
Milestone

Comments

@youngwinds
Copy link
Contributor

Radar chart render error:

Image

const spec = {
    "type": "radar",
    "point": {
        "clipByLayout": true,
        "style": {
            "shape": {
                "type": "ordinal",
                "field": "20001",
                "range": [
                    "circle"
                ],
                "domain": [
                    "利润"
                ]
            },
            "size": {
                "type": "ordinal",
                "field": "20001",
                "range": [
                    8
                ],
                "domain": [
                    "利润"
                ]
            },
            "fill": {
                "field": "20001",
                "type": "ordinal",
                "range": [
                    "#2E62F1"
                ],
                "specified": {},
                "domain": [
                    "利润"
                ]
            },
            "stroke": {
                "field": "20001",
                "type": "ordinal",
                "range": [
                    "#2E62F1"
                ],
                "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
            }
        }
    },
    "outerRadius": 0.8,
    "categoryField": "230824142919078",
    "valueField": "10002",
    "seriesField": "20001",
    "data": [
        {
            "id": "data",
            "values": [
                {
                    "10001": "利润",
                    "10002": "1053092.6314019188",
                    "10003": "230824140418037",
                    "20001": "利润",
                    "230824140418037": "1053092.6314019188",
                    "230824142919078": "消费者"
                },
                {
                    "10001": "利润",
                    "10002": "681967.6347733513",
                    "10003": "230824140418037",
                    "20001": "利润",
                    "230824140418037": "681967.6347733513",
                    "230824142919078": "公司"
                },
                {
                    "10001": "利润",
                    "10002": "412478.6609529555",
                    "10003": "230824140418037",
                    "20001": "利润",
                    "230824140418037": "412478.6609529555",
                    "230824142919078": "小型企业"
                }
            ],
            "fields": {
                "10001": {
                    "alias": "指标名称 "
                },
                "10002": {
                    "alias": "指标值 "
                },
                "20001": {
                    "alias": "图例项 ",
                    "domain": [
                        "利润"
                    ],
                    "lockStatisticsByDomain": true
                },
                "230824140418037": {
                    "alias": "利润"
                },
                "230824142919078": {
                    "alias": "细分",
                    "domain": [
                        "公司",
                        "消费者",
                        "小型企业"
                    ],
                    "lockStatisticsByDomain": true,
                    "sortIndex": 0
                }
            }
        }
    ],
    "axes": [
        {
            "orient": "radius",
            "zero": true,
            "nice": true,
            "tick": {
                "visible": false,
                "style": {
                    "stroke": "#DADCDD"
                }
            },
            "domainLine": {
                "visible": false
            },
            "grid": {
                "visible": true,
                "style": {
                    "lineWidth": 1,
                    "stroke": "#DADCDD"
                },
                "smooth": false
            },
            "label": {
                "visible": false
            }
        },
        {
            "orient": "angle",
            "tick": {
                "visible": false,
                "style": {
                    "stroke": "#DADCDD"
                }
            },
            "domainLine": {
                "visible": false
            },
            "grid": {
                "visible": true,
                "style": {
                    "stroke": "#DADCDD",
                    "lineWidth": 1,
                    "lineDash": []
                },
                "smooth": false
            },
            "label": {
                "visible": true,
                "style": {
                    "fontSize": 12,
                    "fill": "#9ca0b1",
                    "angle": 0,
                    "fontWeight": "normal"
                },
                "autoHide": true,
                "autoHideMethod": "greedy"
            }
        }
    ],
    "color": {
        "field": "20001",
        "type": "ordinal",
        "range": [
            "#2E62F1"
        ],
        "specified": {},
        "domain": [
            "利润"
        ]
    },
    "label": {
        "visible": false,
        "overlap": {
            "hideOnHit": true
        },
        "style": {
            "fontSize": 12,
            "fill": "#363839",
            "stroke": "rgba(255, 255, 255, 0.8)",
            "strokeOpacity": 1,
            "lineWidth": 2
        }
    },
    "legends": [
        {
            "type": "discrete",
            "id": "legend",
            "orient": "right",
            "position": "start",
            "layoutType": "normal",
            "visible": true,
            "hover": false,
            "maxCol": 1,
            "title": {
                "textStyle": {
                    "fontSize": 12,
                    "fill": "#6F6F6F"
                }
            },
            "item": {
                "spaceRow": 0,
                "spaceCol": 0,
                "padding": {
                    "top": 4,
                    "bottom": 4,
                    "left": 4,
                    "right": 22
                },
                "background": {
                    "style": {
                        "fillOpacity": 0.001
                    }
                },
                "label": {
                    "style": {
                        "fontSize": 12,
                        "fill": "#6F6F6F"
                    }
                },
                "shape": {
                    "style": {
                        "symbolType": "square"
                    }
                }
            },
            "pager": {
                "textStyle": {},
                "handler": {
                    "style": {},
                    "state": {
                        "disable": {}
                    }
                }
            },
            "padding": {
                "top": 0,
                "bottom": 0,
                "left": 16,
                "right": 0
            }
        }
    ],
    "background": "rgba(255, 255, 255, 0)",
    "line": {
        "clipByLayout": true,
        "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": [
                    "利润"
                ]
            }
        },
        "clipByLayout": true
    },
    "invalidType": "zero",
    "animation": false,
    "hash": "bb5e8f7fbf0f8ade1d9c513fb7b40a01"
}

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 Aug 24, 2023
@kkxxkk2019
Copy link
Collaborator

这个是因为目前极坐标下线或者面的闭合时需要通过配置 curveTypelinearClosed 或者 cardinalClosed 实现的,而你的 spec 配置的是 linear 导致没有闭合,这个需要 vrender 优化下,不要将闭合和形状这两个功能放在一个配置里,将闭合和 curveType 分开。

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