antvis / G2Plot

:dango: An interactive and responsive charting library based on G2.
https://g2plot.antv.antgroup.com
MIT License
2.55k stars 605 forks source link

🤔 [QUESTION]条形图无法展示图表标题 #3713

Open wikiwikiki opened 10 months ago

wikiwikiki commented 10 months ago

给条形图配置title后,无法展示

图表配置

` import { Bar } from '@ant-design/plots';

const Chart = ({ dataSource }) => { const config = { xField: 'value', yField: 'label', color: ({ label }: Record<string, any>) => { if (label === '收入') { return '#F34B45'; } if (label === '支出') { return '#2EA223'; } return '#5254CC'; }, title: { visible: true, text: '年度累计(万元)', }, tooltip: { title: '年度累计(万元)', showTitle: true, }, };

return (
    <div style={{ width: '100%', height: '100%' }}>
        <Bar data={dataSource} {...config} />
    </div>
);

}; export default Chart; `

展示截图

image

期望效果

标题正常展示