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

柱状图条形图设置过radius后,容器宽度小于radius后会报错,而且恢复宽度后图形无法恢复 #2372

Open twtcc2351 opened 3 years ago

twtcc2351 commented 3 years ago

报错信息: Uncaught DOMException: Failed to execute 'ellipse' on 'CanvasRenderingContext2D': The major-axis radius provided (-0.808186) is negative.

const data = [ { type: '家具家电', sales: 38, }, { type: '粮油副食', sales: 52, }, { type: '生鲜水果', sales: 61, }, { type: '美容洗护', sales: 145, }, { type: '母婴用品', sales: 48, }, { type: '进口食品', sales: 38, }, { type: '食品饮料', sales: 38, }, { type: '家庭清洁', sales: 38, }, ];

const columnPlot = new Column('container', { data, xField: 'type', yField: 'sales', appendPadding:[16,100,16,16], label: { // 可手动配置 label 数据标签位置 position: 'middle', // 'top', 'bottom', 'middle', // 配置样式 style: { fill: '#FFFFFF', opacity: 0.6, }, }, columnStyle:{ radius:[10,10,10,10] }, xAxis: { label: { autoHide: true, autoRotate: false, }, }, meta: { type: { alias: '类别', }, sales: { alias: '销售额', }, }, });

columnPlot.render(); const el = document.getElementById('container'); el.style.width='5px'

报错信息: Uncaught DOMException: Failed to execute 'ellipse' on 'CanvasRenderingContext2D': The major-axis radius provided (-0.808186) is negative.

visiky commented 3 years ago

顺便可以看下 polar 下的圆角支持 @pearmini

pearmini commented 3 years ago

相关的 issue:https://github.com/antvis/G2Plot/issues/2510

visiky commented 1 year ago

相关 issue: #2399