VisActor / VChart

VChart, more than just a cross-platform charting library, but also an expressive data storyteller.
https://www.visactor.io/vchart
MIT License
1.01k stars 73 forks source link

[Bug] 优化datazoom绑定逻辑 #3373

Open neuqzxy opened 3 weeks ago

neuqzxy commented 3 weeks ago

Version

1.12.9

Link to Minimal Reproduction

1.12.9

Steps to Reproduce

切换orient后,要手动设置axisIndex,否则不会自动切换

Current Behavior

切换orient后,没有自动绑定轴

Expected Behavior

切换orient后,自动绑定轴

Environment

- OS:
- Browser:
- Framework:

Any additional comments?

No response

xb1357686 commented 3 weeks ago

刚好遇到个这样的问题,请教一下,有两个bottom的轴,为了展示一些其他的数据,缩略轴有什么办法两个都关联上吗?,拖动的时候两个一起动。 感谢 const spec = { "type": "common", "direction": "vertical", "hover": false, "padding": { "top": 20, "right": 2, "bottom": 2, "left": 2 }, "animation": false, "axes": [ { "orient": "bottom", "visible": true, "label": { "visible": true, "lastVisible": true, }, "paddingInner": 0.3, "gap": 0.3, "sampling": true }, { "orient": "bottom", "type": "band", "visible": true, "label": { "visible": true, "lastVisible": true, "style": { "fill": "#5C6270", "direction": "horizontal", "angle": null, "dy": 17 }, "autoHide": false }, "paddingInner": 0.3, "gap": 0.3, "title": { "visible": true, "text": [ "123" ], "position": "start", } },

    {
        "orient": "left",
        "visible": true,
        "grid": {
            "visible": true
        },
        "unit": {
            "visible": false,
            "text": "",
            "style": {
                "dy": -10,
                "fill": "#5C6270"
            }
        },
        "label": {
            "visible": true,
            "style": {
                "fill": "#5C6270"
            }
        },
        "paddingInner": 0.3
    }

],
"dataZoom": [
    {
        "visible": true,
        "orient": "bottom",
        "height": 20,
        "brushSelect": false,
        filterMode:'axis',
        axisIndex:0,
    }
],
"series": [
    {
        "xField": [
            "Producte_Category"
        ],
        "tooltipsDimField": "metrics",
        "yField": "SupermarketSale_demo",
        "metricsField": "SupermarketSale_demo",
        "seriesField": "metrics",
        "dataIndex": 0,
        "chartType": "barChart",
        "type": "bar",
        "stack": false,
        "bar": {
            "state": {
                "hover": {
                    "lineWidth": 2,
                    "fillOpacity": 0.6,
                    "cursor": "pointer"
                }
            }
        },
        "interactions": [
            {
                "type": "element-active"
            }
        ],
        "legends": {
            "visible": false
        },
        "line": {
            "style": {
                "curveType": "linear"
            }
        },
        "point": {
            "style": {
                "visible": true,
                "size": 0
            }
        },
    }
],
"data": [
    {
        "values": [
            {
                "Producte_Category": "标签",
                "SupermarketSale_demo": 2106,
                "metrics": "演示"
            },
            {
                "Producte_Category": "电话",
                "SupermarketSale_demo": 2177,
                "metrics": "演示"
            },
            {
                "Producte_Category": "复印机",
                "SupermarketSale_demo": 2139,
                "metrics": "演示"
            },
            {
                "Producte_Category": "美术",
                "SupermarketSale_demo": 2009,
                "metrics": "演示"
            },
            {
                "Producte_Category": "用具",
                "SupermarketSale_demo": 2298,
                "metrics": "演示"
            },
            {
                "Producte_Category": "用品",
                "SupermarketSale_demo": 2266,
                "metrics": "演示"
            },
            {
                "Producte_Category": "纸张",
                "SupermarketSale_demo": 2063,
                "metrics": "演示"
            },
            {
                "Producte_Category": "装订机",
                "SupermarketSale_demo": 3352,
                "metrics": "演示"
            },
        ],
    },
    {},

],

}

xb1357686 commented 3 weeks ago

@skie1997 有缩略轴的情况下,不管渲染了多少次,getScale().domain(); 拿到的都是[0,1],没有缩略轴的情况下又是正常能拿到的,