You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The width of label in yAxis dose not be set an appropriate width when the 'textAlign' has been set 'start'.The width is set about 20px directly.I can only justify the offsetX to minus value to fix it.Could G2 fit the label width automatically rather than to set offsetX manually?
#4050
Closed
1 task
blackwidowX opened this issue
Jul 25, 2022
· 1 comment
importG2from"@antv/g2";constdata=[{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}];constchart=newG2.Chart({container: 'container',forceFit: true,height: 500,padding: [20,40,50,124]});chart.source(data,{value: {max: 1300,min: 0,nice: false,alias: '销量(百万)'}});chart.axis('type',{label: {// If the textAlign is set 'start', I can just set the offsetX to a minus value to see all text of y.offsetX: -100,textStyle: {textAlign: 'start',fill: '#8d8d8d',fontSize: 12}},tickLine: {alignWithLabel: false,length: 0},line: {lineWidth: 0}});chart.axis('value',{label: null,title: {offset: 30,textStyle: {fontSize: 12,fontWeight: 300}}});chart.legend(false);chart.coord().transpose();chart.interval().position('type*value').size(26).opacity(1).label('value',{textStyle: {fill: '#8d8d8d'},offset: 10});chart.render();
Environment
Info
g2
4.2.5
System
-
Browser
-
look at the annotation of the code snippet.
The text was updated successfully, but these errors were encountered:
chart.axis('type',{label: {// If the textAlign is set 'start', I can just set the offsetX to a minus value to see all text of y.offsetX: 0,textStyle: {textAlign: 'end',// use `end`fill: '#8d8d8d',fontSize: 12}},// ...
Reproduction link
https://github.com/antvis/g2
Steps to reproduce
look at the annotation of the code snippet.
The text was updated successfully, but these errors were encountered: