【问题标题】:how to increase name in pie chart in extjs如何在extjs的饼图中增加名称
【发布时间】:2017-02-02 17:43:26
【问题描述】:

当我在我的名字中使用超过五个字母时,它会出现在图表中查看我上传的图片我正在使用 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'
   }]
 }

这是我动态命名的名称,我希望该名称在我的饼图一侧,我的意思是在图表上方但是当我使用包含超过 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')
  });
}

【问题讨论】:

    标签: javascript charts pie-chart extjs6


    【解决方案1】:

    问题出在你的系列标签上:

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

    display: 'rotate', 在某些情况下会在图表内显示标签,而在其他情况下会在图表外显示,您应该改用display: 'inside',

    You can see a working example here

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-08-29
      • 1970-01-01
      相关资源
      最近更新 更多