简体   繁体   English

如何在extjs的饼图中增加名称

[英]how to increase name in pie chart in extjs

when I use more then five letters in my name it comes out of the chart see the image i uploaded i am using extjs 6 I just want to have a large name on my chart 当我在名称中使用五个以上的字母时,它就会从图表中消失,请参阅我使用extjs 6上传的图像我只是想在图表中使用较大的名称

  { xtype: 'polar', split: true, flex: 0.3, colors: [ '#347327', '#2897d2', '#de6110', ], bind: { store: '{pie}' }, series: [{ type: 'pie', showInLegend: true, donut: false, tips: { trackMouse: true, width: 140, height: 28, renderer: function(storeItem, item) { this.setTitle(storeItem.get('name') + ': ' + storeItem.get('data')); } }, highlight: { segment: { margin: 15 } }, label: { field: 'name', display: 'rotate', contrast: true, font: '12px Arial' }, xField: 'data' }], interactions: [{ type: 'rotate' }] } 

here is My dynamically given names i want that names in side of my pie chart i mean above on the chart But when i use name that contain more then 5 letters it goes out side of the chart i will upload a image. 这是我动态给定的名称,我希望该名称在饼图的侧面,在图表上我的意思是上面的意思,但是当我使用包含多于5个字母的名称时,它会在图表的侧面伸出,我将上传一张图片。

 var pieStore = this.getViewModel().getStore('pie'); var rec = selected[0]; if (rec.get('new')) { pieStore.add({ 'name': 'NEW', data: rec.get('new'), total: rec.get('total') }); } if (rec.get('openToQc')) { pieStore.add({ 'name': 'QC', data: rec.get('openToQc'), total: rec.get('total') }); } if (rec.get('open')) { pieStore.add({ 'name': 'Open', data: rec.get('open'), total: rec.get('total') }); } if (rec.get('rejected')) { pieStore.add({ 'name': 'Rejected', data: rec.get('rejected'), total: rec.get('total') }); } 

很明显,我在图表的第三部分有六个字母,但是当我给它五个或少于五个字母时,它将在图表上显示出来,我只是想在图表上有个大名字

The problem is on your series label: 问题出在您的系列标签上:

label: {
       field: 'name',
       display: 'rotate',
       contrast: true,
       font: '12px Arial'
     },

display: 'rotate', displays the label inside the chart in some cases and outside in others, you should use instead display: 'inside', display: 'rotate',在某些情况下在图表内部显示标签,在其他情况下在外部显示标签,您应该改用display: 'inside',

You can see a working example here 您可以在此处看到一个有效的示例

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM