Ant-design charts downloadImage backgroundColor option is not applied

207 views Asked by At

I create a component on react. And I want to load the image in png using downloadImage function https://antv-g6.gitee.io/en/docs/api/graphFunc/download#graphdownloadimagename-type-backgroundcolor.

But backgroundColor is not working for me and background is always transparent.

import React from 'react';
import { Line } from '@ant-design/charts';
    
export const MyComponent = () => {
    const config = {
        onReady: (chart) => {
            setTimeout(() => {
                // '#ff000' also is not working
                chart.downloadImage('ImageName', 'image/png', 'red');
            }, 5000);
        },
    };
    
    return (<Line {...config} />);
};
react v18.2
antd v4.24.10
@ant-design/charts v1.4.2
@antv/g2 v4.2.10
@antv/s2 v1.48.0

How can I fix it. Or which another function I can use for download chart as image?

0

There are 0 answers