|
|
8 |
define("core/chart_pie",["core/chart_base"],(function(Base){function Pie(){Base.prototype.constructor.apply(this,arguments)}return Pie.prototype=Object.create(Base.prototype),Pie.prototype.TYPE="pie",Pie.prototype._doughnut=null,Pie.prototype.create=function(Klass,data){var chart=Base.prototype.create.apply(this,arguments);return chart.setDoughnut(data.doughnut),chart},Pie.prototype.addSeries=function(series){if(null===series.getColor()){for(var colors=[],configColorSet=this.getConfigColorSet()||Base.prototype.COLORSET,i=0;i<series.getCount();i++)colors.push(configColorSet[i%configColorSet.length]);series.setColors(colors)}return Base.prototype.addSeries.apply(this,arguments)},Pie.prototype.getDoughnut=function(){return this._doughnut},Pie.prototype.setDoughnut=function(doughnut){this._doughnut=Boolean(doughnut)},Pie.prototype._validateSeries=function(){if(this._series.length>=1)throw new Error("Pie charts only support one serie.");return Base.prototype._validateSeries.apply(this,arguments)},Pie}));
|