Log along the x-axis (bug 189) #296

Merged
merged 4 commits into from May 29, 2014

Projects

None yet

2 participants

@kberg
Collaborator
kberg commented Apr 23, 2014

No description provided.

Robert Konig... added some commits Apr 23, 2014
Robert Konigsberg x axis log scale. 5b9b214
Robert Konigsberg Merge branch 'master' into xlog
Conflicts:
	dygraph-layout.js
335011f
@kberg kberg changed the title from Log along the x-axis to Support log scale on the x axis Apr 23, 2014
@kberg kberg changed the title from Support log scale on the x axis to Log along the x-axis (bug 189) Apr 23, 2014
@danvk danvk and 1 other commented on an outdated diff Apr 23, 2014
dygraph-interaction-model.js
@@ -38,8 +38,14 @@ Dygraph.Interaction.startPan = function(event, g, context) {
var i, axis;
context.isPanning = true;
var xRange = g.xAxisRange();
- context.dateRange = xRange[1] - xRange[0];
- context.initialLeftmostDate = xRange[0];
+
+ if (g.getOptionForAxis("logscale", 'x')) {
@danvk
danvk Apr 23, 2014 Owner

single quotes? double quotes?

@kberg
kberg Apr 23, 2014 Collaborator

What, you don't appreciate art? Fixed.

Robert Konigsberg dingle quotes. 5ec8b8a
@danvk danvk and 1 other commented on an outdated diff Apr 23, 2014
dygraph-layout.js
@@ -207,6 +212,14 @@ DygraphLayout.prototype._evaluateLimits = function() {
}
};
+DygraphLayout.calcXNormal_ = function(value, axis, logscale) {
@danvk
danvk Apr 23, 2014 Owner

Is DygraphAxisType really DygraphYAxisType? This code is duplicated and I'm not sure that it needs to be.

@kberg
kberg Apr 24, 2014 Collaborator

What are you referring to?

The code needs to be duplicated because of the x-prefixes. Also, I wouldn't stress too much over five duplicate lines, though I agree clean-up would be nice.

@danvk danvk commented on the diff Apr 23, 2014
dygraph-layout.js
@@ -175,6 +175,7 @@ DygraphLayout.prototype.setYAxes = function (yAxes) {
};
DygraphLayout.prototype.evaluate = function() {
+ this._xAxis = {};
@danvk
danvk Apr 23, 2014 Owner

Looks like most member vars have trailing underscores. I should really clean this up sometime.

@kberg
kberg Apr 24, 2014 Collaborator

ack. Agreed, and, no-op.

@danvk danvk and 1 other commented on an outdated diff Apr 23, 2014
dygraph-layout.js
@@ -183,11 +184,15 @@ DygraphLayout.prototype.evaluate = function() {
DygraphLayout.prototype._evaluateLimits = function() {
var xlimits = this.dygraph_.xAxisRange();
- this.minxval = xlimits[0];
- this.maxxval = xlimits[1];
+ this._xAxis.minxval = xlimits[0];
@danvk
danvk Apr 23, 2014 Owner

why do you need to call this "minxval" if it's an x-axis? Why not minval? Would an object ever have a minxval and a minyval?

@kberg
kberg Apr 24, 2014 Collaborator

Because the related yAxes (yAxis?) field has {min,max}yval as its values, so I went for consistency.

@danvk
danvk May 12, 2014 Owner

I don't see much point in being consistent with a silly precedent. Is it hard to fix this? The underscore indicates that _xAxis is an internal type, so there shouldn't be any downsides to changing its properties.

@kberg
kberg May 12, 2014 Collaborator

Fixed. I renamed axis to xAxis for CalcXNormal to help clarify which axis is expected at that point.

@danvk danvk commented on the diff Apr 23, 2014
dygraph.js
@@ -734,6 +734,14 @@ Dygraph.prototype.optionsViewForAxis_ = function(axis) {
if (axis_opts && axis_opts[axis] && axis_opts[axis].hasOwnProperty(opt)) {
return axis_opts[axis][opt];
}
+
+ // I don't like that this is in a second spot.
@danvk
danvk Apr 23, 2014 Owner

What is "this" here? It's not clear what the other location is that comment is referring to.

@kberg
kberg Apr 24, 2014 Collaborator

I didn't like repeating the special case of computing the logscale attribute for x-axes such that it ignores the global user-specified setting. I also don't like the optionsViewForAxis code either. :) Advice on code / comment?

@danvk danvk commented on the diff Apr 23, 2014
dygraph.js
@@ -1521,16 +1576,6 @@ Dygraph.prototype.doZoomX_ = function(lowX, highX) {
};
/**
- * Transition function to use in animations. Returns values between 0.0
- * (totally old values) and 1.0 (totally new values) for each frame.
- * @private
- */
-Dygraph.zoomAnimationFunction = function(frame, numFrames) {
@danvk
danvk Apr 23, 2014 Owner

I'm not sure why this is showing up in the diff -- did you move it?

@kberg
kberg Apr 24, 2014 Collaborator

I did. It was put smack dab in the middle of related methods.

@kberg
Collaborator
kberg commented May 10, 2014

ping!

Robert Konigsberg Mind renaming. bacf5ce
@kberg kberg merged commit ebf77a9 into master May 29, 2014
@kberg kberg deleted the xlog branch May 29, 2014
@danvk danvk restored the xlog branch Jun 13, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment