antvis/G2

使用chart.option("scrollbar")时无法使用chart.color('')设置颜色,否者会失效 #4227

jxguoguo posted onGitHub

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>滚动条设置颜色BUG</title>
</head>
<body>
    <div id="container"></div>
     <script src="https://gw.alipayobjects.com/os/lib/antv/g2/4.2.7/dist/g2.min.js"></script>
</body>
<script>
    const data1 = [
        { type: '汽车', value: 34 },
        { type: '建材家居', value: 85 },
        { type: '住宿旅游', value: 103 },
        { type: '交通运输与仓储邮政', value: 142 },
        { type: '建筑房地产', value: 251 },
        { type: '教育', value: 367 },
        { type: 'IT 通讯电子', value: 491 },
        { type: '社会公共管理', value: 672 },
        { type: '医疗卫生', value: 868 },
        { type: '金融保险', value: 1234 },
    ];

    const chart = new G2.Chart({
        container: 'container',
        autoFit: true,
        height: 300,
    });
    function t1() {
        test1(chart, data1)
    }
    t1()
    function test1(chart, data) {
        chart.clear()
        chart.data(data);
        chart.legend(false);
        chart.coordinate().transpose();
        chart
            .interval()
            .position('type*value')
            .label('value', {
                style: {
                    fill: '#8d8d8d',
                },
                offset: 10,
            }).color('type');
        chart.interaction('element-active');
        chart.option("scrollbar", {
            type: 'vertical',
            width: 16,
            categorySize: 80
        })
        chart.render();
        console.log(chart.filteredData);
    }

</script>

</html>

具体问题是什么,我这里显示是 ok 的。

image

posted by hustcc over 2 years ago

示例:https://g2-v4.antv.vision/zh/examples/column/basic#scrollbar 代码    chart.interval().position('releasecount') 换成 chart.interval().position('releasecount').color('release'); 当使用滚动条api时,使用x轴的中文作为颜色类型,会出现bug,不过听说在5.0中会修复,不知道是否修复

------------------ 原始邮件 ------------------ 发件人: @.*>; 发送时间: 2022年12月6日(星期二) 中午11:02 收件人: *@.>; 抄送: @.*>; *@.>; 主题: Re: [antvis/G2] 使用chart.option("scrollbar")时无法使用chart.color('')设置颜色,否者会失效 (Issue #4227)

具体问题是什么,我这里显示是 ok 的。

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

posted by jxguoguo over 2 years ago

使用中文作为颜色类型,4.x 也不会有问题吧,还是我没有理解你的问题,求详述~

posted by hustcc over 2 years ago

可以点击链接进去替换代码可以看到效果

------------------ 原始邮件 ------------------ 发件人: @.*>; 发送时间: 2022年12月6日(星期二) 中午11:12 收件人: *@.>; 抄送: @.*>; *@.>; 主题: Re: [antvis/G2] 使用chart.option("scrollbar")时无法使用chart.color('')设置颜色,否者会失效 (Issue #4227)

使用中文作为颜色类型,4.x 也不会有问题吧,还是我没有理解你的问题,求详述~

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

posted by jxguoguo over 2 years ago

可以看到效果,我👆🏻回复中截图都能打开的。

posted by hustcc over 2 years ago

------------------ 原始邮件 ------------------ 发件人: @.*>; 发送时间: 2022年12月6日(星期二) 中午11:17 收件人: *@.>; 抄送: @.*>; *@.>; 主题: Re: [antvis/G2] 使用chart.option("scrollbar")时无法使用chart.color('')设置颜色,否者会失效 (Issue #4227)

可以看到效果,我👆🏻回复中截图都能打开的。

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

posted by jxguoguo over 2 years ago

宁那边是否是这样的效果呢

------------------ 原始邮件 ------------------ 发件人: "antvis/G2" @.*>; 发送时间: 2022年12月6日(星期二) 中午11:17 *@.>; @.**@.>; 主题: Re: [antvis/G2] 使用chart.option("scrollbar")时无法使用chart.color('')设置颜色,否者会失效 (Issue #4227)

可以看到效果,我👆🏻回复中截图都能打开的。

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

posted by jxguoguo over 2 years ago

同样遇到这个问题,https://g2-v4.antv.vision/zh/examples/column/basic#scrollbar,例子中: 只需要把 38行: chart.interval().position('release*count') 改为 chart.interval().position('release*count').color("release"); 即可复现。 antv g2 4.x 版本。有解决吗?

posted by Sallyfafafa over 1 year ago

这是来自QQ邮箱的假期自动回复邮件。您好,您的来信已收到。 --计信郭日钊

posted by jxguoguo over 1 year ago

看到5.x版本是好的,4.x这个问题还修复吗

posted by Sallyfafafa over 1 year ago

Fund this Issue

$0.00
Funded

Pull requests