[redistricter] r219 committed - make x axis labels settable

0 views
Skip to first unread message

redist...@googlecode.com

unread,
Nov 8, 2011, 10:52:32 AM11/8/11
to redistrict...@googlegroups.com
Revision: 219
Author: brian.olson
Date: Tue Nov 8 07:52:16 2011
Log: make x axis labels settable
http://code.google.com/p/redistricter/source/detail?r=219

Modified:
/trunk/plotlib.js

=======================================
--- /trunk/plotlib.js Thu Sep 2 08:55:45 2010
+++ /trunk/plotlib.js Tue Nov 8 07:52:16 2011
@@ -50,9 +50,15 @@
};

PlotCommon.prototype.axisLabels = function(opt) {
+ var minxlabel = null;
+ var maxxlabel = null;
if (opt && opt['xlabels']) {
-
+ minxlabel = opt['xlabels'][0];
+ maxxlabel = opt['xlabels'][1];
} else {
+ minxlabel = new String(this.minx);
+ maxxlabel = new String(this.maxx);
+ }
/* Label minx and this.maxx on bottom of graph */
this.ctx.strokeStyle = '#555';
this.ctx.beginPath();
@@ -63,10 +69,10 @@
this.ctx.stroke();
this.ctx.textAlign = 'left';
this.ctx.textBaseline = 'top';
- this.ctx.fillText(new String(this.minx), this.px(this.minx),
this.py(this.miny));
+ this.ctx.fillText(minxlabel, this.px(this.minx), this.py(this.miny));
this.ctx.textAlign = 'right';
- this.ctx.fillText(new String(this.maxx), this.px(this.maxx),
this.py(this.miny));
- }
+ this.ctx.fillText(maxxlabel, this.px(this.maxx), this.py(this.miny));
+
if (opt && opt['ylabels']) {

} else {
@@ -107,7 +113,7 @@
this.ctx.lineTo(this.px(xy[i]), this.py(xy[i+1]));
}
this.ctx.stroke();
- this.axisLabels();
+ this.axisLabels(opt);
};

function lineplot(canvas, xy, opt) {
@@ -140,7 +146,7 @@
this.ctx.lineTo(tx, this.py(xy[i+1]));
}
this.ctx.stroke();
- this.axisLabels();
+ this.axisLabels(opt);
};

function calplot(canvas, xy, opt) {

Reply all
Reply to author
Forward
0 new messages