projects
/
dygraphs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
10 -> Dygraph.LOG_SCALE
[dygraphs.git]
/
dygraph-canvas.js
diff --git
a/dygraph-canvas.js
b/dygraph-canvas.js
index
23e93a8
..
b90695b
100644
(file)
--- a/
dygraph-canvas.js
+++ b/
dygraph-canvas.js
@@
-88,6
+88,9
@@
DygraphLayout.prototype._evaluateLimits = function() {
axis.maxyval = axis.computedValueRange[1];
axis.yrange = axis.maxyval - axis.minyval;
axis.yscale = (axis.yrange != 0 ? 1.0 / axis.yrange : 1.0);
axis.maxyval = axis.computedValueRange[1];
axis.yrange = axis.maxyval - axis.minyval;
axis.yscale = (axis.yrange != 0 ? 1.0 / axis.yrange : 1.0);
+
+ axis.ylogrange = Dygraph.log10(axis.maxyval) - Dygraph.log10(axis.minyval);
+ axis.ylogscale = (axis.ylogrange != 0 ? 1.0 / axis.ylogrange : 1.0);
}
};
}
};
@@
-102,10
+105,17
@@
DygraphLayout.prototype._evaluateLineCharts = function() {
for (var j = 0; j < dataset.length; j++) {
var item = dataset[j];
for (var j = 0; j < dataset.length; j++) {
var item = dataset[j];
+
+ var yval;
+ if (axis.logscale) {
+ yval = 1.0 - ((Dygraph.log10(parseFloat(item[1])) - Dygraph.log10(axis.minyval)) * axis.ylogscale); // really should just be yscale.
+ } else {
+ yval = 1.0 - ((parseFloat(item[1]) - axis.minyval) * axis.yscale);
+ }
var point = {
// TODO(danvk): here
x: ((parseFloat(item[0]) - this.minxval) * this.xscale),
var point = {
// TODO(danvk): here
x: ((parseFloat(item[0]) - this.minxval) * this.xscale),
- y:
1.0 - ((parseFloat(item[1]) - axis.minyval) * axis.yscale)
,
+ y:
yval
,
xval: parseFloat(item[0]),
yval: parseFloat(item[1]),
name: setName
xval: parseFloat(item[0]),
yval: parseFloat(item[1]),
name: setName
@@
-133,7
+143,7
@@
DygraphLayout.prototype._evaluateLineTicks = function() {
for (var j = 0; j < axis.ticks.length; j++) {
var tick = axis.ticks[j];
var label = tick.label;
for (var j = 0; j < axis.ticks.length; j++) {
var tick = axis.ticks[j];
var label = tick.label;
- var pos =
1.0 - (axis.yscale * (tick.v - axis.minyval)
);
+ var pos =
this.dygraph_.toPercentYCoord(tick.v, i
);
if ((pos >= 0.0) && (pos <= 1.0)) {
this.yticks.push([i, pos, label]);
}
if ((pos >= 0.0) && (pos <= 1.0)) {
this.yticks.push([i, pos, label]);
}
@@
-393,7
+403,9
@@
DygraphCanvasRenderer.prototype.render = function() {
function halfDown(y){return Math.round(y)-0.5};
if (this.options.underlayCallback) {
function halfDown(y){return Math.round(y)-0.5};
if (this.options.underlayCallback) {
- this.options.underlayCallback(ctx, this.area, this.dygraph_);
+ // NOTE: we pass the dygraph object to this callback twice to avoid breaking
+ // users who expect a deprecated form of this callback.
+ this.options.underlayCallback(ctx, this.area, this.dygraph_, this.dygraph_);
}
if (this.options.drawYGrid) {
}
if (this.options.drawYGrid) {