text:
try{
if(typeof (MochiKit.Base)=="undefined"||typeof (MochiKit.DOM)=="undefined"||typeof (MochiKit.Color)=="undefined"||typeof (MochiKit.Format)=="undefined"){
throw "";
}
}
catch(e){
throw "PlotKit depends on MochiKit.{Base,Color,DOM,Format}";
}
MochiKit.Base.update(MochiKit.Color.Color.prototype,{asFillColor:function(){
return this.lighterColorWithLevel(0.3);
},asStrokeColor:function(){
return this.darkerColorWithLevel(0.1);
},asPointColor:function(){
return this.lighterColorWithLevel(0.1);
},asTransparent:function(){
return this.colorWithAlpha(0.1);
}});
if(typeof (PlotKit)=="undefined"){
PlotKit={};
}
PlotKit.NAME="PlotKit";
PlotKit.VERSION="0.9.2";
PlotKit.__repr__=function(){
return "["+this.NAME+" "+this.VERSION+"]";
};
PlotKit.toString=function(){
return this.__repr__();
};
if(typeof (PlotKit.Base)=="undefined"){
PlotKit.Base={};
}
PlotKit.Base.NAME="PlotKit.Base";
PlotKit.Base.VERSION=PlotKit.VERSION;
PlotKit.Base.__repr__=function(){
return "["+this.NAME+" "+this.VERSION+"]";
};
PlotKit.Base.toString=function(){
return this.__repr__();
};
PlotKit.Base.usingPrototype=function(){
try{
return (typeof (Object.extend)=="function");
}
catch(e){
return false;
}
};
MochiKit.Base.update(PlotKit.Base,{roundInterval:function(_1,_2,_3){
var _4=MochiKit.Format.roundToFixed;
var _5=_1/_2;
return parseFloat(_4(_5,_3));
},collapse:function(_6){
var m=MochiKit.Base;
var _8=new Array();
for(var i=0;i<_6.length;i++){
_8=m.concat(_8,_6[i]);
}
if(PlotKit.Base.usingPrototype()){
delete _8.extend;
delete _8.from;
delete _8.inspect;
}
return _8;
},uniq:function(_10){
var m=MochiKit.Base;
if(!m.isArrayLike(_10)||(_10.length<1)){
return new Array();
}
var _11=new Array();
var _12=_10[0];
_11.push(_10[0]);
for(var i=1;i<_10.length;i++){
if(m.compare(_10[i],_12)!=0){
_12=_10[i];
_11.push(_10[i]);
}
}
return _11;
},colorScheme:function(){
var mb=MochiKit.Base;
var mc=MochiKit.Color;
var _15=["red","orange","yellow","green","cyan","blue","purple","magenta"];
var _16=function(_17){
return mc.Color[_17+"Color"]();
};
return mb.map(_16,_15);
},baseDarkPrimaryColors:function(){
var _18=MochiKit.Color.Color.fromHexString;
return [_18("#ad3f40"),_18("#ddac2c"),_18("#dfdd0c"),_18("#5276c4"),_18("#739c5a")];
},basePrimaryColors:function(){
var _19=MochiKit.Color.Color.fromHexString;
return [_19("#d24c4d"),_19("#f2b32f"),_19("#ece90e"),_19("#5d83da"),_19("#78a15d")];
},baseBlueColors:function(){
var _20=MochiKit.Color.Color.fromHexString;
return [_20("#4b6b94"),_20("#5d81b4"),_20("#acbad2")];
},palette:function(_21,_22,_23,_24){
var _25=MochiKit.Base.isUndefinedOrNull;
var _26=new Array();
if(_25(_24)){
_24=0.1;
}
if(_25(_23)){
_23=0.4;
}
if(_25(_22)){
_22=-0.2;
}
var _27=_22;
while(_27<=_23){
_26.push(_27);
_27+=_24;
}
var _28=function(_29,_30){
return _29.lighterColorWithLevel(_30);
};
return MochiKit.Base.map(MochiKit.Base.partial(_28,_21),_26);
},excanvasSupported:function(){
if(/MSIE/.test(navigator.userAgent)&&!window.opera){
return true;
}
return false;
},findPosX:function(obj){
var _32=0;
if(obj.offsetParent){
while(obj.offsetParent){
_32+=obj.offsetLeft;
obj=obj.offsetParent;
}
}else{
if(obj.x){
_32+=obj.x;
}
}
return _32;
},findPosY:function(obj){
var _33=0;
if(obj.offsetParent){
while(obj.offsetParent){
_33+=obj.offsetTop;
obj=obj.offsetParent;
}
}else{
if(obj.y){
_33+=obj.y;
}
}
return _33;
},isFuncLike:function(obj){
return (typeof (obj)=="function");
}});
PlotKit.Base.map=function(fn,lst){
if(PlotKit.Base.usingPrototype()){
var _36=[];
for(var x in lst){
if(typeof (lst[x])=="function"){
continue;
}
_36.push(fn(lst[x]));
}
return _36;
}else{
return MochiKit.Base.map(fn,lst);
}
};
PlotKit.Base.items=function(lst){
if(PlotKit.Base.usingPrototype()){
var _38=[];
for(var x in lst){
if(typeof (lst[x])=="function"){
continue;
}
_38.push([x,lst[x]]);
}
return _38;
}else{
return MochiKit.Base.items(lst);
}
};
PlotKit.Base.keys=function(lst){
if(PlotKit.Base.usingPrototype()){
var _39=[];
for(var x in lst){
if(typeof (lst[x])=="function"){
continue;
}
_39.push(x);
}
return _39;
}else{
return MochiKit.Base.keys(lst);
}
};
PlotKit.Base.baseColors=function(){
var _40=MochiKit.Color.Color.fromHexString;
return [_40("#476fb2"),_40("#be2c2b"),_40("#85b730"),_40("#734a99"),_40("#26a1c5"),_40("#fb8707"),_40("#000000")];
};
PlotKit.Base.googleColors=function(){
var _41=MochiKit.Color.Color.fromHexString;
return [_41("#0066dd"),_41("#dc3912"),_41("#ff9900"),_41("#008000"),_41("#4942cc"),_41("#990099")];
};
PlotKit.Base.googleStyle=function(){
var r={"colorScheme":PlotKit.Base.googleColors(),"backgroundColor":MochiKit.Color.Color.whiteColor(),"strokeWidth":2,"axisLineWidth":2,"strokeColor":null,"strokeColorTransform":null,"fillColorTransform":"asTransparent","shouldFill":true};
return r;
};
PlotKit.Base.officeBaseStyle={"axisLineWidth":2,"axisLabelColor":MochiKit.Color.Color.grayColor(),"axisLineColor":MochiKit.Color.Color.whiteColor(),"padding":{top:5,bottom:10,left:30,right:30}};
MochiKit.Base.update(PlotKit.Base,{officeBlue:function(){
var r={"colorScheme":PlotKit.Base.palette(PlotKit.Base.baseColors()[0]),"backgroundColor":PlotKit.Base.baseColors()[0].lighterColorWithLevel(0.45)};
MochiKit.Base.update(r,PlotKit.Base.officeBaseStyle);
return r;
},officeRed:function(){
var r={"colorScheme":PlotKit.Base.palette(PlotKit.Base.baseColors()[1]),"backgroundColor":PlotKit.Base.baseColors()[1].lighterColorWithLevel(0.5)};
MochiKit.Base.update(r,PlotKit.Base.officeBaseStyle);
return r;
},officeGreen:function(){
var r={"colorScheme":PlotKit.Base.palette(PlotKit.Base.baseColors()[2]),"backgroundColor":PlotKit.Base.baseColors()[2].lighterColorWithLevel(0.5)};
MochiKit.Base.update(r,PlotKit.Base.officeBaseStyle);
return r;
},officePurple:function(){
var r={"colorScheme":PlotKit.Base.palette(PlotKit.Base.baseColors()[3]),"backgroundColor":PlotKit.Base.baseColors()[3].lighterColorWithLevel(0.5)};
MochiKit.Base.update(r,PlotKit.Base.officeBaseStyle);
return r;
},officeCyan:function(){
var r={"colorScheme":PlotKit.Base.palette(PlotKit.Base.baseColors()[4]),"backgroundColor":PlotKit.Base.baseColors()[4].lighterColorWithLevel(0.5)};
MochiKit.Base.update(r,PlotKit.Base.officeBaseStyle);
return r;
},officeOrange:function(){
var r={"colorScheme":PlotKit.Base.palette(PlotKit.Base.baseColors()[5]),"backgroundColor":PlotKit.Base.baseColors()[5].lighterColorWithLevel(0.4)};
MochiKit.Base.update(r,PlotKit.Base.officeBaseStyle);
return r;
},officeBlack:function(){
var r={"colorScheme":PlotKit.Base.palette(PlotKit.Base.baseColors()[6],0,0.6),"backgroundColor":PlotKit.Base.baseColors()[6].lighterColorWithLevel(0.9)};
MochiKit.Base.update(r,PlotKit.Base.officeBaseStyle);
return r;
}});
PlotKit.Base.EXPORT=["baseColors","collapse","colorScheme","findPosX","findPosY","officeBaseStyle","officeBlue","officeRed","officeGreen","officePurple","officeCyan","officeOrange","officeBlack","roundInterval","uniq","isFuncLike","excanvasSupported"];
PlotKit.Base.EXPORT_OK=[];
PlotKit.Base.__new__=function(){
var m=MochiKit.Base;
m.nameFunctions(this);
this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)};
};
PlotKit.Base.__new__();
MochiKit.Base._exportSymbols(this,PlotKit.Base);
try{
if(typeof (PlotKit.Base)=="undefined"){
throw "";
}
}
catch(e){
throw "PlotKit.Layout depends on MochiKit.{Base,Color,DOM,Format} and PlotKit.Base";
}
if(typeof (PlotKit.Layout)=="undefined"){
PlotKit.Layout={};
}
PlotKit.Layout.NAME="PlotKit.Layout";
PlotKit.Layout.VERSION=PlotKit.VERSION;
PlotKit.Layout.__repr__=function(){
return "["+this.NAME+" "+this.VERSION+"]";
};
PlotKit.Layout.toString=function(){
return this.__repr__();
};
PlotKit.Layout.valid_styles=["bar","line","pie","point"];
PlotKit.Layout=function(_43,_44){
this.options={"barWidthFillFraction":0.75,"barOrientation":"vertical","xOriginIsZero":true,"yOriginIsZero":true,"xAxis":null,"yAxis":null,"xTicks":null,"yTicks":null,"xNumberOfTicks":10,"yNumberOfTicks":5,"xTickPrecision":1,"yTickPrecision":1,"pieRadius":0.4};
this.style=_43;
MochiKit.Base.update(this.options,_44?_44:{});
if(!MochiKit.Base.isUndefinedOrNull(this.options.xAxis)){
this.minxval=this.options.xAxis[0];
this.maxxval=this.options.xAxis[1];
this.xscale=this.maxxval-this.minxval;
}else{
this.minxval=0;
this.maxxval=null;
this.xscale=null;
}
if(!MochiKit.Base.isUndefinedOrNull(this.options.yAxis)){
this.minyval=this.options.yAxis[0];
this.maxyval=this.options.yAxis[1];
this.yscale=this.maxyval-this.minyval;
}else{
this.minyval=0;
this.maxyval=null;
this.yscale=null;
}
this.bars=new Array();
this.points=new Array();
this.slices=new Array();
this.xticks=new Array();
this.yticks=new Array();
this.datasets=new Array();
this.minxdelta=0;
this.xrange=1;
this.yrange=1;
this.hitTestCache={x2maxy:null};
};
PlotKit.Layout.prototype.addDataset=function(_45,_46){
this.datasets[_45]=_46;
};
PlotKit.Layout.prototype.removeDataset=function(_47,_48){
delete this.datasets[_47];
};
PlotKit.Layout.prototype.addDatasetFromTable=function(_49,_50,_51,_52,_53){
var _54=MochiKit.Base.isUndefinedOrNull;
var _55=MochiKit.DOM.scrapeText;
var _56=MochiKit.Format.strip;
if(_54(_51)){
_51=0;
}
if(_54(_52)){
_52=1;
}
if(_54(_53)){
_53=-1;
}
var _57=_50.tBodies[0].rows;
var _58=new Array();
var _59=new Array();
if(!_54(_57)){
for(var i=0;i<_57.length;i++){
_58.push([parseFloat(_56(_55(_57[i].cells[_51]))),parseFloat(_56(_55(_57[i].cells[_52])))]);
if(_53>=0){
_59.push({v:parseFloat(_56(_55(_57[i].cells[_51]))),label:_56(_55(_57[i].cells[_53]))});
}
}
this.addDataset(_49,_58);
if(_53>=0){
this.options.xTicks=_59;
}
return true;
}
return false;
};
PlotKit.Layout.prototype.evaluate=function(){
this._evaluateLimits();
this._evaluateScales();
if(this.style=="bar"){
if(this.options.barOrientation=="horizontal"){
this._evaluateHorizBarCharts();
}else{
this._evaluateBarCharts();
}
this._evaluateBarTicks();
}else{
if(this.style=="pie"){
this._evaluatePieCharts();
this._evaluatePieTicks();
}else{
this._evaluateLineCharts();
this._evaluateLineTicks();
}
}
};
PlotKit.Layout.prototype.hitTest=function(x,y){
var f=MochiKit.Format.twoDigitFloat;
if((this.style=="bar")&&this.bars&&(this.bars.length>0)){
for(var i=0;i<this.bars.length;i++){
var bar=this.bars[i];
if((x>=bar.x)&&(x<=bar.x+bar.w)&&(y>=bar.y)&&(y-bar.y<=bar.h)){
return bar;
}
}
}else{
if(this.style=="line"){
if(this.hitTestCache.x2maxy==null){
this._regenerateHitTestCache();
}
var _63=x/this.xscale;
var _64=this.hitTestCache.xvalues;
var _65=null;
var _66=null;
for(var i=1;i<_64.length;i++){
if(_64[i]>_63){
_65=_64[i-1];
_66=_64[i];
break;
}
}
if((_65!=null)){
var _67=this.hitTestCache.x2maxy[_65];
var _68=this.hitTestCache.x2maxy[_66];
var _69=(1-y)/this.yscale;
var _70=(_68-_67)/(_66-_65);
var _71=_67+_70*(_63-_65);
if(_71>=_69){
var obj={xval:_63,yval:_69,xafter:_66,yafter:_68,xbefore:_65,ybefore:_67,yprojected:_71};
return obj;
}
}
}else{
if(this.style=="pie"){
x=2*x-0.5;
var _72=Math.sqrt((y-0.5)*(y-0.5)+(x-0.5)*(x-0.5));
if(_72>this.options.pieRadius){
return null;
}
var _73=0;
if(y<0.5&&x<0.5){
_73=Math.atan2(y-0.5,x-0.5)+5*Math.PI/2;
}else{
_73=Math.atan2(y-0.5,x-0.5)+Math.PI/2;
}
for(var i=0;i<this.slices.length;i++){
var _74=this.slices[i];
if(_74.startAngle<_73&&_74.endAngle>=_73){
return _74;
}
}
}
}
}
return null;
};
PlotKit.Layout.prototype.rectForX=function(x){
return null;
};
PlotKit.Layout.prototype.angleRangeForX=function(x){
return null;
};
PlotKit.Layout.prototype._evaluateLimits=function(){
var map=PlotKit.Base.map;
var _76=PlotKit.Base.items;
var _77=MochiKit.Base.itemgetter;
var _78=PlotKit.Base.collapse;
var _79=MochiKit.Base.listMin;
var _80=MochiKit.Base.listMax;
var _81=MochiKit.Base.isUndefinedOrNull;
var all=_78(map(_77(1),_76(this.datasets)));
if(_81(this.options.xAxis)){
if(this.options.xOriginIsZero){
this.minxval=0;
}else{
this.minxval=_79(map(parseFloat,map(_77(0),all)));
}
this.maxxval=_80(map(parseFloat,map(_77(0),all)));
}else{
this.minxval=this.options.xAxis[0];
this.maxxval=this.options.xAxis[1];
this.xscale=this.maxval-this.minxval;
}
if(_81(this.options.yAxis)){
if(this.options.yOriginIsZero){
this.minyval=0;
}else{
this.minyval=_79(map(parseFloat,map(_77(1),all)));
}
this.maxyval=_80(map(parseFloat,map(_77(1),all)));
}else{
this.minyval=this.options.yAxis[0];
this.maxyval=this.options.yAxis[1];
this.yscale=this.maxyval-this.minyval;
}
};
PlotKit.Layout.prototype._evaluateScales=function(){
var _83=MochiKit.Base.isUndefinedOrNull;
this.xrange=this.maxxval-this.minxval;
if(this.xrange==0){
this.xscale=1;
}else{
this.xscale=1/this.xrange;
}
this.yrange=this.maxyval-this.minyval;
if(this.yrange==0){
this.yscale=1;
}else{
this.yscale=1/this.yrange;
}
};
PlotKit.Layout.prototype._uniqueXValues=function(_84){
var _85=PlotKit.Base.collapse;
var map=PlotKit.Base.map;
var _86=PlotKit.Base.uniq;
var _87=MochiKit.Base.itemgetter;
var _88=PlotKit.Base.items;
var _89=map(parseFloat,map(_87(0),_85(map(_87(1),_88(this.datasets)))));
try{
_89=MochiKit.Base.concat(_89,_84);
}
catch(e){
}
_89.sort(MochiKit.Base.compare);
return _86(_89);
};
PlotKit.Layout.prototype._barChartXDelta=function(){
var _90=(this.xrange==0)?this.maxxval:this.xrange;
var _91=this._uniqueXValues([this.minxval,this.maxxval]);
for(var i=1;i<_91.length;i++){
_90=Math.min(Math.abs(_91[i]-_91[i-1]),_90);
}
return _90;
};
PlotKit.Layout.prototype._evaluateBarCharts=function(){
var _92=PlotKit.Base.items;
var _93=_92(this.datasets).length;
var _94=this._barChartXDelta();
this.xscale=1/(this.xrange+_94);
var _95=_94*this.xscale*this.options.barWidthFillFraction;
var _96=_95/_93;
var _97=(_94*this.xscale-_95)/2;
this.minxdelta=_94;
this.bars=new Array();
var i=0;
for(var _98 in this.datasets){
var _99=this.datasets[_98];
if(PlotKit.Base.isFuncLike(_99)){
continue;
}
for(var j=0;j<_99.length;j++){
var item=_99[j];
var rect={x:((parseFloat(item[0])-this.minxval)*this.xscale)+(i*_96)+_97,y:1-((parseFloat(item[1])-this.minyval)*this.yscale),w:_96,h:((parseFloat(item[1])-this.minyval)*this.yscale),xval:parseFloat(item[0]),yval:parseFloat(item[1]),name:_98};
if((rect.x>=0)&&(rect.x<=1)&&(rect.y>=0)&&(rect.y<=1)){
this.bars.push(rect);
}
}
i++;
}
};
PlotKit.Layout.prototype._evaluateHorizBarCharts=function(){
var _103=PlotKit.Base.items;
var _104=_103(this.datasets).length;
var _105=this._barChartXDelta();
this.xscale=1/(this.xrange+_105);
var _106=_105*this.xscale*this.options.barWidthFillFraction;
var _107=_106/_104;
var _108=(_105*this.xscale-_106)/2;
this.minxdelta=_105;
this.bars=new Array();
var i=0;
for(var _109 in this.datasets){
var _110=this.datasets[_109];
if(PlotKit.Base.isFuncLike(_110)){
continue;
}
for(var j=0;j<_110.length;j++){
var item=_110[j];
var rect={y:((parseFloat(item[0])-this.minxval)*this.xscale)+(i*_107)+_108,x:0,h:_107,w:((parseFloat(item[1])-this.minyval)*this.yscale),xval:parseFloat(item[0]),yval:parseFloat(item[1]),name:_109};
if(rect.y<=0){
rect.y=0;
}
if(rect.y>=1){
rect.y=1;
}
if((rect.x>=0)&&(rect.x<=1)){
this.bars.push(rect);
}
}
i++;
}
};
PlotKit.Layout.prototype._evaluateLineCharts=function(){
var _111=PlotKit.Base.items;
var _112=_111(this.datasets).length;
this.points=new Array();
var i=0;
for(var _113 in this.datasets){
var _114=this.datasets[_113];
if(PlotKit.Base.isFuncLike(_114)){
continue;
}
if(this.style!="area"){
_114.sort(function(a,b){
return MochiKit.Base.compare(parseFloat(a[0]),parseFloat(b[0]));
});
}
for(var j=0;j<_114.length;j++){
var item=_114[j];
var _117={x:((parseFloat(item[0])-this.minxval)*this.xscale),y:1-((parseFloat(item[1])-this.minyval)*this.yscale),xval:parseFloat(item[0]),yval:parseFloat(item[1]),name:_113};
if(_117.y<=0){
_117.y=0;
}
if(_117.y>=1){
_117.y=1;
}
if((_117.x>=0)&&(_117.x<=1)){
this.points.push(_117);
}
}
i++;
}
};
PlotKit.Layout.prototype._evaluatePieCharts=function(){
var map=PlotKit.Base.map;
var _118=PlotKit.Base.items;
var sum=MochiKit.Iter.sum;
var _120=MochiKit.Base.itemgetter;
var _121=_118(this.datasets).length;
var _122=_118(this.datasets)[0][1];
var _123=sum(map(_120(1),_122));
this.slices=new Array();
var _124=0;
for(var i=0;i<_122.length;i++){
var _125=_122[i][1]/_123;
var _126=_124*Math.PI*2;
var _127=(_124+_125)*Math.PI*2;
var _128={fraction:_125,xval:_122[i][0],yval:_122[i][1],startAngle:_126,endAngle:_127};
if(_122[i][1]!=0){
this.slices.push(_128);
}
_124+=_125;
}
};
PlotKit.Layout.prototype._evaluateLineTicksForXAxis=function(){
var _129=MochiKit.Base.isUndefinedOrNull;
if(this.options.xTicks){
this.xticks=new Array();
var _130=function(tick){
var _132=tick.label;
if(_129(_132)){
_132=tick.v.toString();
}
if(!_129(tick.tooltip)){
_132=MochiKit.DOM.SPAN({title:tick.tooltip},_132);
}
var pos=this.xscale*(tick.v-this.minxval);
if((pos>=0)&&(pos<=1)){
this.xticks.push([pos,_132]);
}
};
MochiKit.Iter.forEach(this.options.xTicks,MochiKit.Base.bind(_130,this));
}else{
if(this.options.xNumberOfTicks){
var _134=this._uniqueXValues();
var _135=this.xrange/this.options.xNumberOfTicks;
var _136=0;
this.xticks=new Array();
for(var i=0;i<=_134.length;i++){
if((_134[i]-this.minxval)>=(_136*_135)){
var pos=this.xscale*(_134[i]-this.minxval);
if((pos>1)||(pos<0)){
continue;
}
this.xticks.push([pos,_134[i]]);
_136++;
}
if(_136>this.options.xNumberOfTicks){
break;
}
}
}
}
};
PlotKit.Layout.prototype._evaluateLineTicksForYAxis=function(){
var _137=MochiKit.Base.isUndefinedOrNull;
if(this.options.yTicks){
this.yticks=new Array();
var _138=function(tick){
var _139=tick.label;
if(_137(_139)){
_139=tick.v.toString();
}
if(!_137(tick.tooltip)){
_139=MochiKit.DOM.SPAN({title:tick.tooltip},_139);
}
var pos=1-(this.yscale*(tick.v-this.minyval));
if((pos>=0)&&(pos<=1)){
this.yticks.push([pos,_139]);
}
};
MochiKit.Iter.forEach(this.options.yTicks,MochiKit.Base.bind(_138,this));
}else{
if(this.options.yNumberOfTicks){
this.yticks=new Array();
var _140=PlotKit.Base.roundInterval;
var prec=this.options.yTickPrecision;
var _142=_140(this.yrange,this.options.yNumberOfTicks,prec);
for(var i=0;i<=this.options.yNumberOfTicks;i++){
var yval=this.minyval+(i*_142);
var pos=1-((yval-this.minyval)*this.yscale);
if((pos>1)||(pos<0)){
continue;
}
this.yticks.push([pos,MochiKit.Format.roundToFixed(yval,prec)]);
}
}
}
};
PlotKit.Layout.prototype._evaluateLineTicks=function(){
this._evaluateLineTicksForXAxis();
this._evaluateLineTicksForYAxis();
};
PlotKit.Layout.prototype._evaluateBarTicks=function(){
this._evaluateLineTicks();
var _144=function(tick){
return [tick[0]+(this.minxdelta*this.xscale)/2,tick[1]];
};
this.xticks=MochiKit.Base.map(MochiKit.Base.bind(_144,this),this.xticks);
if(this.options.barOrientation=="horizontal"){
var _145=this.xticks;
this.xticks=this.yticks;
this.yticks=_145;
var _146=function(tick){
return [1-tick[0],tick[1]];
};
this.xticks=MochiKit.Base.map(_146,this.xticks);
}
};
PlotKit.Layout.prototype._evaluatePieTicks=function(){
var _147=MochiKit.Base.isUndefinedOrNull;
var _148=MochiKit.Format.numberFormatter("#%");
this.xticks=new Array();
if(this.options.xTicks){
var _149=new Array();
for(var i=0;i<this.slices.length;i++){
_149[this.slices[i].xval]=this.slices[i];
}
for(var i=0;i<this.options.xTicks.length;i++){
var tick=this.options.xTicks[i];
var _150=_149[tick.v];
var _151=tick.label;
if(_150){
if(_147(_151)){
_151=tick.v.toString();
}
if(this.options.pieValue=="value"){
_151+=" ("+_150.yval+")";
}else{
if(this.options.pieValue!="none"){
_151+=" ("+_148(_150.fraction)+")";
}
}
if(!_147(tick.tooltip)){
_151=MochiKit.DOM.SPAN({title:tick.tooltip},_151);
}
this.xticks.push([tick.v,_151]);
}
}
}else{
for(var i=0;i<this.slices.length;i++){
var _150=this.slices[i];
var _151=_150.xval+" ("+_148(_150.fraction)+")";
this.xticks.push([_150.xval,_151]);
}
}
};
PlotKit.Layout.prototype._regenerateHitTestCache=function(){
this.hitTestCache.xvalues=this._uniqueXValues();
this.hitTestCache.xlookup=new Array();
this.hitTestCache.x2maxy=new Array();
var _152=MochiKit.Base.listMax;
var _153=MochiKit.Base.itemgetter;
var map=MochiKit.Base.map;
var keys=MochiKit.Base.keys;
var _155=keys(this.datasets);
for(var i=0;i<_155.length;i++){
var _156=this.datasets[_155[i]];
for(var j=0;j<_156.length;j++){
var xval=_156[j][0];
var yval=_156[j][1];
if(this.hitTestCache.xlookup[xval]){
this.hitTestCache.xlookup[xval].push([yval,_155[i]]);
}else{
this.hitTestCache.xlookup[xval]=[[yval,_155[i]]];
}
}
}
for(var x in this.hitTestCache.xlookup){
var _158=this.hitTestCache.xlookup[x];
this.hitTestCache.x2maxy[x]=_152(map(_153(0),_158));
}
};
PlotKit.LayoutModule={};
PlotKit.LayoutModule.Layout=PlotKit.Layout;
PlotKit.LayoutModule.EXPORT=["Layout"];
PlotKit.LayoutModule.EXPORT_OK=[];
PlotKit.LayoutModule.__new__=function(){
var m=MochiKit.Base;
m.nameFunctions(this);
this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)};
};
PlotKit.LayoutModule.__new__();
MochiKit.Base._exportSymbols(this,PlotKit.LayoutModule);
try{
if((typeof (PlotKit.Base)=="undefined")||(typeof (PlotKit.Layout)=="undefined")){
throw "";
}
}
catch(e){
throw "PlotKit.Layout depends on MochiKit.{Base,Color,DOM,Format} and PlotKit.{Base,Layout}";
}
if(typeof (PlotKit.CanvasRenderer)=="undefined"){
PlotKit.CanvasRenderer={};
}
PlotKit.CanvasRenderer.NAME="PlotKit.CanvasRenderer";
PlotKit.CanvasRenderer.VERSION=PlotKit.VERSION;
PlotKit.CanvasRenderer.__repr__=function(){
return "["+this.NAME+" "+this.VERSION+"]";
};
PlotKit.CanvasRenderer.toString=function(){
return this.__repr__();
};
PlotKit.CanvasRenderer=function(_159,_160,_161){
if(arguments.length>0){
this.__init__(_159,_160,_161);
}
};
PlotKit.CanvasRenderer.prototype.__init__=function(_162,_163,_164){
var _165=MochiKit.Base.isUndefinedOrNull;
var _166=MochiKit.Color.Color;
this.options={"drawBackground":true,"backgroundColor":_166.whiteColor(),"padding":{left:30,right:30,top:5,bottom:10},"colorScheme":PlotKit.Base.palette(PlotKit.Base.baseColors()[0]),"strokeColor":null,"strokeColorTransform":"asStrokeColor","strokeWidth":0.5,"fillColorTransform":null,"shouldFill":true,"shouldStroke":true,"drawXAxis":true,"drawYAxis":true,"axisLineColor":_166.blackColor(),"axisLineWidth":0.5,"axisTickSize":3,"axisLabelColor":_166.blackColor(),"axisLabelFont":"Arial","axisLabelFontSize":9,"axisLabelWidth":50,"pieRadius":0.4,"enableEvents":true};
MochiKit.Base.update(this.options,_164?_164:{});
this.layout=_163;
this.element=MochiKit.DOM.getElement(_162);
this.container=this.element.parentNode;
this.isIE=PlotKit.Base.excanvasSupported();
if(this.isIE&&!_165(G_vmlCanvasManager)){
this.IEDelay=0.5;
this.maxTries=5;
this.renderDelay=null;
this.clearDelay=null;
this.element=G_vmlCanvasManager.initElement(this.element);
}
this.height=MochiKit.DOM.elementDimensions(this.element).h;
this.width=MochiKit.DOM.elementDimensions(this.element).w;
this.element.width=this.width;
this.element.height=this.height;
if(_165(this.element)){
throw "CanvasRenderer() - passed canvas is not found";
}
if(!this.isIE&&!(PlotKit.CanvasRenderer.isSupported(this.element))){
throw "CanvasRenderer() - Canvas is not supported.";
}
if(_165(this.container)||(this.container.nodeName.toLowerCase()!="div")){
throw "CanvasRenderer() - <canvas> needs to be enclosed in <div>";
}
this.xlabels=new Array();
this.ylabels=new Array();
this.isFirstRender=true;
this.area={x:this.options.padding.left,y:this.options.padding.top,w:this.width-this.options.padding.left-this.options.padding.right,h:this.height-this.options.padding.top-this.options.padding.bottom};
MochiKit.DOM.updateNodeAttributes(this.container,{"style":{"position":"relative","width":this.width+"px"}});
try{
this.event_isinside=null;
if(MochiKit.Signal&&this.options.enableEvents){
this._initialiseEvents();
}
}
catch(e){
}
};
PlotKit.CanvasRenderer.prototype.render=function(){
if(this.isIE){
try{
if(this.renderDelay){
this.renderDelay.cancel();
this.renderDelay=null;
}
var _167=this.element.getContext("2d");
}
catch(e){
this.isFirstRender=false;
if(this.maxTries-->0){
this.renderDelay=MochiKit.Async.wait(this.IEDelay);
this.renderDelay.addCallback(MochiKit.Base.bind(this.render,this));
}
return;
}
}
if(this.options.drawBackground){
this._renderBackground();
}
if(this.layout.style=="bar"){
this._renderBarChart();
this._renderBarAxis();
}else{
if(this.layout.style=="pie"){
this._renderPieChart();
this._renderPieAxis();
}else{
if(this.layout.style=="line"){
this._renderLineChart();
this._renderLineAxis();
}else{
if(this.layout.style=="point"){
this._renderLineAxis();
this._renderPointChart();
}else{
if(this.layout.style=="area"){
this._renderLineAxis();
this._renderAreaChart();
}
}
}
}
}
};
PlotKit.CanvasRenderer.prototype._renderBarChartWrap=function(data,_169){
var _170=this.element.getContext("2d");
var _171=this.options.colorScheme.length;
var _172=this.options.colorScheme;
var _173=MochiKit.Base.keys(this.layout.datasets);
var _174=_173.length;
for(var i=0;i<_174;i++){
var _175=_173[i];
var _176=_172[i%_171];
_170.save();
_170.fillStyle=this._fillColor(_176);
_170.strokeStyle=this._strokeColor(_176);
_170.lineWidth=this.options.strokeWidth;
var _177=function(obj){
if(obj.name==_175){
_169(_170,obj);
}
};
MochiKit.Iter.forEach(data,MochiKit.Base.bind(_177,this));
_170.restore();
}
};
PlotKit.CanvasRenderer.prototype._renderBarChart=function(){
var bind=MochiKit.Base.bind;
var _179=function(_180,bar){
var x=this.area.w*bar.x+this.area.x;
var y=this.area.h*bar.y+this.area.y;
var w=this.area.w*bar.w;
var h=this.area.h*bar.h;
if((w<1)||(h<1)){
return;
}
if(this.options.shouldFill){
_180.fillRect(x,y,w,h);
}
if(this.options.shouldStroke){
_180.strokeRect(x,y,w,h);
}
};
this._renderBarChartWrap(this.layout.bars,bind(_179,this));
};
PlotKit.CanvasRenderer.prototype._renderLineChart=function(){
var _183=this.element.getContext("2d");
var _184=this.options.colorScheme.length;
var _185=this.options.colorScheme;
var _186=MochiKit.Base.keys(this.layout.datasets);
var _187=_186.length;
var bind=MochiKit.Base.bind;
var _188=MochiKit.Base.partial;
for(var i=0;i<_187;i++){
var _189=_186[i];
var _190=_185[i%_184];
_183.save();
_183.fillStyle=this._fillColor(_190);
_183.strokeStyle=this._strokeColor(_190);
_183.lineWidth=this.options.strokeWidth;
var _191=function(ctx){
ctx.beginPath();
ctx.moveTo(this.area.x,this.area.y+this.area.h);
var _193=function(ctx_,_195){
if(_195.name==_189){
ctx_.lineTo(this.area.w*_195.x+this.area.x,this.area.h*_195.y+this.area.y);
}
};
MochiKit.Iter.forEach(this.layout.points,_188(_193,ctx),this);
if(this.options.shouldFill){
ctx.lineTo(this.area.w+this.area.x,this.area.h+this.area.y);
ctx.lineTo(this.area.x,this.area.y+this.area.h);
ctx.closePath();
}
};
if(!this.options.shouldFill){
_191=function(ctx){
ctx.beginPath();
var _196=null;
var _197=null;
var _198=function(ctx_,_199){
if(_199.name==_189){
var x=this.area.w*_199.x+this.area.x;
var y=this.area.h*_199.y+this.area.y;
if(_196==null){
ctx_.moveTo(x,y);
_196=x;
_197=y;
}else{
ctx_.lineTo(x,y);
}
}
};
MochiKit.Iter.forEach(this.layout.points,_188(_198,ctx),this);
ctx.moveTo(_196,_197);
ctx.closePath();
};
}
if(this.options.shouldFill){
bind(_191,this)(_183);
_183.fill();
}
if(this.options.shouldStroke){
bind(_191,this)(_183);
_183.stroke();
}
_183.restore();
}
};
PlotKit.CanvasRenderer.prototype._renderPieChart=function(){
var _200=this.element.getContext("2d");
var _201=this.options.colorScheme.length;
var _202=this.layout.slices;
var _203=this.area.x+this.area.w*0.5;
var _204=this.area.y+this.area.h*0.5;
var _205=Math.min(this.area.w*this.options.pieRadius,this.area.h*this.options.pieRadius);
if(this.isIE){
_203=parseInt(_203);
_204=parseInt(_204);
_205=parseInt(_205);
}
for(var i=0;i<_202.length;i++){
var _206=this.options.colorScheme[i%_201];
_200.save();
_200.fillStyle=this._fillColor(_206);
var _207=function(){
_200.beginPath();
_200.moveTo(_203,_204);
_200.arc(_203,_204,_205,_202[i].startAngle-Math.PI/2,_202[i].endAngle-Math.PI/2,false);
_200.lineTo(_203,_204);
_200.closePath();
};
if(Math.abs(_202[i].startAngle-_202[i].endAngle)>0.001){
if(this.options.shouldFill){
_207();
_200.fill();
}
if(this.options.shouldStroke){
_207();
_200.lineWidth=this.options.strokeWidth;
_200.strokeStyle=this._strokeColor(_206);
_200.stroke();
}
}
_200.restore();
}
};
PlotKit.CanvasRenderer.prototype._renderPointChart=function(){
var _208=this.element.getContext("2d");
var _209=this.options.colorScheme.length;
var _210=this.options.colorScheme;
var _211=MochiKit.Base.keys(this.layout.datasets);
var _212=_211.length;
var bind=MochiKit.Base.bind;
for(var i=0;i<_212;i++){
var _213=_211[i];
var _214=_210[i%_209];
_208.save();
_208.fillStyle=this._fillColor(_214);
_208.lineWidth=this.options.strokeWidth;
var _215=function(ctx,_216){
if(_216.name==_213){
ctx.beginPath();
ctx.arc(this.area.w*_216.x+this.area.x,this.area.h*_216.y+this.area.y,this.options.strokeWidth*5,0,2*Math.PI,false);
ctx.closePath();
ctx.fill();
}
};
MochiKit.Iter.forEach(this.layout.points,bind(_215,this,_208));
_208.restore();
}
};
PlotKit.CanvasRenderer.prototype._renderAreaChart=function(){
var _217=this.element.getContext("2d");
var _218=this.options.colorScheme.length;
var _219=this.options.colorScheme;
var _220=MochiKit.Base.keys(this.layout.datasets);
var _221=_220.length;
var bind=MochiKit.Base.bind;
var _222=MochiKit.Base.partial;
for(var i=0;i<_221;i++){
var _223=_220[i];
var _224=_219[i%_218];
_217.save();
_217.fillStyle=this._fillColor(_224);
_217.strokeStyle=this._strokeColor(_224);
_217.lineWidth=this.options.strokeWidth;
var _225=function(ctx){
ctx.beginPath();
var _226=null;
var _227=null;
var _228=function(ctx_,_229){
if(_229.name==_223){
var x=this.area.w*_229.x+this.area.x;
var y=this.area.h*_229.y+this.area.y;
if(_226==null){
ctx_.moveTo(x,y);
_226=x;
_227=y;
}else{
ctx_.lineTo(x,y);
}
}
};
MochiKit.Iter.forEach(this.layout.points,_222(_228,ctx),this);
ctx.lineTo(_226,_227);
ctx.closePath();
};
if(this.options.shouldFill){
bind(_225,this)(_217);
_217.fill();
}
if(this.options.shouldStroke){
bind(_225,this)(_217);
_217.stroke();
}
_217.restore();
}
};
PlotKit.CanvasRenderer.prototype._renderBarAxis=function(){
this._renderAxis();
};
PlotKit.CanvasRenderer.prototype._renderLineAxis=function(){
this._renderAxis();
};
PlotKit.CanvasRenderer.prototype._renderAxis=function(){
if(!this.options.drawXAxis&&!this.options.drawYAxis){
return;
}
var DIV=MochiKit.DOM.DIV;
var _231=this.element.getContext("2d");
var _232={"style":{"position":"absolute","fontSize":this.options.axisLabelFontSize+"px","zIndex":10,"color":this.options.axisLabelColor.toRGBString(),"width":this.options.axisLabelWidth+"px","overflow":"visible"}};
_231.save();
_231.strokeStyle=this.options.axisLineColor.toRGBString();
_231.lineWidth=this.options.axisLineWidth;
if(this.options.drawYAxis){
if(this.layout.yticks){
var _233=function(tick){
if(typeof (tick)=="function"){
return;
}
var x=this.area.x;
var y=this.area.y+tick[0]*this.area.h;
_231.beginPath();
_231.moveTo(x,y);
_231.lineTo(x-this.options.axisTickSize,y);
_231.closePath();
_231.stroke();
var _234=DIV(_232,tick[1]);
_234.style.top=(y-this.options.axisLabelFontSize)+"px";
_234.style.left=(x-this.options.padding.left-this.options.axisTickSize)+"px";
_234.style.textAlign="right";
_234.style.width=(this.options.padding.left-this.options.axisTickSize*2)+"px";
MochiKit.DOM.appendChildNodes(this.container,_234);
this.ylabels.push(_234);
};
MochiKit.Iter.forEach(this.layout.yticks,MochiKit.Base.bind(_233,this));
}
_231.beginPath();
_231.moveTo(this.area.x,this.area.y);
_231.lineTo(this.area.x,this.area.y+this.area.h);
_231.closePath();
_231.stroke();
}
if(this.options.drawXAxis){
if(this.layout.xticks){
var _233=function(tick){
if(typeof (dataset)=="function"){
return;
}
var x=this.area.x+tick[0]*this.area.w;
var y=this.area.y+this.area.h;
_231.beginPath();
_231.moveTo(x,y);
_231.lineTo(x,y+this.options.axisTickSize);
_231.closePath();
_231.stroke();
var _235=DIV(_232,tick[1]);
_235.style.top=(y+this.options.axisTickSize)+"px";
_235.style.left=(x-this.options.axisLabelWidth/2)+"px";
_235.style.textAlign="center";
_235.style.width=this.options.axisLabelWidth+"px";
MochiKit.DOM.appendChildNodes(this.container,_235);
this.xlabels.push(_235);
};
MochiKit.Iter.forEach(this.layout.xticks,MochiKit.Base.bind(_233,this));
}
_231.beginPath();
_231.moveTo(this.area.x,this.area.y+this.area.h);
_231.lineTo(this.area.x+this.area.w,this.area.y+this.area.h);
_231.closePath();
_231.stroke();
}
_231.restore();
};
PlotKit.CanvasRenderer.prototype._renderPieAxis=function(){
if(!this.options.drawXAxis){
return;
}
if(this.layout.xticks){
var _236=new Array();
for(var i=0;i<this.layout.slices.length;i++){
_236[this.layout.slices[i].xval]=this.layout.slices[i];
}
var _237=this.area.x+this.area.w*0.5;
var _238=this.area.y+this.area.h*0.5;
var _239=Math.min(this.area.w*this.options.pieRadius,this.area.h*this.options.pieRadius);
var _240=this.options.axisLabelWidth;
for(var i=0;i<this.layout.xticks.length;i++){
var _241=_236[this.layout.xticks[i][0]];
if(MochiKit.Base.isUndefinedOrNull(_241)){
continue;
}
var _242=(_241.startAngle+_241.endAngle)/2;
var _243=_242;
if(_243>Math.PI*2){
_243=_243-Math.PI*2;
}else{
if(_243<0){
_243=_243+Math.PI*2;
}
}
var _244=_237+Math.sin(_243)*(_239+10);
var _245=_238-Math.cos(_243)*(_239+10);
var _246={"position":"absolute","zIndex":11,"width":_240+"px","fontSize":this.options.axisLabelFontSize+"px","overflow":"visible","color":this.options.axisLabelColor.toHexString()};
if(_243<=Math.PI*0.5){
_246["textAlign"]="left";
_246["verticalAlign"]="top";
_246["left"]=_244+"px";
_246["top"]=(_245-this.options.axisLabelFontSize)+"px";
}else{
if((_243>Math.PI*0.5)&&(_243<=Math.PI)){
_246["textAlign"]="left";
_246["verticalAlign"]="bottom";
_246["left"]=_244+"px";
_246["top"]=_245+"px";
}else{
if((_243>Math.PI)&&(_243<=Math.PI*1.5)){
_246["textAlign"]="right";
_246["verticalAlign"]="bottom";
_246["left"]=(_244-_240)+"px";
_246["top"]=_245+"px";
}else{
_246["textAlign"]="right";
_246["verticalAlign"]="bottom";
_246["left"]=(_244-_240)+"px";
_246["top"]=(_245-this.options.axisLabelFontSize)+"px";
}
}
}
var _247=MochiKit.DOM.DIV({"style":_246},this.layout.xticks[i][1]);
this.xlabels.push(_247);
MochiKit.DOM.appendChildNodes(this.container,_247);
}
}
};
PlotKit.CanvasRenderer.prototype._renderBackground=function(){
var _248=this.element.getContext("2d");
_248.save();
_248.fillStyle=this.options.backgroundColor.toRGBString();
_248.fillRect(0,0,this.width,this.height);
_248.restore();
};
PlotKit.CanvasRenderer.prototype.clear=function(){
if(this.isIE){
try{
if(this.clearDelay){
this.clearDelay.cancel();
this.clearDelay=null;
}
var _249=this.element.getContext("2d");
}
catch(e){
this.isFirstRender=false;
this.clearDelay=MochiKit.Async.wait(this.IEDelay);
this.clearDelay.addCallback(MochiKit.Base.bind(this.clear,this));
return;
}
}
var _249=this.element.getContext("2d");
_249.clearRect(0,0,this.width,this.height);
MochiKit.Iter.forEach(this.xlabels,MochiKit.DOM.removeElement);
MochiKit.Iter.forEach(this.ylabels,MochiKit.DOM.removeElement);
this.xlabels=new Array();
this.ylabels=new Array();
};
PlotKit.CanvasRenderer.prototype._strokeColor=function(_250){
var opts=this.options;
if(opts.strokeColor){
_250=opts.strokeColor;
}else{
if(typeof (opts.strokeColorTransform)=="string"){
_250=_250[opts.strokeColorTransform]();
}else{
if(typeof (opts.strokeColorTransform)=="function"){
_250=opts.strokeColorTransform(_250);
}
}
}
return _250.toRGBString();
};
PlotKit.CanvasRenderer.prototype._fillColor=function(_252){
var opts=this.options;
if(opts.fillColor){
_252=opts.fillColor;
}else{
if(typeof (opts.fillColorTransform)=="string"){
_252=_252[opts.fillColorTransform]();
}else{
if(typeof (opts.fillColorTransform)=="function"){
_252=opts.fillColorTransform(_252);
}
}
}
return _252.toRGBString();
};
PlotKit.CanvasRenderer.prototype._initialiseEvents=function(){
var _253=MochiKit.Signal.connect;
var bind=MochiKit.Base.bind;
_253(this.element,"onclick",bind(this.onclick,this));
};
PlotKit.CanvasRenderer.prototype._resolveObject=function(e){
var x=(e.mouse().page.x-PlotKit.Base.findPosX(this.element)-this.area.x)/this.area.w;
var y=(e.mouse().page.y-PlotKit.Base.findPosY(this.element)-this.area.y)/this.area.h;
var _255=this.layout.hitTest(x,y);
if(_255){
return _255;
}
return null;
};
PlotKit.CanvasRenderer.prototype._createEventObject=function(_256,e){
if(_256==null){
return null;
}
e.chart=_256;
return e;
};
PlotKit.CanvasRenderer.prototype.onclick=function(e){
var _257=this._resolveObject(e);
var _258=this._createEventObject(_257,e);
if(_258!=null){
MochiKit.Signal.signal(this,"onclick",_258);
}
};
PlotKit.CanvasRenderer.prototype.onmouseover=function(e){
var _259=this._resolveObject(e);
var _260=this._createEventObject(_259,e);
if(_260!=null){
MochiKit.Signal.signal(this,"onmouseover",_260);
}
};
PlotKit.CanvasRenderer.prototype.onmouseout=function(e){
var _261=this._resolveObject(e);
var _262=this._createEventObject(_261,e);
if(_262==null){
MochiKit.Signal.signal(this,"onmouseout",e);
}else{
MochiKit.Signal.signal(this,"onmouseout",_262);
}
};
PlotKit.CanvasRenderer.prototype.onmousemove=function(e){
var _263=this._resolveObject(e);
var _264=this._createEventObject(_263,e);
if((_263==null)&&(this.event_isinside==null)){
return;
}
if((_263!=null)&&(this.event_isinside==null)){
MochiKit.Signal.signal(this,"onmouseover",_264);
}
if((_263==null)&&(this.event_isinside!=null)){
MochiKit.Signal.signal(this,"onmouseout",_264);
}
if((_263!=null)&&(this.event_isinside!=null)){
MochiKit.Signal.signal(this,"onmousemove",_264);
}
this.event_isinside=_263;
};
PlotKit.CanvasRenderer.isSupported=function(_265){
var _266=null;
try{
if(MochiKit.Base.isUndefinedOrNull(_265)){
_266=MochiKit.DOM.CANVAS({});
}else{
_266=MochiKit.DOM.getElement(_265);
}
var _267=_266.getContext("2d");
}
catch(e){
var ie=navigator.appVersion.match(/MSIE (\d\.\d)/);
var _269=(navigator.userAgent.toLowerCase().indexOf("opera")!=-1);
if((!ie)||(ie[1]<6)||(_269)){
return false;
}
return true;
}
return true;
};
PlotKit.Canvas={};
PlotKit.Canvas.CanvasRenderer=PlotKit.CanvasRenderer;
PlotKit.Canvas.EXPORT=["CanvasRenderer"];
PlotKit.Canvas.EXPORT_OK=["CanvasRenderer"];
PlotKit.Canvas.__new__=function(){
var m=MochiKit.Base;
m.nameFunctions(this);
this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)};
};
PlotKit.Canvas.__new__();
MochiKit.Base._exportSymbols(this,PlotKit.Canvas);
try{
if(typeof (PlotKit.Layout)=="undefined"){
throw "";
}
}
catch(e){
throw "PlotKit depends on MochiKit.{Base,Color,DOM,Format} and PlotKit.Layout";
}
PlotKit.SVGRenderer=function(_270,_271,_272){
if(arguments.length>0){
this.__init__(_270,_271,_272);
}
};
PlotKit.SVGRenderer.NAME="PlotKit.SVGRenderer";
PlotKit.SVGRenderer.VERSION=PlotKit.VERSION;
PlotKit.SVGRenderer.__repr__=function(){
return "["+this.NAME+" "+this.VERSION+"]";
};
PlotKit.SVGRenderer.toString=function(){
return this.__repr__();
};
PlotKit.SVGRenderer.SVGNS="http://www.w3.org/2000/svg";
PlotKit.SVGRenderer.prototype.__init__=function(_273,_274,_275){
var _276=MochiKit.Base.isUndefinedOrNull;
this.options={"drawBackground":true,"backgroundColor":MochiKit.Color.Color.whiteColor(),"padding":{left:30,right:30,top:5,bottom:10},"colorScheme":PlotKit.Base.palette(PlotKit.Base.baseColors()[1]),"strokeColor":MochiKit.Color.Color.whiteColor(),"strokeColorTransform":"asStrokeColor","strokeWidth":0.5,"shouldFill":true,"shouldStroke":true,"drawXAxis":true,"drawYAxis":true,"axisLineColor":MochiKit.Color.Color.blackColor(),"axisLineWidth":0.5,"axisTickSize":3,"axisLabelColor":MochiKit.Color.Color.blackColor(),"axisLabelFont":"Arial","axisLabelFontSize":9,"axisLabelWidth":50,"axisLabelUseDiv":true,"pieRadius":0.4,"enableEvents":true};
MochiKit.Base.update(this.options,_275?_275:{});
this.layout=_274;
this.element=MochiKit.DOM.getElement(_273);
this.container=this.element.parentNode;
this.height=parseInt(this.element.getAttribute("height"));
this.width=parseInt(this.element.getAttribute("width"));
this.document=document;
this.root=this.element;
try{
this.document=this.element.getSVGDocument();
this.root=_276(this.document.documentElement)?this.element:this.document.documentElement;
}
catch(e){
}
this.element.style.zIndex=1;
if(_276(this.element)){
throw "SVGRenderer() - passed SVG object is not found";
}
if(_276(this.container)||this.container.nodeName.toLowerCase()!="div"){
throw "SVGRenderer() - No DIV's around the SVG.";
}
this.xlabels=new Array();
this.ylabels=new Array();
this.defs=this.createSVGElement("defs");
this.area={x:this.options.padding.left,y:this.options.padding.top,w:this.width-this.options.padding.left-this.options.padding.right,h:this.height-this.options.padding.top-this.options.padding.bottom};
MochiKit.DOM.updateNodeAttributes(this.container,{"style":{"position":"relative","width":this.width+"px"}});
};
PlotKit.SVGRenderer.prototype.render=function(){
if(this.options.drawBackground){
this._renderBackground();
}
if(this.layout.style=="bar"){
this._renderBarChart();
this._renderBarAxis();
}else{
if(this.layout.style=="pie"){
this._renderPieChart();
this._renderPieAxis();
}else{
if(this.layout.style=="line"){
this._renderLineChart();
this._renderLineAxis();
}
}
}
};
PlotKit.SVGRenderer.prototype._renderBarOrLine=function(data,_277,_278,_279){
var _280=this.options.colorScheme.length;
var _281=this.options.colorScheme;
var _282=MochiKit.Base.keys(this.layout.datasets);
var _283=_282.length;
for(var i=0;i<_283;i++){
var _284=_282[i];
var _285=new Array();
var _286=_281[i%_280];
if(this.options.shouldFill){
_285["fill"]=_286.toRGBString();
}else{
_285["fill"]="none";
}
if(this.options.shouldStroke&&(this.options.strokeColor||this.options.strokeColorTransform)){
if(this.options.strokeColor){
_285["stroke"]=this.options.strokeColor.toRGBString();
}else{
if(this.options.strokeColorTransform){
_285["stroke"]=_286[this.options.strokeColorTransform]().toRGBString();
}
}
_285["strokeWidth"]=this.options.strokeWidth;
}
if(_278){
_278(_285);
}
var _287=function(obj){
if(obj.name==_284){
_277(_285,obj);
}
};
MochiKit.Iter.forEach(data,MochiKit.Base.bind(_287,this));
if(_279){
_279(_285);
}
}
};
PlotKit.SVGRenderer.prototype._renderBarChart=function(){
var bind=MochiKit.Base.bind;
var _288=function(_289,bar){
var x=this.area.w*bar.x+this.area.x;
var y=this.area.h*bar.y+this.area.y;
var w=this.area.w*bar.w;
var h=this.area.h*bar.h;
this._drawRect(x,y,w,h,_289);
};
this._renderBarOrLine(this.layout.bars,bind(_288,this));
};
PlotKit.SVGRenderer.prototype._renderLineChart=function(){
var bind=MochiKit.Base.bind;
var _290=function(_291,_292){
this._tempPointsBuffer+=(this.area.w*_292.x+this.area.x)+","+(this.area.h*_292.y+this.area.y)+" ";
};
var _293=function(_294){
this._tempPointsBuffer="";
this._tempPointsBuffer+=(this.area.x)+","+(this.area.y+this.area.h)+" ";
};
var _295=function(_296){
this._tempPointsBuffer+=(this.area.w+this.area.x)+","+(this.area.h+this.area.y);
_296["points"]=this._tempPointsBuffer;
var elem=this.createSVGElement("polygon",_296);
this.root.appendChild(elem);
};
this._renderBarOrLine(this.layout.points,bind(_290,this),bind(_293,this),bind(_295,this));
};
PlotKit.SVGRenderer.prototype._renderPieChart=function(){
var _298=this.options.colorScheme.length;
var _299=this.layout.slices;
var _300=this.area.x+this.area.w*0.5;
var _301=this.area.y+this.area.h*0.5;
var _302=Math.min(this.area.w*this.options.pieRadius,this.area.h*this.options.pieRadius);
if(_299.length==1&&(Math.abs(_299[0].startAngle)-Math.abs(_299[0].endAngle)<0.1)){
var _303={"cx":_300,"cy":_301,"r":_302};
var _304=this.options.colorScheme[0];
if(this.options.shouldFill){
_303["fill"]=_304.toRGBString();
}else{
_303["fill"]="none";
}
if(this.options.shouldStroke&&(this.options.strokeColor||this.options.strokeColorTransform)){
if(this.options.strokeColor){
_303["stroke"]=this.options.strokeColor.toRGBString();
}else{
if(this.options.strokeColorTransform){
_303["stroke"]=_304[this.options.strokeColorTransform]().toRGBString();
}
}
_303["style"]="stroke-width: "+this.options.strokeWidth;
}
this.root.appendChild(this.createSVGElement("circle",_303));
return;
}
for(var i=0;i<_299.length;i++){
var _303=new Array();
var _304=this.options.colorScheme[i%_298];
if(this.options.shouldFill){
_303["fill"]=_304.toRGBString();
}else{
_303["fill"]="none";
}
if(this.options.shouldStroke&&(this.options.strokeColor||this.options.strokeColorTransform)){
if(this.options.strokeColor){
_303["stroke"]=this.options.strokeColor.toRGBString();
}else{
if(this.options.strokeColorTransform){
_303["stroke"]=_304[this.options.strokeColorTransform]().toRGBString();
}
}
_303["style"]="stroke-width:"+this.options.strokeWidth;
}
var _305=0;
if(Math.abs(_299[i].endAngle-_299[i].startAngle)>Math.PI){
_305=1;
}
var x1=Math.cos(_299[i].startAngle-Math.PI/2)*_302;
var y1=Math.sin(_299[i].startAngle-Math.PI/2)*_302;
var x2=Math.cos(_299[i].endAngle-Math.PI/2)*_302;
var y2=Math.sin(_299[i].endAngle-Math.PI/2)*_302;
var rx=x2-x1;
var ry=y2-y1;
var _312="M"+_300+","+_301+" ";
_312+="l"+x1+","+y1+" ";
_312+="a"+_302+","+_302+" 0 "+_305+",1 "+rx+","+ry+" z";
_303["d"]=_312;
var elem=this.createSVGElement("path",_303);
this.root.appendChild(elem);
}
};
PlotKit.SVGRenderer.prototype._renderBarAxis=function(){
this._renderAxis();
};
PlotKit.SVGRenderer.prototype._renderLineAxis=function(){
this._renderAxis();
};
PlotKit.SVGRenderer.prototype._renderAxis=function(){
if(!this.options.drawXAxis&&!this.options.drawYAxis){
return;
}
var _313={"style":{"position":"absolute","textAlign":"center","fontSize":this.options.axisLabelFontSize+"px","zIndex":10,"color":this.options.axisLabelColor.toRGBString(),"width":this.options.axisLabelWidth+"px","overflow":"hidden"}};
var _314={"stroke":this.options.axisLineColor.toRGBString(),"strokeWidth":this.options.axisLineWidth};
if(this.options.drawYAxis){
if(this.layout.yticks){
var _315=function(tick){
var x=this.area.x;
var y=this.area.y+tick[0]*this.area.h;
this._drawLine(x,y,x-3,y,_314);
if(this.options.axisLabelUseDiv){
var _316=MochiKit.DOM.DIV(_313,tick[1]);
_316.style.top=(y-this.options.axisLabelFontSize)+"px";
_316.style.left=(x-this.options.padding.left+this.options.axisTickSize)+"px";
_316.style.textAlign="left";
_316.style.width=(this.options.padding.left-3)+"px";
MochiKit.DOM.appendChildNodes(this.container,_316);
this.ylabels.push(_316);
}else{
var _317={y:y+3,x:(x-this.options.padding.left+3),width:(this.options.padding.left-this.options.axisTickSize)+"px",height:(this.options.axisLabelFontSize+3)+"px",fontFamily:"Arial",fontSize:this.options.axisLabelFontSize+"px",fill:this.options.axisLabelColor.toRGBString()};
var _316=this.createSVGElement("text",_317);
_316.appendChild(this.document.createTextNode(tick[1]));
this.root.appendChild(_316);
}
};
MochiKit.Iter.forEach(this.layout.yticks,MochiKit.Base.bind(_315,this));
}
this._drawLine(this.area.x,this.area.y,this.area.x,this.area.y+this.area.h,_314);
}
if(this.options.drawXAxis){
if(this.layout.xticks){
var _315=function(tick){
var x=this.area.x+tick[0]*this.area.w;
var y=this.area.y+this.area.h;
this._drawLine(x,y,x,y+this.options.axisTickSize,_314);
if(this.options.axisLabelUseDiv){
var _318=MochiKit.DOM.DIV(_313,tick[1]);
_318.style.top=(y+this.options.axisTickSize)+"px";
_318.style.left=(x-this.options.axisLabelWidth/2)+"px";
_318.style.textAlign="center";
_318.style.width=this.options.axisLabelWidth+"px";
MochiKit.DOM.appendChildNodes(this.container,_318);
this.xlabels.push(_318);
}else{
var _319={y:(y+this.options.axisTickSize+this.options.axisLabelFontSize),x:x-3,width:this.options.axisLabelWidth+"px",height:(this.options.axisLabelFontSize+3)+"px",fontFamily:"Arial",fontSize:this.options.axisLabelFontSize+"px",fill:this.options.axisLabelColor.toRGBString(),textAnchor:"middle"};
var _318=this.createSVGElement("text",_319);
_318.appendChild(this.document.createTextNode(tick[1]));
this.root.appendChild(_318);
}
};
MochiKit.Iter.forEach(this.layout.xticks,MochiKit.Base.bind(_315,this));
}
this._drawLine(this.area.x,this.area.y+this.area.h,this.area.x+this.area.w,this.area.y+this.area.h,_314);
}
};
PlotKit.SVGRenderer.prototype._renderPieAxis=function(){
if(this.layout.xticks){
var _320=new Array();
for(var i=0;i<this.layout.slices.length;i++){
_320[this.layout.slices[i].xval]=this.layout.slices[i];
}
var _321=this.area.x+this.area.w*0.5;
var _322=this.area.y+this.area.h*0.5;
var _323=Math.min(this.area.w*this.options.pieRadius+10,this.area.h*this.options.pieRadius+10);
var _324=this.options.axisLabelWidth;
for(var i=0;i<this.layout.xticks.length;i++){
var _325=_320[this.layout.xticks[i][0]];
if(MochiKit.Base.isUndefinedOrNull(_325)){
continue;
}
var _326=(_325.startAngle+_325.endAngle)/2;
var _327=_326;
if(_327>Math.PI*2){
_327=_327-Math.PI*2;
}else{
if(_327<0){
_327=_327+Math.PI*2;
}
}
var _328=_321+Math.sin(_327)*(_323+10);
var _329=_322-Math.cos(_327)*(_323+10);
var _330={"position":"absolute","zIndex":11,"width":_324+"px","fontSize":this.options.axisLabelFontSize+"px","overflow":"hidden","color":this.options.axisLabelColor.toHexString()};
var _331={"width":_324+"px","fontSize":this.options.axisLabelFontSize+"px","height":(this.options.axisLabelFontSize+3)+"px","fill":this.options.axisLabelColor.toRGBString()};
if(_327<=Math.PI*0.5){
MochiKit.Base.update(_330,{"textAlign":"left","verticalAlign":"top","left":_328+"px","top":(_329-this.options.axisLabelFontSize)+"px"});
MochiKit.Base.update(_331,{"x":_328,"y":(_329-this.options.axisLabelFontSize),"textAnchor":"left"});
}else{
if((_327>Math.PI*0.5)&&(_327<=Math.PI)){
MochiKit.Base.update(_330,{"textAlign":"left","verticalAlign":"bottom","left":_328+"px","top":_329+"px"});
MochiKit.Base.update(_331,{"textAnchor":"left","x":_328,"y":_329});
}else{
if((_327>Math.PI)&&(_327<=Math.PI*1.5)){
MochiKit.Base.update(_330,{"textAlign":"right","verticalAlign":"bottom","left":_328+"px","top":_329+"px"});
MochiKit.Base.update(_331,{"textAnchor":"right","x":_328-_324,"y":_329});
}else{
MochiKit.Base.update(_330,{"textAlign":"left","verticalAlign":"bottom","left":_328+"px","top":_329+"px"});
MochiKit.Base.update(_331,{"textAnchor":"left","x":_328-_324,"y":_329-this.options.axisLabelFontSize});
}
}
}
if(this.options.axisLabelUseDiv){
var _332=MochiKit.DOM.DIV({"style":_330},this.layout.xticks[i][1]);
this.xlabels.push(_332);
MochiKit.DOM.appendChildNodes(this.container,_332);
}else{
var _332=this.createSVGElement("text",_331);
_332.appendChild(this.document.createTextNode(this.layout.xticks[i][1]));
this.root.appendChild(_332);
}
}
}
};
PlotKit.SVGRenderer.prototype._renderBackground=function(){
var opts={"stroke":"none","fill":this.options.backgroundColor.toRGBString()};
this._drawRect(0,0,this.width,this.height,opts);
};
PlotKit.SVGRenderer.prototype._drawRect=function(x,y,w,h,_333){
var _334={x:x+"px",y:y+"px",width:w+"px",height:h+"px"};
if(_333){
MochiKit.Base.update(_334,_333);
}
var elem=this.createSVGElement("rect",_334);
this.root.appendChild(elem);
};
PlotKit.SVGRenderer.prototype._drawLine=function(x1,y1,x2,y2,_335){
var _336={x1:x1+"px",y1:y1+"px",x2:x2+"px",y2:y2+"px"};
if(_335){
MochiKit.Base.update(_336,_335);
}
var elem=this.createSVGElement("line",_336);
this.root.appendChild(elem);
};
PlotKit.SVGRenderer.prototype.clear=function(){
while(this.element.firstChild){
this.element.removeChild(this.element.firstChild);
}
if(this.options.axisLabelUseDiv){
for(var i=0;i<this.xlabels.length;i++){
MochiKit.DOM.removeElement(this.xlabels[i]);
}
for(var i=0;i<this.ylabels.length;i++){
MochiKit.DOM.removeElement(this.ylabels[i]);
}
}
this.xlabels=new Array();
this.ylabels=new Array();
};
PlotKit.SVGRenderer.prototype.createSVGElement=function(name,_338){
var _339=MochiKit.Base.isUndefinedOrNull;
var elem;
var doc=_339(this.document)?document:this.document;
try{
elem=doc.createElementNS(PlotKit.SVGRenderer.SVGNS,name);
}
catch(e){
elem=doc.createElement(name);
elem.setAttribute("xmlns",PlotKit.SVGRenderer.SVGNS);
}
if(_338){
MochiKit.DOM.updateNodeAttributes(elem,_338);
}
return elem;
};
PlotKit.SVGRenderer.SVG=function(_341){
var ie=navigator.appVersion.match(/MSIE (\d\.\d)/);
var _342=(navigator.userAgent.toLowerCase().indexOf("opera")!=-1);
if(ie&&(ie[1]>=6)&&(!_342)){
var _343=_341["width"]?_341["width"]:"100";
var _344=_341["height"]?_341["height"]:"100";
var eid=_341["id"]?_341["id"]:"notunique";
var html="<svg:svg width=\""+_343+"\" height=\""+_344+"\" ";
html+="id=\""+eid+"\" version=\"1.1\" baseProfile=\"full\" />";
var _347=document.createElement(html);
var _348=_347.getSVGDocument().createElementNS(PlotKit.SVGRenderer.SVGNS,"svg");
_348.setAttribute("width",_343);
_348.setAttribute("height",_344);
_347.getSVGDocument().appendChild(_348);
return _347;
}else{
return PlotKit.SVGRenderer.prototype.createSVGElement("svg",_341);
}
};
PlotKit.SVGRenderer.isSupported=function(){
var _349=(navigator.userAgent.toLowerCase().indexOf("opera")!=-1);
var _350=navigator.appVersion.match(/MSIE (\d\.\d)/);
var _351=navigator.userAgent.match(/AppleWebKit\/(\d+)/);
var _352=navigator.userAgent.match(/Opera\/(\d*\.\d*)/);
var _353=navigator.userAgent.match(/rv:(\d*\.\d*).*Gecko/);
var _354="http://www.w3.org/TR/SVG11/feature#SVG";
if(_350&&(_350[1]>=6)&&!_349){
return document.implementation.hasFeature(_354,"1.1");
}
if(_352&&(_352[1]>8.9)){
return true;
}
if(_353&&(_353>1.7)){
return true;
}
return false;
};
PlotKit.SVG={};
PlotKit.SVG.SVGRenderer=PlotKit.SVGRenderer;
PlotKit.SVG.EXPORT=["SVGRenderer"];
PlotKit.SVG.EXPORT_OK=["SVGRenderer"];
PlotKit.SVG.__new__=function(){
var m=MochiKit.Base;
m.nameFunctions(this);
this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)};
};
PlotKit.SVG.__new__();
MochiKit.Base._exportSymbols(this,PlotKit.SVG);
try{
if(typeof (PlotKit.CanvasRenderer)=="undefined"){
throw "";
}
}
catch(e){
throw "SweetCanvas depends on MochiKit.{Base,Color,DOM,Format} and PlotKit.{Layout, Canvas}";
}
if(typeof (PlotKit.SweetCanvasRenderer)=="undefined"){
PlotKit.SweetCanvasRenderer={};
}
PlotKit.SweetCanvasRenderer=function(_355,_356,_357){
if(arguments.length>0){
this.__init__(_355,_356,_357);
}
};
PlotKit.SweetCanvasRenderer.NAME="PlotKit.SweetCanvasRenderer";
PlotKit.SweetCanvasRenderer.VERSION=PlotKit.VERSION;
PlotKit.SweetCanvasRenderer.__repr__=function(){
return "["+this.NAME+" "+this.VERSION+"]";
};
PlotKit.SweetCanvasRenderer.toString=function(){
return this.__repr__();
};
PlotKit.SweetCanvasRenderer.prototype=new PlotKit.CanvasRenderer();
PlotKit.SweetCanvasRenderer.prototype.constructor=PlotKit.SweetCanvasRenderer;
PlotKit.SweetCanvasRenderer.__super__=PlotKit.CanvasRenderer.prototype;
PlotKit.SweetCanvasRenderer.prototype.__init__=function(el,_359,opts){
var _360=PlotKit.Base.officeBlue();
MochiKit.Base.update(_360,opts);
PlotKit.SweetCanvasRenderer.__super__.__init__.call(this,el,_359,_360);
};
PlotKit.SweetCanvasRenderer.prototype._renderBarChart=function(){
var bind=MochiKit.Base.bind;
var _361=MochiKit.Color.Color.blackColor().colorWithAlpha(0.1).toRGBString();
var _362=function(_363,x,y,w,h){
_363.fillStyle=_361;
_363.fillRect(x-2,y-2,w+4,h+2);
_363.fillStyle=_361;
_363.fillRect(x-1,y-1,w+2,h+1);
};
var _364=this.options.colorScheme.length;
var _365=this.options.colorScheme;
var _366=PlotKit.Base.keys(this.layout.datasets);
var _367=_366.length;
var _368=function(name){
for(var i=0;i<_367;i++){
if(name==_366[i]){
return _365[i%_364];
}
}
return _365[0];
};
var _369=function(_370,bar){
var x=this.area.w*bar.x+this.area.x;
var y=this.area.h*bar.y+this.area.y;
var w=this.area.w*bar.w;
var h=this.area.h*bar.h;
if((w<1)||(h<1)){
return;
}
_370.save();
_370.shadowBlur=5;
_370.shadowColor=MochiKit.Color.Color.fromHexString("#888888").toRGBString();
if(this.isIE){
_370.save();
_370.fillStyle="#cccccc";
_370.fillRect(x-2,y-2,w+4,h+2);
_370.restore();
}else{
_362(_370,x,y,w,h);
}
if(this.options.shouldFill){
_370.fillStyle=this._fillColor(_368(bar.name));
_370.fillRect(x,y,w,h);
}
_370.shadowBlur=0;
_370.strokeStyle=MochiKit.Color.Color.whiteColor().toRGBString();
_370.lineWidth=2;
if(this.options.shouldStroke){
_370.strokeRect(x,y,w,h);
}
_370.restore();
};
this._renderBarChartWrap(this.layout.bars,bind(_369,this));
};
PlotKit.SweetCanvasRenderer.prototype._renderLineChart=function(){
var _371=this.element.getContext("2d");
var _372=this.options.colorScheme.length;
var _373=this.options.colorScheme;
var _374=PlotKit.Base.keys(this.layout.datasets);
var _375=_374.length;
var bind=MochiKit.Base.bind;
var _376=MochiKit.Base.partial;
for(var i=0;i<_375;i++){
var _377=_374[i];
var _378=_373[i%_372];
var _379=this.options.strokeColorTransform;
_371.save();
var _380=function(ctx){
ctx.beginPath();
ctx.moveTo(this.area.x,this.area.y+this.area.h);
var _381=function(ctx_,_382){
if(_382.name==_377){
ctx_.lineTo(this.area.w*_382.x+this.area.x,this.area.h*_382.y+this.area.y);
}
};
MochiKit.Iter.forEach(this.layout.points,_376(_381,ctx),this);
ctx.lineTo(this.area.x+this.area.w,this.area.y+this.area.h);
ctx.lineTo(this.area.x,this.area.y+this.area.h);
ctx.closePath();
};
if(!this.options.shouldFill){
_380=function(ctx){
ctx.beginPath();
var _383=null;
var _384=null;
var _385=function(ctx_,_386){
if(_386.name==_377){
var x=this.area.w*_386.x+this.area.x;
var y=this.area.h*_386.y+this.area.y;
if(_383==null){
ctx_.moveTo(x,y);
_383=x;
_384=y;
}else{
ctx_.lineTo(x,y);
}
}
};
MochiKit.Iter.forEach(this.layout.points,_376(_385,ctx),this);
ctx.moveTo(_383,_384);
ctx.closePath();
};
}
if(this.options.shouldFill){
_371.save();
if(this.isIE){
_371.fillStyle="#cccccc";
}else{
_371.fillStyle=MochiKit.Color.Color.blackColor().colorWithAlpha(0.2).toRGBString();
}
_371.translate(-1,-2);
bind(_380,this)(_371);
if(this.options.shouldFill){
_371.fill();
}
_371.restore();
}
_371.shadowBlur=5;
_371.shadowColor=MochiKit.Color.Color.fromHexString("#888888").toRGBString();
_371.fillStyle=this._fillColor(_378);
_371.lineWidth=2;
_371.strokeStyle=MochiKit.Color.Color.whiteColor().toRGBString();
if(this.options.shouldFill){
bind(_380,this)(_371);
_371.fill();
}
if(this.options.shouldStroke){
if(!this.options.shouldFill){
_371.save();
_371.lineWidth=6;
_371.lineCap="round";
bind(_380,this)(_371);
_371.stroke();
_371.restore();
_371.strokeStyle=this._strokeColor(_378);
}
bind(_380,this)(_371);
_371.stroke();
}
_371.restore();
}
};
PlotKit.SweetCanvasRenderer.prototype._renderPieChart=function(){
var _387=this.element.getContext("2d");
var _388=this.options.colorScheme.length;
var _389=this.layout.slices;
var _390=this.area.x+this.area.w*0.5;
var _391=this.area.y+this.area.h*0.5;
var _392=Math.min(this.area.w*this.options.pieRadius,this.area.h*this.options.pieRadius);
if(this.isIE){
_390=parseInt(_390);
_391=parseInt(_391);
_392=parseInt(_392);
}
if(!this.isIE){
_387.save();
var _393=MochiKit.Color.Color.blackColor().colorWithAlpha(0.2);
_387.fillStyle=_393.toRGBString();
_387.shadowBlur=5;
_387.shadowColor=MochiKit.Color.Color.fromHexString("#888888").toRGBString();
_387.translate(1,1);
_387.beginPath();
_387.moveTo(_390,_391);
_387.arc(_390,_391,_392+2,0,Math.PI*2,false);
_387.closePath();
_387.fill();
_387.restore();
}
_387.save();
_387.strokeStyle=MochiKit.Color.Color.whiteColor().toRGBString();
_387.lineWidth=2;
for(var i=0;i<_389.length;i++){
var _394=this.options.colorScheme[i%_388];
_387.fillStyle=this._fillColor(_394);
var _395=function(){
_387.beginPath();
_387.moveTo(_390,_391);
_387.arc(_390,_391,_392,_389[i].startAngle-Math.PI/2,_389[i].endAngle-Math.PI/2,_389[i].fraction==1);
_387.lineTo(_390,_391);
_387.closePath();
};
if(Math.abs(_389[i].startAngle-_389[i].endAngle)>0.0001){
if(this.options.shouldFill){
_395();
_387.fill();
}
if(this.options.shouldStroke){
_395();
_387.stroke();
}
}
}
_387.restore();
};
PlotKit.SweetCanvasRenderer.prototype._renderPointChart=function(){
var _396=this.element.getContext("2d");
var _397=this.options.colorScheme.length;
var _398=this.options.colorScheme;
var _399=MochiKit.Base.keys(this.layout.datasets);
var _400=_399.length;
var bind=MochiKit.Base.bind;
var _401=MochiKit.Base.partial;
for(var i=0;i<_400;i++){
var _402=_399[i];
var _403=_398[i%_397];
_396.save();
_396.fillStyle=this._fillColor(_403);
_396.strokeStyle=MochiKit.Color.Color.whiteColor().toRGBString();
_396.lineWidth=2;
var _404=function(ctx,_405){
if(_405.name==_402){
ctx.beginPath();
ctx.arc(this.area.w*_405.x+this.area.x,this.area.h*_405.y+this.area.y,this.options.strokeWidth*8,0,2*Math.PI,false);
ctx.closePath();
ctx.fill();
ctx.stroke();
}
};
_396.save();
_396.lineWidth=0;
if(this.isIE){
_396.fillStyle="#cccccc";
}else{
_396.fillStyle=MochiKit.Color.Color.blackColor().colorWithAlpha(0.2).toRGBString();
}
_396.translate(3,4);
MochiKit.Iter.forEach(this.layout.points,bind(_404,this,_396));
_396.restore();
_396.shadowBlur=5;
_396.shadowColor=MochiKit.Color.Color.fromHexString("#888888").toRGBString();
MochiKit.Iter.forEach(this.layout.points,bind(_404,this,_396));
_396.restore();
}
};
PlotKit.SweetCanvasRenderer.prototype._renderAreaChart=function(){
var _406=this.element.getContext("2d");
var _407=this.options.colorScheme.length;
var _408=this.options.colorScheme;
var _409=MochiKit.Base.keys(this.layout.datasets);
var _410=_409.length;
var bind=MochiKit.Base.bind;
var _411=MochiKit.Base.partial;
for(var i=0;i<_410;i++){
var _412=_409[i];
var _413=_408[i%_407];
_406.save();
_406.fillStyle=this._fillColor(_413.colorWithAlpha(0.6));
_406.lineWidth=2;
_406.strokeStyle=this._strokeColor(_413);
var _414=function(ctx){
ctx.beginPath();
var _415=null;
var _416=null;
var _417=function(ctx_,_418){
if(_418.name==_412){
var x=this.area.w*_418.x+this.area.x;
var y=this.area.h*_418.y+this.area.y;
if(_415==null){
ctx_.moveTo(x,y);
_415=x;
_416=y;
}else{
ctx_.lineTo(x,y);
}
}
};
MochiKit.Iter.forEach(this.layout.points,_411(_417,ctx),this);
ctx.lineTo(_415,_416);
ctx.closePath();
};
_406.save();
_406.strokeStyle=MochiKit.Color.Color.whiteColor().toRGBString();
_406.lineWidth=4;
_406.lineCap="round";
bind(_414,this)(_406);
_406.stroke();
_406.restore();
if(this.options.shouldFill){
bind(_414,this)(_406);
_406.fill();
}
if(this.options.shouldStroke){
bind(_414,this)(_406);
_406.stroke();
}
_406.restore();
}
};
PlotKit.SweetCanvasRenderer.prototype._renderBackground=function(){
var _419=this.element.getContext("2d");
if(this.layout.style=="bar"||this.layout.style=="line"||this.layout.style=="point"){
_419.save();
_419.fillStyle=this.options.backgroundColor.toRGBString();
_419.fillRect(this.area.x,this.area.y,this.area.w,this.area.h);
_419.strokeStyle=this.options.axisLineColor.toRGBString();
_419.lineWidth=1;
var _420=this.layout.yticks;
var _421=false;
if(this.layout.style=="bar"&&this.layout.options.barOrientation=="horizontal"){
_420=this.layout.xticks;
_421=true;
}
for(var i=0;i<_420.length;i++){
var x1=0;
var y1=0;
var x2=0;
var y2=0;
if(_421){
x1=_420[i][0]*this.area.w+this.area.x;
y1=this.area.y;
x2=x1;
y2=y1+this.area.h;
}else{
x1=this.area.x;
y1=_420[i][0]*this.area.h+this.area.y;
x2=x1+this.area.w;
y2=y1;
}
_419.beginPath();
_419.moveTo(x1,y1);
_419.lineTo(x2,y2);
_419.closePath();
_419.stroke();
}
_419.restore();
}else{
PlotKit.SweetCanvasRenderer.__super__._renderBackground.call(this);
}
};
PlotKit.SweetCanvas={};
PlotKit.SweetCanvas.SweetCanvasRenderer=PlotKit.SweetCanvasRenderer;
PlotKit.SweetCanvas.EXPORT=["SweetCanvasRenderer"];
PlotKit.SweetCanvas.EXPORT_OK=["SweetCanvasRenderer"];
PlotKit.SweetCanvas.__new__=function(){
var m=MochiKit.Base;
m.nameFunctions(this);
this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)};
};
PlotKit.SweetCanvas.__new__();
MochiKit.Base._exportSymbols(this,PlotKit.SweetCanvas);
try{
if(typeof (PlotKit.SVGRenderer)=="undefined"){
throw "";
}
}
catch(e){
throw "SweetSVG depends on MochiKit.{Base,Color,DOM,Format} and PlotKit.{Layout, SVG}";
}
if(typeof (PlotKit.SweetSVGRenderer)=="undefined"){
PlotKit.SweetSVGRenderer={};
}
PlotKit.SweetSVGRenderer=function(_422,_423,_424){
if(arguments.length>0){
this.__init__(_422,_423,_424);
}
};
PlotKit.SweetSVGRenderer.NAME="PlotKit.SweetSVGRenderer";
PlotKit.SweetSVGRenderer.VERSION=PlotKit.VERSION;
PlotKit.SweetSVGRenderer.__repr__=function(){
return "["+this.NAME+" "+this.VERSION+"]";
};
PlotKit.SweetSVGRenderer.toString=function(){
return this.__repr__();
};
PlotKit.SweetSVGRenderer.prototype=new PlotKit.SVGRenderer();
PlotKit.SweetSVGRenderer.prototype.constructor=PlotKit.SweetSVGRenderer;
PlotKit.SweetSVGRenderer.__super__=PlotKit.SVGRenderer.prototype;
PlotKit.SweetSVGRenderer.prototype.__init__=function(_425,_426,_427){
var _428=PlotKit.Base.officeBlue();
MochiKit.Base.update(_428,_427);
PlotKit.SweetSVGRenderer.__super__.__init__.call(this,_425,_426,_428);
};
PlotKit.SweetSVGRenderer.prototype._addDropShadowFilter=function(){
var _429=this.createSVGElement("filter",{x:0,y:0,"id":"dropShadow"});
var _430=this.createSVGElement("feOffset",{"in":"SourceGraphic","dx":0,"dy":0,"result":"topCopy"});
var blur=this.createSVGElement("feGaussianBlur",{"in":"SourceAlpha","StdDeviation":2,"result":"shadow"});
var _432=this.createSVGElement("feOffset",{"in":"shadow","dx":-1,"dy":-2,"result":"movedShadow"});
var _433=this.createSVGElement("feMerge");
var _434=this.createSVGElement("feMergeNode",{"in":"topCopy"});
var _435=this.createSVGElement("feMergeNode",{"in":"movedShadow"});
_433.appendChild(_434);
_433.appendChild(_435);
_429.appendChild(_430);
_429.appendChild(blur);
_429.appendChild(_432);
_429.appendChild(_433);
this.defs.appendChild(_429);
};
PlotKit.SweetSVGRenderer.prototype._renderBarChart=function(){
var bind=MochiKit.Base.bind;
var _436=MochiKit.Color.Color.blackColor().toRGBString();
var _437="fill:"+_436+";fill-opacity:0.15";
var _438="stroke-width: 2.0; stroke:"+MochiKit.Color.Color.whiteColor().toRGBString();
var _439=function(_440,bar){
var x=this.area.w*bar.x+this.area.x;
var y=this.area.h*bar.y+this.area.y;
var w=this.area.w*bar.w;
var h=this.area.h*bar.h;
if((w<1)||(h<1)){
return;
}
_440["style"]=_438;
this._drawRect(x-2,y-1,w+4,h+2,{"style":_437});
this._drawRect(x,y,w,h,_440);
};
this._renderBarOrLine(this.layout.bars,bind(_439,this));
};
PlotKit.SweetSVGRenderer.prototype._renderLineChart=function(){
var bind=MochiKit.Base.bind;
var _441=MochiKit.Color.Color.blackColor().toRGBString();
var _442="fill:"+_441+";fill-opacity:0.15";
var _443="stroke-width: 2.0; stroke:"+MochiKit.Color.Color.whiteColor().toRGBString();
var _444=function(_445,_446){
this._tempPointsBuffer+=(this.area.w*_446.x+this.area.x)+","+(this.area.h*_446.y+this.area.y)+" ";
};
var _447=function(_448){
this._tempPointsBuffer="";
this._tempPointsBuffer+=(this.area.x)+","+(this.area.y+this.area.h)+" ";
};
var _449=function(_450){
this._tempPointsBuffer+=(this.area.w+this.area.x)+","+(this.area.h+this.area.y);
_450["points"]=this._tempPointsBuffer;
_450["stroke"]="none";
_450["transform"]="translate(-2, -1)";
_450["style"]=_442;
var _451=this.createSVGElement("polygon",_450);
this.root.appendChild(_451);
_450["transform"]="";
_450["style"]=_443;
var elem=this.createSVGElement("polygon",_450);
this.root.appendChild(elem);
};
this._renderBarOrLine(this.layout.points,bind(_444,this),bind(_447,this),bind(_449,this));
};
PlotKit.SweetSVGRenderer.prototype._renderPieChart=function(){
var _452=this.area.x+this.area.w*0.5;
var _453=this.area.y+this.area.h*0.5;
var _454=MochiKit.Color.Color.blackColor().toRGBString();
var _455=Math.min(this.area.w*this.options.pieRadius,this.area.h*this.options.pieRadius);
var _456="fill:"+_454+";fill-opacity:0.15";
var _457=this.createSVGElement("circle",{"style":_456,"cx":_452+1,"cy":_453+1,"r":_455+1});
this.root.appendChild(_457);
PlotKit.SweetSVGRenderer.__super__._renderPieChart.call(this);
};
PlotKit.SweetSVGRenderer.prototype._renderBackground=function(){
var _458={"fill":this.options.backgroundColor.toRGBString(),"stroke":"none"};
if(this.layout.style=="bar"||this.layout.style=="line"){
this._drawRect(this.area.x,this.area.y,this.area.w,this.area.h,_458);
var _459=this.layout.yticks;
var _460=false;
if(this.layout.style=="bar"&&this.layout.options.barOrientation=="horizontal"){
_459=this.layout.xticks;
_460=true;
}
for(var i=0;i<_459.length;i++){
var x=0;
var y=0;
var w=0;
var h=0;
if(_460){
x=_459[i][0]*this.area.w+this.area.x;
y=this.area.y;
w=1;
h=this.area.h;
}else{
x=this.area.x;
y=_459[i][0]*this.area.h+this.area.y;
w=this.area.w;
h=1;
}
this._drawRect(x,y,w,h,{"fill":this.options.axisLineColor.toRGBString()});
}
}else{
PlotKit.SweetSVGRenderer.__super__._renderBackground.call(this);
}
};
PlotKit.SweetSVG={};
PlotKit.SweetSVG.SweetSVGRenderer=PlotKit.SweetSVGRenderer;
PlotKit.SweetSVG.EXPORT=["SweetSVGRenderer"];
PlotKit.SweetSVG.EXPORT_OK=["SweetSVGRenderer"];
PlotKit.SweetSVG.__new__=function(){
var m=MochiKit.Base;
m.nameFunctions(this);
this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)};
};
PlotKit.SweetSVG.__new__();
MochiKit.Base._exportSymbols(this,PlotKit.SweetSVG);
try{
if(typeof (PlotKit.CanvasRenderer)=="undefined"){
throw "";
}
}
catch(e){
throw "PlotKit.EasyPlot depends on all of PlotKit's components";
}
if(typeof (PlotKit.EasyPlot)=="undefined"){
PlotKit.EasyPlot={};
}
PlotKit.EasyPlot.NAME="PlotKit.EasyPlot";
PlotKit.EasyPlot.VERSION=PlotKit.VERSION;
PlotKit.EasyPlot.__repr__=function(){
return "["+this.NAME+" "+this.VERSION+"]";
};
PlotKit.EasyPlot.toString=function(){
return this.__repr__();
};
PlotKit.EasyPlot=function(_461,_462,_463,_464){
this.layout=new PlotKit.Layout(_461,_462);
this.divElem=_463;
this.width=parseInt(_463.getAttribute("width"));
this.height=parseInt(_463.getAttribute("height"));
this.deferredCount=0;
if(this.width<1){
this.width=this.divElem.width?this.divElem.width:300;
}
if(this.height<1){
this.height=this.divElem.height?this.divElem.height:300;
}
if(MochiKit.Base.isArrayLike(_464)){
for(var i=0;i<_464.length;i++){
if(typeof (_464[i])=="string"){
this.deferredCount++;
var d=MochiKit.Async.doSimpleXMLHttpRequest(_464[i]);
d.addCallback(MochiKit.Base.bind(PlotKit.EasyPlot.onDataLoaded,this));
}else{
if(MochiKit.Base.isArrayLike(_464[i])){
this.layout.addDataset("data-"+i,_464[i]);
}
}
}
}else{
if(!MochiKit.Base.isUndefinedOrNull(_464)){
throw "Passed datasources are not Array like";
}
}
if(CanvasRenderer.isSupported()){
this.element=MochiKit.DOM.CANVAS({"id":this.divElem.getAttribute("id")+"-canvas","width":this.width,"height":this.height},"");
this.divElem.appendChild(this.element);
this.renderer=new SweetCanvasRenderer(this.element,this.layout,_462);
}else{
if(SVGRenderer.isSupported()){
this.element=SVGRenderer.SVG({"id":this.divElem.getAttribute("id")+"-svg","width":this.width,"height":this.height,"version":"1.1","baseProfile":"full"},"");
this.divElem.appendChild(this.element);
this.renderer=new SweetSVGRenderer(this.element,this.layout,_462);
}
}
if((this.deferredCount==0)&&(PlotKit.Base.keys(this.layout.datasets).length>0)){
this.layout.evaluate();
this.renderer.clear();
this.renderer.render();
}
};
PlotKit.EasyPlot.onDataLoaded=function(_466){
var _467=new Array();
var _468=_466.responseText.split("\n");
for(var i=0;i<_468.length;i++){
var _469=MochiKit.Format.strip(_468[i]);
if((_469.length>1)&&(_469.charAt(0)!="#")){
_467.push(_469.split(","));
}
}
this.layout.addDataset("data-ajax-"+this.deferredCount,_467);
this.deferredCount--;
if((this.deferredCount==0)&&(PlotKit.Base.keys(this.layout.datasets).length>0)){
this.layout.evaluate();
this.renderer.clear();
this.renderer.render();
}
};
PlotKit.EasyPlot.prototype.reload=function(){
this.layout.evaluate();
this.renderer.clear();
this.renderer.render();
};
PlotKit.EasyPlotModule={};
PlotKit.EasyPlotModule.EasyPlot=PlotKit.EasyPlot;
PlotKit.EasyPlotModule.EXPORT=["EasyPlot"];
PlotKit.EasyPlotModule.EXPORT_OK=[];
PlotKit.EasyPlotModule.__new__=function(){
var m=MochiKit.Base;
m.nameFunctions(this);
this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)};
};
PlotKit.EasyPlotModule.__new__();
MochiKit.Base._exportSymbols(this,PlotKit.EasyPlotModule);


text:
The 1992 Whites only referendum 'For' or 'Against' a negotiated constitution
On 17 March 1992, President Frederick Willem de Klerk announced the results of a referendum in which only white people were allowed to participate. The aim of the referendum was to measure White support for the process to negotiate the dismantling of apartheid, which had already been in progress since 1989. The referendum was a gamble for both De Klerk and the National Party (NP) and an opportunity to silence the white right-wing. The latter group, constituted as the Conservative Party (CP) in March 1982 after its members broke away from the NP, was vehemently opposed to negotiations between the NP and the African National Congress (ANC) to end apartheid.
During the second round of negotiations, CODESA II, which commenced in December 1991, the NP insisted that any future political dispensation had to take the form of a power-sharing arrangement. One of the reasons the NP pushed this position was that the CP was seemingly gaining popularity by opposing any transition through a negotiated settlement. The CP capitalised on fears among conservative Whites that a black-led government would be disastrous for them. Recent CP victories in three by-elections had sent jitters through the ranks of the NP.
In 1991 the CP won two seats in by-elections, giving the impression that the party stood a chance of winning a general election. In February 1992 a third by-election was held in Potchefstroom to fill a seat left vacant by the death of Louis le Grange, who was also the speaker of the white House of Assembly. A nervous De Klerk went to Potchefstroom and actively campaigned for the NP. Despite his efforts, the seat was won by Andries Beyers, the secretary of the CP, who garnered 9,746 votes in contrast to the 7,606 votes for his NP opponent, Theuns Kriel. Thus during the period between CODESA I and CODESA II, the NP lost three by-elections to the CP.
While the defeats did not weaken the NP and its control of parliament, it emboldened the CP to further harden its stance against negotiations. As Beyers argued: "The message to Mr De Klerk is to resign and call a general election." On 21 February 1992, De Klerk reacted to the challenge by announcing that the country would hold a whites-only referendum to ascertain white support for negotiations. De Klerk also stated that he would resign as president if the majority voted against the process of dismantling apartheid. The outcome of the referendum would have profound implications for the future of South Africa.
CP leader Andries P Treurnicht, also known as "Dr No", gave an undertaking that his party would participate "as long as the playing field is level". While the CP welcomed the poll, some ANC leaders were opposed to the referendum as it was for White people only. But Nelson Mandela persuaded the ANC to throw its support behind a "Yes" vote as a "No" vote or even only a narrow NP victory could have plunged the country into chaos – right wing elements would reverse the entire negotiation process. Chris Hani and the secretary of the South African Council of Churches, Rev Frank Chikane, among others, warned of the implications of a "No" vote. To dispel perceptions fuelled by the right wing that whites would lose everything under an ANC- or black-led government, Mandela assured whites that an ANC-led government would not retrench white civil servants, and that those who left would retain their benefits.
Business, Sports and International relations
Various local and international institutions expressed concern should the referendum return a "No" vote victory. Big businesses in the country highlighted the dangers of a "No" vote and vigorously campaigned for a "Yes" vote. Companies such as Anglo-American, Barlow Rand, BP, Caltex, First National Bank, Murray & Roberts, Shell, and Standard Bank weighed in and canvassed for a "Yes" vote among their employees. Several business leaders launched a Private Sector Referendum Fund to finance the campaign for a "Yes" vote. An estimated R1-million was raised in support of De Klerk and the "Yes" vote. Adverts in newspapers stated:
"This is what we have achieved since I990: we have already been accepted back into the international fold; sanctions have been lifted, trade is starting to prosper; investment capital is pouring in, creating new jobs, new opportunities. This is what a 'No' vote will destroy overnight." (Sunday Times, 8 March 1992)
Chester Crocker, the former US Assistant Secretary of State for African Affairs, indicated that the US would not defend a right-wing Pretoria regime and would demand punitive action. The Federation of Economic Organisations in Japan threatened to snub South Africa should the CP win. The Australian government threatened to reinstate sanctions and ban the South African national rugby team (Springboks) from playing in Australia.
On 12 March the European Parliament in Strasbourg declared that a positive outcome (a victorious "Yes" vote) would accelerate the normalisation of South Africa's relations with the West and hasten the removal of sanctions on arms sales. That same day leaders of the Frontline States deliberated on the implication of a "No" vote in Zambia's capital Lusaka at a one-day summit. In attendance were representatives of the ANC and the Pan Africanist Congress (PAC). After the meeting the states issued a joint communiqué on the impact a "No" vote would have for Southern Africa.
In South Africa other political formations also campaigned for the "Yes" vote. Zach de Beer, the leader of the Democratic Party (DP), said at a public meeting in Port Elizabeth that his party's view was that a "No" vote would bring the right wing to power, leaving them free to "decide which part of South Africa is to be reserved exclusively for whites". This would result in the reinstatement of all forms of international sanctions, including economic sanctions. In addition the party printed posters encouraging voters to shun the "No" vote.
The CP formed a pact with other right-wing parties opposed to the President's reform process, such as the Afrikaner Weerstands Beweging (AWB), led by Eugene Terre'Blanche. Certain black people also supported the position of the CP – two days before the referendum the head of the Reformed Independent Churches Association, Bishop Isaac Mokoena, declared: "Giving in to the ANC means capitulating to communism. I am trying to stop the ANC-SACP takeover. For that reason the CP must win." (City Press, 15 March 1992).
A poster (bottom) for the whites-only referendum reflects right-wing views of the process of negotiations between the NP and the ANC. Photograph by Graeme Williams. Permission: Africa Media Online
The question the voters had to decide on was: "Do you support the continuation of the reform process that the state president started on 2 February 1990 and which is aimed at a new constitution through negotiation?" On the voting day, 86 percent of the registered voters turned out and 68.7 percent (1,924,186) voted "Yes" in all of the 15 regions expect one. The "No" vote stood at 875,619. Polling patterns in major towns showed approval for the "Yes" vote. Pretoria voted 57 percent "Yes", while Cape Town and Bloemfontein polled 85 and 58.5 percent respectively. In Pietersburg (now Polokwane) white people voted "No" with a majority of 56.8 percent.
Thus, De Klerk won his gamble and defeated the CP and its white right-wing sympathisers. He also hoped to use his victory to strengthen his position in the negotiations. De Klerk declared: "Today we have closed the book on apartheid. It doesn't often happen that in one generation a nation gets an opportunity to rise above itself. The white electorate has risen above itself in this referendum"¦" (Meredith, 1997, p.456). As Mandela noted after the outcome of the results: "In principle, the referendum signalled the end of white privilege"¦ the 'Yes' vote means that whites are now prepared to address these problems. There is no alternative to negotiations."
The outcome was more than just an approval for the NP to continue with the negotiation process; it reflected approval for a "peaceful" transition from apartheid to democratic rule.
Produced 26 March 2012

redpajama_set_name: RedPajamaCommonCrawl


Ethan Wolff-Mann is moving from Money to a staff writer position at Yahoo Finance. Wolff-Mann had been a reporter at Money since 2015, and was previously the deputy editor of Supercompressor and a staff writer at Reviewed.com. Follow Money on Twitter.


While moving the two unpleasant and awful thoughts that come to mind are packing or damaged your luggage while moving it, don't worry while Unbeatable Removals is here to help you with anything you need to move! Either it is piano moves or commercial moves or house moves, junk removals or single flat move, we are here to assist you with and give you your peace of mind. With thousands of customers and their confidence in us had made us believe that we provide with best only. Don't get worried because the luggage is too heavy and it isn't as easy the small luggage, Unbeatable Removals is here!
Our team is highly efficient and experienced in the field they work in. they are highly reliable and flexible in a way that our customers' ideas and concerns do not go unheard and things go according to them. If you want to assist in packing yourself, there are affordable wrapping material available too. We also provide unlimited free boxes on the day of the move or if you would like them before the move. The weather will not affect our services and neither will the size of your luggage. Whether your luggage is delicate or not the same amount of care is given and it handled with respect. It is also secured with high-quality ties and pads. Our team makes sure it is delivered undamaged, unbroken and scratch-free.
The prices are reasonable and favorable: flat, half an hour rate that will help you not wasting any money. The boxes provided are to be returned within two weeks.
Call Unbeatable Removals on 0416962100 or fill out an easy online form for an obligation-free quote.


text:
Album Reviews : Eritherium – Ephemeral
By Sam Maher on November 10, 2013
"Technical Enslaved".
Ok, how about "stoned Ne Obliviscaris". Curious now?
Yeah, you should be.
Ephemeral, the debut EP from Sweden's Melbourne's Eritherium, displays a dark and depressive (you know, anything starting with 'd') take on progressive metal with a strong focus on creating brooding atmospheres and complex moods. Overall the music makes strong use of mid-tempo black metal-inspired riffs whilst drifting in and out of sparkling clean sections, in similar fashion to Enslaved or some of Opeth's earlier material. Similar also to these artists are the harsh, raspy vocals that almost feel like they are being drawn from the background and woven into the chordal dissonance of the music.
What sets Eritherium apart from these artists, however, is the infusion of more technical guitar and bass work. This style of music tends to be associated with fairly unoriginal bass lines that are then drowned out in the mix anyway, but Ephemeral displays almost the opposite tendency. Josh Chisinga displays more 'lead'-style bass lines, similar in fashion to that of Sean Malone (Cynic), John Myung (Dream Theater) or Justin Chancellor (Tool), that sit rather high in the mix and provide some unique melodic phrases and rhythmic counterpoints to the atmospheric backdrops. The plenitude of guitar solos is also somewhat unusual in this style but their execution makes them fit perfectly with the band's style. Despite being fast-paced and quite technical, the lead guitar work suits the music so well that it is almost difficult to notice, functioning more as an extra layer of melodic intensity rather than a series of "stop what you are doing and look at me, everyone" moments.
This cocktail of Opethian riffery and technical string work will no doubt evoke thoughts of Ne Obliviscarisian (try saying that out loud, it's fun) insanity. This is not a bad comparison, but the much slower tempo and lo-fi production to Eritherium's style gives it a more stoner or drone feel, making it more calming than overwhelming. Different also is the vocal approach, featuring only raspy growls (with no clean vocals to accompany the sporadic clean guitars) which are only used very sparsely. The majority of the EP is in fact instrumental, with the vocals only coming in every so often so add an extra layer of discordant harshness to some of the heavier sections. As mentioned before, even when the vocals do come in they sit relatively low in the mix, making them seem more a part of the background than is commonly seen. I'm sure this makes it sound like screaming in the forest. Or something.
The overall style to the music is unique and interesting, but the one major let-down (at least for this reviewer) is the poor production quality. It's not clear whether this is the unintended result of budget or expertise constraints or whether it is a deliberate incorporation fitting the band's black metal influences, but either way it does somewhat spoil an otherwise enjoyable experience. If you are the kind of person that thinks that Opeth's Orchid is better than Blackwater Park then this probably won't concern you overly much (and also you should be shot) but if you rather enjoy hearing the clarity in the instrumentation then Ephemeral's production might be a thorn in your side also. Removing the fuzz from the guitars and cleaning up the distinctions between the different elements to the music would only serve to bring out the beauty in the instrumentation and intensify the atmospheric experience, bringing the whole sound into greater focus for the listener.
If the idea of Alexi Laiho joining Enslaved tickles your tastebuds, or if the idea of hearing what would happen if Ne Obliviscaris recorded an album in the '60s excites your eardrums then you should certainly check out Eritherium. Fans of dark progressive metal will almost certainly be interested, but fans of drone-y black or death metal will possibly also find something new to dig here as well.
Note that Eritherium have just released their full-length album "Loss" around the time of this review being published. It represents an interesting evolution of their sound, be sure to check it out!
Band: Eritherium
Album: Ephemeral
Genre: Progressive metal
Label: none/independent
Origin: Melbourne, Australia
https://www.facebook.com/Eritherium
1. The Struggle
2. Gaia
3. Internal Seclusion
4. Moonflow
About Sam Maher
Sam Maher is Metal Obsession's resident prog reviewer. He only likes songs that are at least 15 minutes long, contain 4 guitar solos and can only be described with a genre that is at least six words long. He also plays guitar for Sydney-based groovy melodic progressive technical death metal band Apparitions of Null.
"We've got a ton of new material" – An interview with Joe Buras (Born of Osiris)


text:
Hugh Hefner.
September 30, 2017 by Steven
I love watching the arc of the response when a big culture maker like Hugh Hefner dies. First the lionization (he was a god!), then the backlash (he was a monster!), then there's room for something more balanced while the two sides continue to fight it out.
Whatever you think of him, it's hard to imagine someone more culturally influential than Hugh Hefner. Or more peculiarly American. You see his influence everywhere, for good and bad. What creates such a phenomenon, what is it about a person at a particular moment in history that makes that happen? These are the questions I become obsessed with.
I start with the idea that people (men mostly?) have a bottomless appetite for erotic images, erotic talk, erotic thoughts, but historically various social controls (church/traditional morality and taboos, marriage) pushed back against indulging that appetite. This is just true, right?
Then comes the so-called sexual revolution of the second half of the 20th century, which is inextricably linked to the kind of mass commercialization of sexuality Hefner pioneered. Is it even possible to think of the successes of the women's movement (relaxing of sex roles, women as the agents of their own sex lives, normalization of birth control…) without the new frankness about sex that Playboy sold? Or gay rights, same question?
Hefner took something it was obvious men wanted and sold it, and changed the world. The world-changing aspect of it was not accidental. He didn't just sell pictures of naked ladies. Along with the sexual images, he sold the new world in which it was possible to consume those images without shame.
Is it an American phenomenon, that it takes commercializing something to ease old taboos? Does it really come down to, "If I can make money off it, it must be okay."? Are Americans willing to leave anything unexamined if it comes with a Horatio Alger story?
Put bluntly: On one hand Hefner ushered in the ubiquity in media of images of women as ideal and willing sex objects (and all the attendant distortions for men and boys regarding expectations and consent). On the other hand, he played a big part in relaxing the shame associated with female and homosexual desire (which contributed to a massive social and legal shift for the better for women and gay people). Is it possible to extricate one from the other?
September 30, 2017 /Steven


Despite rising levels of pollution, China still relies heavily on fossil fuels to provide the majority of its energy needs. Recently, however, the Chinese government has made headway in growing the green tech sector. Domenico Di Liello, Knowledge Centre Coordinator at the EU SME Centre, outlines different opportunities available to European businesses operating in an ever-greening Chinese economy.
Since its founding in 1949, China has relied heavily on fossil fuels to provide energy to its citizens and industry. Coal, in particular, has served the country as their main source of power for more than half a century. Due to its vast availability and low price, it rapidly became the core of the nation's energy policy. Today, almost 40 years after the launch of economic reforms, coal still provides 64 per cent of domestic energy demand.
Utilising this much fossil fuel has had a devastating effect on the environment.
In 2006, China overtook the US as the world's largest emitter of CO2, a position it still holds firmly some 10 years later. Domestically, the quality of the water, soil and air is severely compromised: around 80 per cent of the groundwater in the mainland's major river basins are unsafe for human contact; the latest figures from the Ministry of Environmental Protection and the Ministry of Land and Resources tell that 16.1 per cent of China's surveyed land is polluted by heavy metals such as cadmium, arsenic, lead and mercury. Chinese cities, especially in the northern part of the country, are often surrounded by toxic smog stemming, from industrial discharge, the burning of coal and car emissions.
Pollution's combined costs are huge, annually approaching 10 per cent of China's gross domestic product (GDP) over the past decade, with air pollution accounting for approximately 6.5 per cent, and soil degradation for the remaining 1.1 per cent.
The good news is that the Chinese government has declared war on pollution as part of its broader plan to promote the country's transition towards a low carbon economy. In fact, China's commitment to a low carbon future started just before the Copenhagen summit in 2009, where the country pledged to cut its carbon intensity by 40-50 per cent, relative to 2005 levels, by 2020. Recently, in the 13th Five-Year Plan (13FYP), Chinese authorities reaffirmed their commitment by introducing 15 per cent energy intensity and 18 per cent carbon intensity reduction targets relative to 2015 levels, in accordance with the previous 12th Five-Year Plan (12FYP).
These measures, together with all other policies and campaigns Beijing has launched to strengthen and extend its efforts in promoting environmental protection, energy efficiency and low carbon growth, are expected to provide green tech sector opportunities for domestic and foreign players. These new opportunities can be found in areas of conventional and renewable energy, water, air and soil pollution and waste management.
Naturally, not all sectors are equally accessible to foreign companies. Factors such as market structure, the degree of competition, barriers to entry etc., will determine market access in the green tech sector.
in mining and wastewater treatment after usage. Moreover, advanced technologies, such as turbine bypass systems or fault monitoring systems will be in greater demand due to China's next-generation power plants. The gas, oil and nuclear sectors will offer niches where SMEs can offer products and services.
• Renewable energy: SMEs should be looking into areas such as waste to energy and waste to heat, which is where the main opportunities are. In more mature industries, like wind or solar, SMEs should be able to leverage engineering knowledge and find business prospects.
• Water: Innovative urban water design, energy efficient water saving technologies, secondary water supply systems, water reclamation technology and other solutions have seen growing demand in China and are expected to continue growing in the future. However, when it comes to the rural and agricultural sector, SMEs might find it difficult to enter the market as it is still under strict government control, it relies heavily upon national funding and, due to the location of the project, EU SMEs might need to cooperate with local governments that have limited experience in project management or technological innovation.
opportunities for companies that offer engineering and mechanical solutions able to increase resource use efficiency and reduce emissions in compliance with new and more stringent standards approved by the government. Engineering and mechanical solutions will find demand in sectors that deal with air pollution control, operations and compliance, energy recovery, increased capacity, upgrades and retrofits. In sectors such as construction and smart cities, SMEs will find potential leads in areas such as top-level design, green buildings, green transportation, recycling systems for industrial parks, comprehensive governance in the urban environment etc. Soil pollution, on the other hand, although potentially rich in opportunities, is still in its infancy, with the majority of business remaining in the hands of domestic players. Similar reasons make the industrial hazardous waste sector not particularly appealing to EU SMEs. Nevertheless, potential leads can be found in hazardous waste classification, collection and management.
Finally, prior to market access, SMEs should take all necessary steps to ensure they are ready for Chinese green tech sector integration. Conducting market research to identify opportunities, build awareness of potential threats, understanding local competition, protecting intellectual property rights, profiling potential partners, adapting products and services to meet local requirements are all fundamental tasks that need to be undertaken before joining China's green tech market.
 National Bureau of Statistics of China, 2016.
 Knight Z., Robins N., Chan W., Natural Capital – Identifying implications for Economies, HSBC, 2014.
Share the post "Opportunities and Access in Green Tech"