简体   繁体   English

饼图-进出标签

[英]Pie Chart - Labels In and out

Labels on the pie chart are fine to me. 饼状图上的标签对我来说很好。 Labels outside of the pie chart are not, I would like to make these disappear since on Iphone or a screen that size, labels pop out of the pie chart and are out of the screen most of the time. 饼图之外的标签不是,我想使这些标签消失,因为在Iphone或屏幕上,标签的大小会从饼图中弹出,并且在大多数情况下不在屏幕上。

I did not find anything in Sencha Architect that allowed me to overide this mechanism for labels. 我没有在Sencha Architect中找到任何可以使我超越标签机制的东西。 Would someone have an idea? 会有想法吗?

在此处输入图片说明

You have to extend Ext.chart.series.sprite.PieSlice and override the method sliceContainsLabel : 您必须扩展Ext.chart.series.sprite.PieSlice并重写方法sliceContainsLabel

Ext.define('yourNamespase.CustomPieSlice', {
    alias: 'sprite.custompieslice',
    extend: 'Ext.chart.series.sprite.PieSlice',

    inheritableStatics: {
        def: {
            defaults: {
                doCallout: false,
                rotateLabels: false,
                label: '',
                labelOverflowPadding: 10,
                renderer: null
            }
        }
    },

    sliceContainsLabel: function () {
        return 1;
    }
});

And so the labels will be always inside the pie chart. 因此,标签将始终位于饼图中。

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

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