pieVisual.js 659 字节
Newer Older
L
Add pie  
lang 已提交
1 2 3 4 5 6
define(function (require) {

    return function (ecModel) {
        ecModel.eachSeriesByType('pie', function (seriesModel) {
            var colorList = ecModel.get('color');
            var data = seriesModel.getData();
L
lang 已提交
7
            var dataAll = seriesModel.getDataAll();
L
Add pie  
lang 已提交
8
            data.each(function (idx) {
L
lang 已提交
9 10 11 12 13
                var rawIdx = data.getRawIndex(idx);
                var color = colorList[rawIdx % colorList.length];
                // Legend use the visual info in data before processed
                dataAll.setItemVisual(rawIdx, 'color', color);
                data.setItemVisual(idx, 'color', color);
L
Add pie  
lang 已提交
14 15 16 17
            });
        });
    }
});