【问题标题】:Reduce the length of callout line in Pie chart Sencha touch减少饼图煎茶触摸中标注线的长度
【发布时间】:2014-10-10 07:50:04
【问题描述】:

下面是我在 Sencha touch 应用程序中的饼图代码。我面临的问题是,每当显示图表的空间不足以容纳所有标签时,就会有标注线和标签,但是我希望这些标注线的长度更短,然后它们现在就可以了,因为它们不适合我的屏幕和标签被剪掉。

我找不到正确的配置属性。

EDIT - 图片中的两个图表代码相同,放在容器中的hbox布局中

{
         xtype: 'polar',
         itemId: 'pieChart',
         background: 'white',
         store: 'GraphsStore',
         shadow: true,
         innerPadding: 25,
         //bind the chart to a store with the following structure
         //interactions: ['rotate'],

         colors: ["#115fa6", "#94ae0a", "#a61120", "#ff8809", "#ffd13e", "#a61187", "#24ad9a", "#7c7474", "#a66111"],

         //configure the legend.
         legend: {
            position: 'top',
            //width: 100
            hidden: true
         },

         //describe the actual pie series.
         series: [{
            type: 'pie',
            xField: 'g1',
            renderer: function(sprite, config, rendererData, index) {
               var changes = {},
                  store = rendererData.store,
                  curentRecord = store.getData().items[index];
               var text = curentRecord.data.g1;
               changes.text = text;
               return changes;
            },

            label: {
               field: 'name',
               display: 'rotate',
               font: '8px'
            },

            donut: 25,

            style: {
               miterLimit: 5,
               lineCap: 'miter',
               lineWidth: 1
            }
         }]
      }

任何指针都会有所帮助! 谢谢。

【问题讨论】:

    标签: charts sencha-touch-2 pie-chart


    【解决方案1】:

    在chart/series/sprite/PieSlice.js中,修改以下两行:

    x = centerX + Math.cos(midAngle) * (endRho + 40);
    y = centerY + Math.sin(midAngle) * (endRho + 40);
    

    将 40 更改为较小的数字。

    【讨论】:

      猜你喜欢
      • 2012-11-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多