Permalink
Browse files

* Fix: Pie/Bar/Area accept width and height in their constructor to be

delegated to the canvas options.
* Fix: Icicle layout now ignores flagged nodes.
* Add: showAggregates can be a renderer function.
  • Loading branch information...
1 parent 922f8da commit cc44229e9bdd4f859afcf062e65f317406ff4f92 @philogb philogb committed Mar 16, 2011
@@ -55,7 +55,7 @@ Layouts.Icicle = new Class({
root.setData('height', height, posType);
var nodeLength, prevNodeLength = 0, totalDim = 0;
- var children = Graph.Util.getSubnodes(root, [1, 1]); // next level from this node
+ var children = Graph.Util.getSubnodes(root, [1, 1], 'ignore'); // next level from this node
if(!children.length)
return;
@@ -85,8 +85,9 @@ $jit.ST.Plot.NodeTypes.implement({
ctx.font = label.style + ' ' + label.size + 'px ' + label.family;
ctx.textAlign = 'center';
ctx.textBaseline = 'middle';
- if(aggregates(node.name, valLeft, valRight, node)) {
- ctx.fillText(valAcum, x, y - acumLeft - config.labelOffset - label.size/2, width);
+ var aggValue = aggregates(node.name, valLeft, valRight, node, valAcum);
+ if(aggValue !== false) {
+ ctx.fillText(aggValue !== true? aggValue : valAcum, x, y - acumLeft - config.labelOffset - label.size/2, width);
}
if(showLabels(node.name, valLeft, valRight, node)) {
ctx.fillText(node.name, x, y + label.size/2 + config.labelOffset);
@@ -169,6 +170,8 @@ $jit.AreaChart = new Class({
var st = new $jit.ST({
injectInto: config.injectInto,
+ width: config.width,
+ height: config.height,
orientation: "bottom",
levelDistance: 0,
siblingOffset: 0,
@@ -74,13 +74,15 @@ $jit.ST.Plot.NodeTypes.implement({
ctx.fillStyle = ctx.strokeStyle = label.color;
ctx.font = label.style + ' ' + label.size + 'px ' + label.family;
ctx.textBaseline = 'middle';
- if(aggregates(node.name, valAcum)) {
+ var aggValue = aggregates(node.name, valAcum, node);
+ if(aggValue !== false) {
+ aggValue = aggValue !== true? aggValue : valAcum;
if(horz) {
ctx.textAlign = 'right';
- ctx.fillText(valAcum, x + acum - config.labelOffset, y + height/2);
+ ctx.fillText(aggValue, x + acum - config.labelOffset, y + height/2);
} else {
ctx.textAlign = 'center';
- ctx.fillText(valAcum, x + width/2, y - height - label.size/2 - config.labelOffset);
+ ctx.fillText(aggValue, x + width/2, y - height - label.size/2 - config.labelOffset);
}
}
if(showLabels(node.name, valAcum, node)) {
@@ -340,6 +342,8 @@ $jit.BarChart = new Class({
var st = new $jit.ST({
injectInto: config.injectInto,
+ width: config.width,
+ height: config.height,
orientation: horz? 'left' : 'bottom',
levelDistance: 0,
siblingOffset: config.barsOffset,
@@ -602,7 +606,7 @@ $jit.BarChart = new Class({
updateJSON: function(json, onComplete) {
if(this.busy) return;
this.busy = true;
-
+ this.select(false, false, false);
var st = this.st;
var graph = st.graph;
var values = json.values;
@@ -781,4 +785,4 @@ $jit.BarChart = new Class({
}
});
}
-});
+});
@@ -163,6 +163,8 @@ $jit.PieChart = new Class({
var nodeType = config.type.split(":")[0];
var sb = new $jit.Sunburst({
injectInto: config.injectInto,
+ width: config.width,
+ height: config.height,
useCanvas: config.useCanvas,
withLabels: config.Label.type != 'Native',
Label: {
@@ -500,4 +502,4 @@ $jit.PieChart = new Class({
n.setData('normalizedDim', acum / maxValue);
});
}
-});
+});

0 comments on commit cc44229

Please sign in to comment.