VChart icon indicating copy to clipboard operation
VChart copied to clipboard

[Feature] 期望轴标签在倾斜时,也能达到竖着时候的自适应效果

Open webiamcome opened this issue 6 months ago • 2 comments

What problem does this feature solve?

请问下轴标签如何设置密集一点且能自适应,不重叠? 1、设置自动隐藏属性,如图: img_v3_02dh_c1698fcc-12bf-41d8-bfa7-ff5c4d13a56g 2、取消自动隐藏属性,如图: img_v3_02dh_0d63abcc-b56f-4baa-b09d-8ced909f63eg 3、期望效果:期望轴标签斜着的时候也能达到竖着时候的自适应效果。如图: img_v3_02dh_25ceca1e-3694-4b7b-ba36-858e25b2abbg img_v3_02dh_b168d4fb-e01e-40de-9068-f3d17dfa51ag 配置如下:

const response = await fetch('https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/stocks.json');
const data = await response.json();
const spec = {
    "barMaxWidth": 50,
    type: 'bar',
    xField: 'Date',
    yField: 'Close',
    seriesField: 'Symbol',
    data: [
      {
        id: 'bar',
        values: data
      }
    ],
    "animationAppear": false,
    "large": true,
    "largeThreshold": 500,
    "progressiveStep": 1100,
    "progressiveThreshold": 1000,
    "series": [
        {
            "type": "bar",
            "bar": {
                "style": {},
                "state": {
                    "legend_hover_reverse": {
                        "fillOpacity": 0.15
                    },
                    "hover_series": {
                        "opacity": 1
                    },
                    "unHover_series": {
                        "opacity": 0.2
                    }
                }
            }
        }
    ],
    "axes": [
        {
            "orient": "left",
            "visible": true,
            "label": {
                "visible": true,
                "autoLimit": false,
                "autoHide": false,
                "autoRotate": true,
                "autoRotateAngle": [
                    0
                ],
                "style": {
                    "show": true,
                    "interval": 0,
                    "color": "#788291",
                    "fontStyle": "normal",
                    "fontWeight": "400",
                    "fontFamily": "Helvetica",
                    "fontSize": 12,
                    "fill": "#788291",
                    "maxLineWidth": 100
                }
            },
            "tick": {
                "visible": false,
                "style": {
                    "stroke": "#DEDEDE",
                    "lineWidth": 1
                }
            },
            "domainLine": {
                "visible": true,
                "onZero": true,
                "style": {
                    "lineWidth": 1,
                    "stroke": "#DEDEDE",
                    "lineDash": [
                        0
                    ],
                    "lineCap": "square"
                }
            },
            "grid": {
                "visible": false,
                "alignWithLabel": false,
                "style": {
                    "lineWidth": 1,
                    "stroke": "#DEDEDE",
                    "lineDash": [
                        3,
                        4
                    ],
                    "lineCap": "square"
                }
            },
            "sampling": true
        },
        {
            "orient": "bottom",
            "visible": true,
            "type": "band",
            "label": {
                "visible": true,
                "autoLimit": false,
                "autoHide": true,
                "autoRotate": true,
                "autoRotateAngle": [
                    0,
                    305
                ],
                "style": {
                    "show": true,
                    "interval": 0,
                    "color": "#788291",
                    "fontStyle": "normal",
                    "fontWeight": "400",
                    "fontFamily": "Helvetica",
                    "fontSize": 12,
                    "fill": "#788291",
                    "maxLineWidth": 100
                }
            },
            "title": {
                "visible": false,
                "text": "account_id-yyyymmdd-combo_type-ticker_type",
                "position": "middle",
                "style": {
                    "fontSize": 12,
                    "color": "#788291",
                    "fontWeight": "normal",
                    "fontStyle": "normal",
                    "fill": "#788291"
                }
            },
            "tick": {
                "visible": false,
                "style": {
                    "stroke": "#DEDEDE",
                    "lineWidth": 1
                }
            },
            "domainLine": {
                "visible": true,
                "onZero": true,
                "style": {
                    "lineWidth": 1,
                    "stroke": "#DEDEDE",
                    "lineDash": [
                        0
                    ],
                    "lineCap": "square"
                }
            },
            "grid": {
                "visible": false,
                "alignWithLabel": false,
                "style": {
                    "lineWidth": 1,
                    "stroke": "#DEDEDE",
                    "lineDash": [
                        3,
                        4
                    ],
                    "lineCap": "square"
                }
            },
            "sampling": false
        }
    ],
    "tooltip": {
        "visible": true,
        "activeType": [
            "dimension"
        ],
        "style": {
            "panel": {
                "backgroundColor": "#fff"
            },
            "titleLabel": {
                "fontSize": 12,
                "color": "#000",
                "fontWeight": "normal",
                "fontStyle": "normal",
                "fontColor": "#000"
            },
            "keyLabel": {
                "fontSize": 12,
                "color": "#000",
                "fontWeight": "normal",
                "fontStyle": "normal",
                "fontColor": "#000"
            },
            "valueLabel": {
                "fontSize": 12,
                "color": "#000",
                "fontWeight": "normal",
                "fontStyle": "normal",
                "fontColor": "#000"
            }
        },
        "dimension": {
            "title": {},
            "content": [
                {}
            ]
        },
        "mark": {
            "title": {},
            "content": [
                {}
            ]
        }
    },
    "dataZoom": [
        {
            "orient": "bottom",
            "tolerance": 4,
            "selectedBackgroundChart": {
                "area": {
                    "visible": false,
                    "style": {
                        "visible": false
                    }
                },
                "line": {
                    "visible": false,
                    "style": {
                        "visible": false
                    }
                }
            },
            "showDetail": "auto",
            "start": 0.9721706864564007,
            "end": 1,
            "startText": {},
            "endText": {},
            "visible": true
        }
    ],
    "label": {
        "visible": false,
        "position": "outside",
        "syncState": true,
        "smartInvert": false,
        "overlap": false,
        "style": {
            "fontSize": 12,
            "fill": "#788291",
            "strokeOpacity": 0,
            "fontWeight": "normal",
            "fontStyle": "normal"
        }
    },
    "padding": [
        12,
        4,
        4,
        4
    ],
    "color": [
        "#1B83ED",
        "#FF7500",
        "#83BFF4",
        "#FFB86C",
        "#3FB27E",
        "#9BCC7E",
        "#F35352",
        "#FF9193",
        "#9D61C2",
        "#CAAED8",
        "#8FA500",
        "#BFD000",
        "#EDC948",
        "#9C755F",
        "#BAB0AC"
    ],
    "theme": {
        "background": "#ffffff"
    }
}

const vchart = new VChart(spec, { dom: CONTAINER_ID });
vchart.renderSync();
// Just for the convenience of console debugging, DO NOT COPY!
window['vchart'] = vchart;

What does the proposed API look like?

none

webiamcome avatar Aug 07 '24 02:08 webiamcome