a:20:{s:9:"#provides";s:28:"dojox.charting.widget.Legend";s:9:"#resource";s:25:"charting/widget/Legend.js";s:9:"#requires";a:4:{i:0;a:3:{i:0;s:6:"common";i:1;s:13:"dijit._Widget";i:2;s:5:"dijit";}i:1;a:3:{i:0;s:6:"common";i:1;s:16:"dijit._Templated";i:2;s:5:"dijit";}i:2;a:2:{i:0;s:6:"common";i:1;s:27:"dojox.lang.functional.array";}i:3;a:2:{i:0;s:6:"common";i:1;s:26:"dojox.lang.functional.fold";}}s:28:"dojox.charting.widget.Legend";a:5:{s:4:"type";s:8:"Function";s:6:"chains";a:2:{s:9:"prototype";a:1:{i:0;s:13:"dijit._Widget";}s:4:"call";a:2:{i:0;s:13:"dijit._Widget";i:1;s:16:"dijit._Templated";}}s:6:"mixins";a:1:{s:9:"prototype";a:1:{i:0;s:26:"dijit._Templated.prototype";}}s:7:"summary";s:373:"A legend for a chart. A legend contains summary labels for
each series of data contained in the chart.
Set the boolean horizontal attribute to false to layout legend labels vertically.
(Line or Scatter charts (colored lines with shape symbols) )
-o- Series1 -X- Series2 -v- Series3
(Area/Bar/Pie charts (letters represent colors))
[a] Series1 [b] Series2 [c] Series3";s:9:"classlike";b:1;}s:37:"dojox.charting.widget.Legend.chartRef";a:2:{s:9:"prototype";s:28:"dojox.charting.widget.Legend";s:7:"summary";s:0:"";}s:39:"dojox.charting.widget.Legend.horizontal";a:2:{s:9:"prototype";s:28:"dojox.charting.widget.Legend";s:7:"summary";s:0:"";}s:43:"dojox.charting.widget.Legend.templateString";a:2:{s:9:"prototype";s:28:"dojox.charting.widget.Legend";s:7:"summary";s:0:"";}s:39:"dojox.charting.widget.Legend.legendNode";a:2:{s:9:"prototype";s:28:"dojox.charting.widget.Legend";s:7:"summary";s:0:"";}s:39:"dojox.charting.widget.Legend.legendBody";a:2:{s:9:"prototype";s:28:"dojox.charting.widget.Legend";s:7:"summary";s:0:"";}s:39:"dojox.charting.widget.Legend.postCreate";a:4:{s:9:"prototype";s:28:"dojox.charting.widget.Legend";s:4:"type";s:8:"Function";s:6:"source";s:432:" if(!this.chart){
if(!this.chartRef){ return; }
this.chart = dijit.byId(this.chartRef);
if(!this.chart){
var node = dojo.byId(this.chartRef);
if(node){
this.chart = dijit.byNode(node);
}else{
console.log("Could not find chart instance with id: " + this.chartRef);
return;
}
}
this.series = this.chart.chart.series;
}else{
this.series = this.chart.series;
}
this.refresh();";s:7:"summary";s:0:"";}s:36:"dojox.charting.widget.Legend.refresh";a:4:{s:9:"prototype";s:28:"dojox.charting.widget.Legend";s:4:"type";s:8:"Function";s:6:"source";s:1220:" var df = dojox.lang.functional;
// cleanup
if(this._surfaces){
dojo.forEach(this._surfaces, function(surface){
surface.destroy();
});
}
this._surfaces = [];
while(this.legendBody.lastChild){
dojo.destroy(this.legendBody.lastChild);
}
if(this.horizontal){
dojo.addClass(this.legendNode, "dojoxLegendHorizontal");
// make a container
this._tr = dojo.doc.createElement("tr");
this.legendBody.appendChild(this._tr);
}
var s = this.series;
if(s.length == 0){
return;
}
if(s[0].chart.stack[0].declaredClass == "dojox.charting.plot2d.Pie"){
var t = s[0].chart.stack[0];
if(typeof t.run.data[0] == "number"){
var filteredRun = df.map(t.run.data, "Math.max(x, 0)");
if(df.every(filteredRun, "<= 0")){
return;
}
var slices = df.map(filteredRun, "/this", df.foldl(filteredRun, "+", 0));
dojo.forEach(slices, function(x, i){
this._addLabel(t.dyn[i], t._getLabel(x * 100) + "%");
}, this);
}else{
dojo.forEach(t.run.data, function(x, i){
this._addLabel(t.dyn[i], x.legend || x.text || x.y);
}, this);
}
}else{
dojo.forEach(s, function(x){
this._addLabel(x.dyn, x.legend || x.name);
}, this);
}";s:7:"summary";s:54:"regenerates the legend to reflect changes to the chart";}s:38:"dojox.charting.widget.Legend._addLabel";a:6:{s:9:"prototype";s:28:"dojox.charting.widget.Legend";s:4:"type";s:8:"Function";s:10:"parameters";a:2:{s:3:"dyn";a:1:{s:4:"type";s:0:"";}s:5:"label";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:3436:"dojo.provide("dojox.charting.widget.Legend");
dojo.require("dijit._Widget");
dojo.require("dijit._Templated");
dojo.require("dojox.lang.functional.array");
dojo.require("dojox.lang.functional.fold");
dojo.declare("dojox.charting.widget.Legend", [dijit._Widget, dijit._Templated], {
// summary: A legend for a chart. A legend contains summary labels for
// each series of data contained in the chart.
//
// Set the boolean horizontal attribute to false to layout legend labels vertically.
//
// (Line or Scatter charts (colored lines with shape symbols) )
// -o- Series1 -X- Series2 -v- Series3
//
// (Area/Bar/Pie charts (letters represent colors))
// [a] Series1 [b] Series2 [c] Series3
chartRef: "",
horizontal: true,
templateString: "",
legendNode: null,
legendBody: null,
postCreate: function(){
if(!this.chart){
if(!this.chartRef){ return; }
this.chart = dijit.byId(this.chartRef);
if(!this.chart){
var node = dojo.byId(this.chartRef);
if(node){
this.chart = dijit.byNode(node);
}else{
console.log("Could not find chart instance with id: " + this.chartRef);
return;
}
}
this.series = this.chart.chart.series;
}else{
this.series = this.chart.series;
}
this.refresh();
},
refresh: function(){
// summary: regenerates the legend to reflect changes to the chart
var df = dojox.lang.functional;
// cleanup
if(this._surfaces){
dojo.forEach(this._surfaces, function(surface){
surface.destroy();
});
}
this._surfaces = [];
while(this.legendBody.lastChild){
dojo.destroy(this.legendBody.lastChild);
}
if(this.horizontal){
dojo.addClass(this.legendNode, "dojoxLegendHorizontal");
// make a container
this._tr = dojo.doc.createElement("tr");
this.legendBody.appendChild(this._tr);
}
var s = this.series;
if(s.length == 0){
return;
}
if(s[0].chart.stack[0].declaredClass == "dojox.charting.plot2d.Pie"){
var t = s[0].chart.stack[0];
if(typeof t.run.data[0] == "number"){
var filteredRun = df.map(t.run.data, "Math.max(x, 0)");
if(df.every(filteredRun, "<= 0")){
return;
}
var slices = df.map(filteredRun, "/this", df.foldl(filteredRun, "+", 0));
dojo.forEach(slices, function(x, i){
this._addLabel(t.dyn[i], t._getLabel(x * 100) + "%");
}, this);
}else{
dojo.forEach(t.run.data, function(x, i){
this._addLabel(t.dyn[i], x.legend || x.text || x.y);
}, this);
}
}else{
dojo.forEach(s, function(x){
this._addLabel(x.dyn, x.legend || x.name);
}, this);
}
},
_addLabel: function(dyn, label){
// create necessary elements
var icon = dojo.doc.createElement("td"),
text = dojo.doc.createElement("td"),
div = dojo.doc.createElement("div");
dojo.addClass(icon, "dojoxLegendIcon");
dojo.addClass(text, "dojoxLegendText");
div.style.width = "20px";
div.style.height = "20px";
icon.appendChild(div);
// create a skeleton
if(this._tr){
// horizontal
this._tr.appendChild(icon);
this._tr.appendChild(text);
}else{
// vertical
var tr = dojo.doc.createElement("tr");
this.legendBody.appendChild(tr);
tr.appendChild(icon);
tr.appendChild(text);
}
// populate the skeleton
this._makeIcon(div, dyn);
text.innerHTML = String(label);";s:7:"private";b:1;s:7:"summary";s:0:"";}s:38:"dojox.charting.widget.Legend._makeIcon";a:6:{s:9:"prototype";s:28:"dojox.charting.widget.Legend";s:4:"type";s:8:"Function";s:10:"parameters";a:2:{s:3:"div";a:1:{s:4:"type";s:0:"";}s:3:"dyn";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:1128:" var mb = {h: 14, w: 14};
var surface = dojox.gfx.createSurface(div, mb.w, mb.h);
this._surfaces.push(surface);
if(dyn.fill){
// regions
surface.createRect({x: 2, y: 2, width: mb.w - 4, height: mb.h - 4}).
setFill(dyn.fill).setStroke(dyn.stroke);
}else if(dyn.stroke || dyn.marker){
// draw line
var line = {x1: 0, y1: mb.h / 2, x2: mb.w, y2: mb.h / 2};
if(dyn.stroke){
surface.createLine(line).setStroke(dyn.stroke);
}
if(dyn.marker){
// draw marker on top
var c = {x: mb.w / 2, y: mb.h / 2};
if(dyn.stroke){
surface.createPath({path: "M" + c.x + " " + c.y + " " + dyn.marker}).
setFill(dyn.stroke.color).setStroke(dyn.stroke);
}else{
surface.createPath({path: "M" + c.x + " " + c.y + " " + dyn.marker}).
setFill(dyn.color).setStroke(dyn.color);
}
}
}else{
// nothing
surface.createRect({x: 2, y: 2, width: mb.w - 4, height: mb.h - 4}).
setStroke("black");
surface.createLine({x1: 2, y1: 2, x2: mb.w - 2, y2: mb.h - 2}).setStroke("black");
surface.createLine({x1: 2, y1: mb.h - 2, x2: mb.w - 2, y2: 2}).setStroke("black");
}";s:7:"private";b:1;s:7:"summary";s:0:"";}s:34:"dojox.charting.widget.Legend.chart";a:2:{s:8:"instance";s:28:"dojox.charting.widget.Legend";s:7:"summary";s:0:"";}s:35:"dojox.charting.widget.Legend.series";a:2:{s:8:"instance";s:28:"dojox.charting.widget.Legend";s:7:"summary";s:0:"";}s:38:"dojox.charting.widget.Legend._surfaces";a:3:{s:8:"instance";s:28:"dojox.charting.widget.Legend";s:7:"private";b:1;s:7:"summary";s:0:"";}s:32:"dojox.charting.widget.Legend._tr";a:3:{s:8:"instance";s:28:"dojox.charting.widget.Legend";s:7:"private";b:1;s:7:"summary";s:0:"";}s:21:"dojox.charting.widget";a:2:{s:4:"type";s:6:"Object";s:7:"summary";s:0:"";}s:14:"dojox.charting";a:2:{s:4:"type";s:6:"Object";s:7:"summary";s:0:"";}s:5:"dojox";a:2:{s:4:"type";s:6:"Object";s:7:"summary";s:0:"";}}