You just need to clean and redraw your cake, like this script .
var myRadius; myRadius = 200; var myChart = Raphael("myChartDiv"), myChartPie = myChart.piechart( myRadius, // cx myRadius, // cy myRadius, //Radius [70, 30], //Data { colors: ["#eb5e57", "#ebad50"], stroke: "#f1eeea" } ); $('#myButton').click(function(){ if(myRadius == 200) myRadius = 500; else myRadius = 200; myChart.clear(); myChartPie = myChart.piechart( myRadius, // cx myRadius, // cy myRadius, //Radius [70, 30], //Data { colors: ["#eb5e57", "#ebad50"], stroke: "#f1eeea" } ); });
Of course, data and parameters should be factorized and placed in a global area for ease of use.
source share