文本重排完整解决方案
来源:10-6 饼图文本重排(重排)
Lyn
2016-07-20
H5ComponentPie.js: 113 行
// 生长动画
var draw = function( per ){
ctx.clearRect(0,0,w,h);
ctx.beginPath();
ctx.moveTo(r,r);
if(per <=0){
ctx.arc(r,r,r,0,2*Math.PI);
component.find('.text').css('opacity',0)
}else{
ctx.arc(r,r,r,sAngel,sAngel+2*Math.PI*per,true);
}
ctx.fill();
ctx.stroke();
if( per >= 1){
component.find('.text').css('transition','all 0s');
// --- H5ComponentPie.reSort( component.find('.text') );
// +++ 以下3行
component.find('.text').each(function (i) {
H5ComponentPie.reSort( component.find('.text').slice(i) )
})
component.find('.text').css('transition','all 1s');
component.find('.text').css('opacity',1);
ctx.clearRect(0,0,w,h);
}
}
draw(0);写回答
3回答
-
我看这个怎么改,排版都会有问题。不如在饼图旁边新增一个div来专门解释各区占比,配以和各区相同的颜色。
122016-07-21 -
Lyn
提问者
2016-07-20
// --- H5ComponentPie.reSort( component.find('.text') ); // +++ 以下3行 component.find('.text').each(function (i) { H5ComponentPie.reSort( component.find('.text').slice(i) ) })00 -
Lyn
提问者
2016-07-20
非常抱歉在代码中留了个BUG。
00
相似问题