Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/svg/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Svg 将动画选项添加到raphaeljs饼图_Svg_Raphael_Graphael - Fatal编程技术网

Svg 将动画选项添加到raphaeljs饼图

Svg 将动画选项添加到raphaeljs饼图,svg,raphael,graphael,Svg,Raphael,Graphael,我想用raphaeljs插件绘制动画饼图; 我在g.raphaeljs库中发现了一个饼图函数(Paper.piechart),这是一个与之相关的演示 但我不知道如何在不重新渲染绘图的情况下(在执行事件时)设置此图表的动画 就像这个演示: 画 换句话说,我想在第一个演示中添加第二个演示的动画选项。 有人能帮我吗?这是一个拉斐尔饼图的工作演示,它在创建时不断增长,在鼠标悬停时具有“切片反弹”效果: <div id="pie"></div> <script>

我想用raphaeljs插件绘制动画饼图; 我在g.raphaeljs库中发现了一个饼图函数(Paper.piechart),这是一个与之相关的演示

但我不知道如何在不重新渲染绘图的情况下(在执行事件时)设置此图表的动画 就像这个演示:

画 换句话说,我想在第一个演示中添加第二个演示的动画选项。
有人能帮我吗?

这是一个拉斐尔饼图的工作演示,它在创建时不断增长,在鼠标悬停时具有“切片反弹”效果:

<div id="pie"></div>
<script>
 var paper = Raphael("pie", 400, 200);
 var pie = paper.piechart(
   100, // pie center x coordinate
   100, // pie center y coordinate
   90,  // pie radius
    [18.373, 18.686, 2.867, 23.991, 9.592, 0.213], // values
    {
    legend: ["Windows/Windows Live", "Server/Tools", "Online Services", "Business", "Entertainment/Devices", "Unallocated/Other"]
    }
  );

//animation - grow pie      
pie.each(function(){
    this.sector.scale(0, 0, this.cx, this.cy);
    this.sector.animate({ transform: "s1 1 " + this.cx + " " + this.cy }, 1000, "bounce");
});

// Bounce pie slice
pie.hover(function () {
  this.sector.stop();
  this.sector.animate({ transform: "s1.1, 1.1 " + this.cx + " " + this.cy }, 500, "bounce");
  this.label[0].attr({ r: 7.5 });
  this.label[1].attr({ "font-weight": 800 });
},

function () {
  this.sector.animate({ transform: "s1 1 " + this.cx + " " + this.cy }, 500, "bounce");
  this.label[0].animate({ r: 5 }, 500, "bounce");
  this.label[1].attr({ "font-weight": 400 });

})

</script>

var paper=Raphael(“派”,400200);
var pie=纸张。piechart(
100,//饼图中心x坐标
100,//饼图中心y坐标
90,//饼图半径
[18.373,18.686,2.867,23.991,9.592,0.213],//数值
{
图例:[“Windows/Windows Live”、“服务器/工具”、“在线服务”、“业务”、“娱乐/设备”、“未分配/其他”]
}
);
//动画-成长派
pie.each(函数(){
this.sector.scale(0,0,this.cx,this.cy);
this.sector.animate({transform:“s11”+this.cx+“”+this.cy},1000,“bounce”);
});
//弹跳馅饼片
悬停(函数(){
此.sector.stop();
this.sector.animate({transform:“s1.1,1.1”+this.cx+“”+this.cy},500,“bounce”);
this.label[0].attr({r:7.5});
this.label[1].attr({“font-weight”:800});
},
函数(){
this.sector.animate({transform:“s11”+this.cx+“”+this.cy},500,“bounce”);
this.label[0]。设置动画({r:5},500,“反弹”);
this.label[1].attr({“font-weight”:400});
})
他正在使用绘制饼图切片并设置其动画。看一看页面的源代码。