سؤال

أنا أحاول أن أضيف legend إلى بلدي إكستجس 5 الرسوم البيانية وأنه لا يبدو للعمل.هل هذا خطأ أم أنني أفعل شيئا خاطئا?

legend: {  
    docked: 'top',
    style: {
         borderColor: 'red',
         borderStyle: 'solid'
    }
}
هل كانت مفيدة؟

المحلول

كنت أعمل على هذه المشكلة نفسها لفترة من الوقت-وأخيرا قدمت تقرير علة سينشا:

http://www.sencha.com/forum/showthread.php?289279-Sencha-5-Charts-Broken-Legend

قصة طويلة قصيرة ، هناك" من المفترض " إصلاح في بدء إكستجس المقبل.لسوء الحظ ، هذا لا يساعدنا الآن...

ومع ذلك ، يمكنك إنشاء تبل للأسطورة - ولكن بلدي تبل ليست قوية تماما مثل أسطورة إكستجس الأصلي.سيظل يظهر / يخفي المسلسل ، لكنه لا يخفي المسلسل في وسيلة الإيضاح.أنا لا تزال تكرير لافوري وسيتم نشر تحديثا كما أحصل على عمل واحد.

legend: {
        docked: 'top',
        border: 0,
        style: { borderColor: 'red' },
        tpl: [            
            '<tpl for=".">',                
                '<div class="myLegendItem" style="float:left;margin:5px;padding:0px;cursor:pointer;">',
                      '<div class="" style="float:left;margin:2px;width:10px;height: 10px; background:{mark};opacity:.6"></div><div style="float:left;">{name}</div>',                                      
                '</div>',                    
            '</tpl>'                
        ],
        itemSelector: '.myLegendItem'
},

نصائح أخرى

لإخفاء السلسلة غير النشطة في وسيلة الإيضاح ، استخدم عامل تشغيل ثلاثي للتحقق من القيم.معاق

<div class="x-legend-container">
    <tpl for=".">
        <div class="x-legend-item {[ values.disabled ? Ext.baseCSSPrefix + 'legend-inactive' : '' ]}">
            <span class="x-legend-item-marker" style="background:{mark};float:left;width:10px;height:10px;"></span>
            <span style="float:left;margin-left:4px;">{name}</span>
        </div>
    </tpl>
</div>

أيضا إذا لزم الأمر إضافة فئة كس ل

x-legend-inactive{
   opacity: 0.5;
}
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top