-
Notifications
You must be signed in to change notification settings - Fork 232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Impossible to select the entire summary? #21
Comments
(Please keep in mind that I've never written any JS... I could be totally mistaken.) After investigation I believe this is caused by the function boundX(x, graph) {
return Math.min(Math.max(0, x), graph.plotWidth - 1);
} The selection is set to a maximum of width - 1. In my case The interesting part is how this maxed width is then multiplied with the axis scale: setSelection: function(area, preventEvent){
var options = this.options,
xa = this.axes.x,
ya = this.axes.y,
vertScale = ya.scale,
hozScale = xa.scale,
selX = options.selection.mode.indexOf('x') != -1,
selY = options.selection.mode.indexOf('y') != -1,
s = this.selection.selection;
this.selection.clearSelection();
s.first.y = boundY((selX && !selY) ? 0 : (ya.max - area.y1) * vertScale, this);
s.second.y = boundY((selX && !selY) ? this.plotHeight - 1: (ya.max - area.y2) * vertScale, this);
s.first.x = boundX((selY && !selX) ? 0 : (area.x1 - xa.min) * hozScale, this);
s.second.x = boundX((selY && !selX) ? this.plotWidth : (area.x2 - xa.min) * hozScale, this);
this.selection.drawSelection();
if (!preventEvent)
this.selection.fireSelectEvent();
}, Yet the scale in setScale : function () {
var
length = this.length,
max = this.max,
min = this.min,
offset = this.offset,
orientation = this.orientation,
options = this.options,
logarithmic = options.scaling === LOGARITHMIC,
scale;
if (logarithmic) {
scale = length / (log(max, options.base) - log(min, options.base));
} else {
scale = length / (max - min);
}
this.scale = scale; |
Should I open an issue in Flotr2 instead of Envision? |
Could you please fork this with your reproduction? http://jsfiddle.net/cesutherland/LurmY/49/ |
Ah, got it! |
Would you prefer if i opened this as a Flotr2 issue? |
Thank you, no... it's an issue en the envision data processing. I'll take a look at it. Maybe off-by-1 heh... |
Bump! Any changes? |
I have found this issue in my project as well.
As you can see with the data above, it seems to be an off-by-one error. I also tried this with a few smaller examples, (all the way down to 2 data points). The last data point was always missing when I tried to select some area. As mentioned above, by @Frozenlock , when I click the summary list to reset the selection, the whole data pool is displayed. |
I have found the off-by-one error to be in flotr2.js function called boundX. This is in line # 4117 in the envision.js file. After some testing on my charts, this seems to cause no error and fixes all my problems. |
This appears to fix the problem we are seeing where the right edge of the selected area is truncated, so that the resulting detail graph does not show the full area. Who knows what side effects this has, but the function appears to be only used for selecting on graphs. This issue appears to be similar to what we are seeing: HumbleSoftware/envisionjs#21 Keep track of what is going on with this in the trac, Ticket #60.
For a summary of width 848, a reset (click) in the selection area will give a selection object of: max: 848.0000000000001.
However, dragging the mouse in the selection area will only give a selection of max 846.9999999999826, thus never entirely selecting the entire data set.
A selection trigger seems to give the same result: can't get up to 848.0000000000001.
The text was updated successfully, but these errors were encountered: