Skip to content
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

Datahandler and Unified Data Format #249

Closed
wants to merge 48 commits into from

Conversation

davideberlein
Copy link
Contributor

Hey Dan and Robert,

this is the pull request for my proposal:
https://docs.google.com/document/d/1IWmX4oDbQbVtUoRNzSRG3yMpoBQ7LseVCQhGnuOZz_A/edit?pli=1#

Lint runs without any issues and so do all of the tests. (Including additional ones I added)

As you can see I have done some performance tweaks and this solution is now is faster than the current version in every aspect.
This implementation may still be extended and changed here and there but it is fully functional and introduces the new structure which fixes some bugs and is a great benefit for future feature development, at least in my point of view.
I would really appreciate if we could think about pulling it in the near future as an internal change and only add external options later when you have the feeling that everything is the way it should be.

The problem for me in the moment is that I have to merge every changes you do on the master and this is quite a bit of work. I think my proposal is in the right stadium to be integrated and further developed on your code base.

What do you think?

Best Regards

David

eichsjul and others added 30 commits April 18, 2013 14:51
… They are currently deactivated because they take quite a while to run.
…since the previous bug is fixed with the new data handler concept
onLineEvaluted passing all created points for one series instead of
calling the other method for each created point. Also added some bug
fixes to the yextemes method.
…hed Bugfix for the y extremes date window issue so that this can be pulled.
@davideberlein
Copy link
Contributor Author

Hey, I've done all the changes you requested (except the callback in DygraphLayouts). I tried to clean all the nits but as always I probably forgot something...

@@ -23,7 +23,6 @@
<script type="text/javascript" src="../tests/annotations.js"></script>
<script type="text/javascript" src="../tests/axis_labels.js"></script>
<script type="text/javascript" src="../tests/axis_labels-deprecated.js"></script>
<script type="text/javascript" src="../tests/callback.js"></script>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are you removing this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because Robert said so ^^ .. at least that's what I thought he was saying, see:
#249 (diff)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My mistake: I meant that you had refactored it, seemingly to remove whitespace, and I wanted the file out of the pull request since it was a whitespace-only change.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh okay ;-) sorry for that.. I readded the line now.

@davideberlein
Copy link
Contributor Author

Hey, thanks for the feedback, I'll look into this on monday

@danvk
Copy link
Owner

danvk commented Aug 3, 2013

Hi David, any updates?

@davideberlein
Copy link
Contributor Author

Hey, I refactored the JSDoc and installed the closure compiler to verify my changes.
Its still complaining that it doesn't know some types like Dygraphs or DygraphOptions. However I don't know how I can fix this.

@danvk
Copy link
Owner

danvk commented Aug 19, 2013

Hi David -- we haven't forgotten about this! We're going to pull it in soon for dygraphs version 1.1.0. We're still hashing out exactly what our branching strategy is for dygraphs releases, which is why we haven't pulled it yet.

@danvk
Copy link
Owner

danvk commented Aug 28, 2013

Hi David,

Good news -- I've pulled your change! Given the long history, I decided to pull it as a squash commit. Here it is:
a49c164

This should go out as part of the dygraphs 1.1.0 release. We may make some changes to address the remaining comments in this pull request (particularly the questions around Dygraph.DataHandlers.registerHandler), but we're happy to get this in.

Thanks for sticking with it -- and sorry this took so long!

@danvk danvk closed this Aug 28, 2013
@danvk
Copy link
Owner

danvk commented Aug 28, 2013

Here's a bit of cleanup. Feel free to comment on the commit.
3ea41d8

@kberg
Copy link
Collaborator

kberg commented Sep 15, 2013

I've discovered a limitation with this design. Specifically, let's assume that I want to make "wilsonInterval" vary per data series. Or sigma, or logscale (which will vary by axis, and not series, but allow me to not bother making that distinction any further, it by and large applies here.)

$ grep options.get *.js
bars-custom.js: var logScale = options.get('logscale');
bars-error.js: var sigma = options.get("sigma");
bars-error.js: var logScale = options.get('logscale');
bars-error.js: var sigma = options.get("sigma");
bars-fractions.js: var sigma = options.get("sigma");
bars-fractions.js: var logScale = options.get('logscale');
bars-fractions.js: var sigma = options.get("sigma");
bars-fractions.js: var wilsonInterval = options.get("wilsonInterval");
default-fractions.js: var logScale = options.get('logscale');
default.js: var logScale = options.get('logscale');

All these uses of options.get would need either the axis or series name being operated upon to know whether these options apply, which means using getForSeries instead of get.

The wilson interval is computed in this function:

FractionsBarsHandler.prototype.rollingAverage = function(originalData, rollPeriod, options) {

which has access to neither the series index or the series name.

Fortunately, this seems to be fairly centralized.

Here are two proposals:

  1. change the API just a bit by adding the series name to extractSeries, rollingAverage, getExtremeYValues, all of which currently accept options.
  2. Instead of supplying an instance of DygraphOptions, supply a closure around the options object so that it applies to the series being operated on. There are two problems with this, one simple and one nuanced. The simple problem is the change in the Closure-compatible jsdoc; the thing wouldn't be a DygraphsOptions object. The nuanced problem is described below, with a solution. But skip it unless you want to cry from mental exhaustion.

DygraphOptions.getForSeries looks for an option in the series, and then the axis, and then globally, so for instance, you can set the point size for an entire axis by setting an option:

axes : { y2 : { pointSize : 6 }}.

Any for all series on the y2 axis, the points will be drawn with radius 6. (Or is that diameter? Never mind.)

So what would happen if we called

options.getForSeries("logscale", seriesName)?

Well, if someone was foolish enough to set logscale in their series, and not in their axis, like so:

series : {
foo : { axes : y2, logscale : false }
},
axes : {
y2 : { logscale : true }
}

they would be told that logscale is false, when, no, that's bad!

Get it? So, that doesn't mean we can't use the closure idea, it just means we have to make option processing better. Solution? We do that by throwing errors when setting per-series options on things like "logscale" and "includezero".

danvk pushed a commit to kberg/dygraphs that referenced this pull request Apr 26, 2014
This commit unifies the various data formats used by dygraphs (error
bars, custom bars, fractions, simple numbers) into a single, canonical
format. It also allows users to create their own data formats.

Original proposal:
https://docs.google.com/document/d/1IWmX4oDbQbVtUoRNzSRG3yMpoBQ7LseVCQhGnuOZz_A/edit?pli=1#

This commit corresponds to pull request 249.
(danvk#249)

Squashed commit of the following:

commit acf2bc1dcdede4a52a5a9530476fbaf031009244
Author: Dan Vanderkam <danvdk@gmail.com>
Date:   Tue Aug 27 22:50:46 2013 -0400

    update closure TODO with new files

commit 13116fcf57a47b878f5cae2348718d61eebdc2e4
Merge: 0668281 625324f
Author: Dan Vanderkam <danvdk@gmail.com>
Date:   Tue Aug 27 22:43:50 2013 -0400

    Merge branch 'sauter-custom-datahandler' of https://github.com/sauter-hq/dygraphs into 249-datahandler

commit 625324f
Author: eberldav <eberldav@ch.sauter-bc.com>
Date:   Mon Aug 5 14:44:06 2013 +0200

    BUGFIX: Readded callback.js to the tests which was mistakenly removed.

commit d18669c
Author: eberldav <eberldav@ch.sauter-bc.com>
Date:   Mon Aug 5 14:28:41 2013 +0200

    DOC: Refactored JSDoc to fit the closure complier standard.

commit a5bb182
Author: eberldav <eberldav@ch.sauter-bc.com>
Date:   Mon Jul 22 18:04:37 2013 +0200

    BUGFIX: Fixed lint errors for static usage of Dygraph and DygraphLayout

commit a7b2e94
Author: David Eberlein <david.eberlein@ch.sauter-bc.com>
Date:   Mon Jul 22 16:53:36 2013 +0200

    REFACTORING: Changed some method parameters based on suggestions of Dan and Robert and added some documentation.

commit 1d65e4e
Author: David Eberlein <david.eberlein@ch.sauter-bc.com>
Date:   Mon Jul 22 15:16:07 2013 +0200

    REFACTORING: Renamed datahandler files

commit edb9bdf
Author: David Eberlein <david.eberlein@ch.sauter-bc.com>
Date:   Mon Jul 22 15:12:55 2013 +0200

    DOC: Added documentation for data handlers and fixed wrong method visibilities.

commit 9ed5d88
Merge: af5decb 22bc1f1
Author: David Eberlein <david.eberlein@ch.sauter-bc.com>
Date:   Fri Jul 19 10:09:28 2013 +0200

    Merge branch 'official-master' into sauter-custom-datahandler

    Conflicts:
    	dygraph.js

commit af5decb
Author: David Eberlein <david.eberlein@ch.sauter-bc.com>
Date:   Wed Jul 10 10:21:25 2013 +0200

    REFACTORING: Extracted getHandlerId_ method and refactored some variable names for better readability

commit 84be5b4
Author: David Eberlein <david.eberlein@ch.sauter-bc.com>
Date:   Tue Jul 9 18:02:45 2013 +0200

    Fixed formatting issues.

commit b2085b5
Author: David Eberlein <david.eberlein@ch.sauter-bc.com>
Date:   Tue Jun 25 08:49:54 2013 +0200

    REFACTORING: Romoved old extract series method which is now moved into the data handlers.

commit 7d85163
Merge: c8f5edb 464538e
Author: David Eberlein <david.eberlein@ch.sauter-bc.com>
Date:   Thu Jun 20 15:13:22 2013 +0200

    Merge branch 'official-master' into sauter-custom-datahandler

    Conflicts:
    	dygraph.js

commit c8f5edb
Author: David Eberlein <david.eberlein@ch.sauter-bc.com>
Date:   Fri Jun 14 12:20:41 2013 +0200

    FEATURE: Integreated the new creation of points into the data handlers. This proposal is now fully functional again.

commit 5c1ce9c
Author: David Eberlein <david.eberlein@ch.sauter-bc.com>
Date:   Fri Jun 14 12:19:33 2013 +0200

    Reverted file EOL back to unix

commit 2684ae5
Author: David Eberlein <david.eberlein@ch.sauter-bc.com>
Date:   Fri Jun 14 12:18:02 2013 +0200

    BUGFIX: Fixed incorrect handling of logscale case in the datahandlers extractSeries methods.

commit bcb28c1
Author: David Eberlein <david.eberlein@ch.sauter-bc.com>
Date:   Fri Jun 14 11:06:34 2013 +0200

    CLEAN: Removed old imports of sauter js files.

commit 565afa8
Merge: 40f9f50 95a9512
Author: David Eberlein <david.eberlein@ch.sauter-bc.com>
Date:   Thu Jun 13 18:07:16 2013 +0200

    Merge branch 'official-master' into sauter-custom-datahandler: This is not yet functional, Dygraphs.seriesToPoints, and DygraphsLayout.evaluteLineCharts must still be refactored.

    Conflicts:
    	dygraph-layout.js
    	dygraph.js

commit 40f9f50
Author: David Eberlein <david.eberlein@ch.sauter-bc.com>
Date:   Mon Jun 3 09:44:29 2013 +0200

    REFACTORING: Removed benchmark tests since they are now integrated into the dygraphs-perf project.

commit 1294079
Merge: c24f3f3 8cf57f1
Author: David Eberlein <david.eberlein@ch.sauter-bc.com>
Date:   Mon Jun 3 09:41:16 2013 +0200

    Merge remote-tracking branch 'official/master' into sauter-custom-datahandler

commit c24f3f3
Author: eberldav <eberldav@ch.sauter-bc.com>
Date:   Thu May 30 17:10:57 2013 +0200

    REFACTORING: Fixed lint issues and broken test as well as some code style for the pull.

commit ea03a64
Author: David Eberlein <david.eberlein@ch.sauter-bc.com>
Date:   Thu May 30 16:51:42 2013 +0200

    CLEANUP: Removed sauter specific data handlers and the not 100% finished Bugfix for the y extremes date window issue so that this can be pulled.

commit 3782b55
Author: eberldav <eberldav@ch.sauter-bc.com>
Date:   Thu May 16 13:51:09 2013 +0200

    BUGFIX: Deleted falsely added comma

commit 8037150
Author: eberldav <eberldav@ch.sauter-bc.com>
Date:   Thu May 16 13:47:58 2013 +0200

    OPTIMIZATION: Replaced DataHandler onPointCreated callback with
    onLineEvaluted passing all created points for one series instead of
    calling the other method for each created point. Also added some bug
    fixes to the yextemes method.

commit 97efdf6
Author: eberldav <eberldav@ch.sauter-bc.com>
Date:   Wed May 15 11:26:17 2013 +0200

    FEATURE: Made the onPointCreated callback optional for better
    performance

commit 0b7892c
Merge: c15adff 1bffeb9
Author: David Eberlein <david.eberlein@ch.sauter-bc.com>
Date:   Wed May 15 11:02:46 2013 +0200

    Merge branch 'sauter-custom-datahandler' of https://github.com/sauter-hq/dygraphs into sauter-custom-datahandler

commit 1bffeb9
Author: eberldav <eberldav@ch.sauter-bc.com>
Date:   Wed May 15 11:01:00 2013 +0200

    REFACTORING: Removed unneseccary fractions check in default data
    handler.

commit c15adff
Author: David Eberlein <david.eberlein@ch.sauter-bc.com>
Date:   Wed May 15 10:58:05 2013 +0200

    FEATURE: Removed copying the rolled series in the gather data method since the previous bug is fixed with the new data handler concept

commit 7c9d9f2
Author: David Eberlein <david.eberlein@ch.sauter-bc.com>
Date:   Mon May 13 14:56:22 2013 +0200

    BUGFIX: Fixed wrong call of DataHandlers

commit 88f7311
Author: David Eberlein <david.eberlein@ch.sauter-bc.com>
Date:   Mon May 13 13:48:24 2013 +0200

    Added data handler to the generate combined and jsTestDriver imports.

commit 4eb4430
Author: David Eberlein <david.eberlein@ch.sauter-bc.com>
Date:   Mon May 13 11:18:36 2013 +0200

    BUGFIX: fixed wrong value comparison for data pruning.

commit c21c7f0
Author: David Eberlein <david.eberlein@ch.sauter-bc.com>
Date:   Mon May 13 11:06:04 2013 +0200

    BUGFIX: Fixed not complete adaption of pruning.

commit f5fcd68
Author: David Eberlein <david.eberlein@ch.sauter-bc.com>
Date:   Mon May 13 10:51:32 2013 +0200

    REFACTORING: Adapted samples pruning to the unified data format.

commit 34bf898
Merge: 925e74a b839102
Author: David Eberlein <david.eberlein@ch.sauter-bc.com>
Date:   Mon May 13 10:42:55 2013 +0200

    Merge branch 'official-master' into sauter-custom-datahandler

    Conflicts:
    	auto_tests/misc/local.html

commit 925e74a
Merge: f9c4250 9f890c2
Author: David Eberlein <david.eberlein@ch.sauter-bc.com>
Date:   Fri May 3 16:07:07 2013 +0200

    Merge commit '9f890c23ad80924d0a30f3a14f8680b7c2d6318e' into sauter-custom-datahandler

commit f9c4250
Author: David Eberlein <david.eberlein@ch.sauter-bc.com>
Date:   Thu Apr 25 16:42:34 2013 +0200

    TEST: Added benchmark test allowing for different dygaphs benchmarks. They are currently deactivated because they take quite a while to run.

commit e6de164
Author: David Eberlein <david.eberlein@ch.sauter-bc.com>
Date:   Thu Apr 25 14:29:59 2013 +0200

    TEST: Adapted tests to conform to the new format and wrote new tests for the rolling options.

commit 8e8161e
Author: David Eberlein <david.eberlein@ch.sauter-bc.com>
Date:   Thu Apr 25 14:29:03 2013 +0200

    FEATURE: Adapted DataHandler proposal to implement a unified data format.

commit 5667ec0
Merge: 1049bc4 de25451
Author: David Eberlein <david.eberlein@ch.sauter-bc.com>
Date:   Thu Apr 25 09:19:40 2013 +0200

    Merge commit 'de2545148870a1bdb0957c4c42e80bdb8ce1656d' into sauter-custom-datahandler

commit 1049bc4
Merge: 531fd88 d88dec8
Author: David Eberlein <david.eberlein@ch.sauter-bc.com>
Date:   Tue Apr 23 18:17:37 2013 +0200

    Merge commit 'd88dec82afd6b902ffa56339d4afbf3277ad5ba3' into sauter-custom-datahandler

commit 531fd88
Author: David Eberlein <david.eberlein@ch.sauter-bc.com>
Date:   Fri Apr 19 16:15:59 2013 +0200

    FEATURE: removed dygraphs-layout.evaluteWithErrors and added its content to the datahandler-bars.

commit 5235abe
Author: David Eberlein <david.eberlein@ch.sauter-bc.com>
Date:   Fri Apr 19 16:06:36 2013 +0200

    REFACTORING: Reordered the datahandler methods to fit the calling order

commit e8c157b
Author: David Eberlein <david.eberlein@ch.sauter-bc.com>
Date:   Fri Apr 19 15:47:19 2013 +0200

    DOC: Added documentation and minor fixes to the datahandler

commit 58c69c1
Author: David Eberlein <david.eberlein@ch.sauter-bc.com>
Date:   Fri Apr 19 15:36:32 2013 +0200

    REFACTORING: Minor enhancments in extremes computation

commit 3ab1526
Author: David Eberlein <david.eberlein@ch.sauter-bc.com>
Date:   Fri Apr 19 13:42:31 2013 +0200

    BUGFIX: Fixed bug still using the customData option in dygraph-layout.

commit 4bea608
Author: David Eberlein <david.eberlein@ch.sauter-bc.com>
Date:   Fri Apr 19 12:24:29 2013 +0200

    BUGFIX: Removed wrong code in bars datahandler callback

commit 4421518
Author: David Eberlein <david.eberlein@ch.sauter-bc.com>
Date:   Fri Apr 19 11:43:57 2013 +0200

    TESTS: Adapted tests to fit the new dataHandler integration

commit ce7550a
Author: David Eberlein <david.eberlein@ch.sauter-bc.com>
Date:   Fri Apr 19 11:42:52 2013 +0200

    FEATURE: Integrated the dataHandler model into dygraphs.

commit e13eb4e
Author: eichsjul <julian.eichstaedt@ch.sauter-bc.com>
Date:   Thu Apr 18 15:38:36 2013 +0200

    BUGFIX: Moved extremeValues method to the correct place and added the needed arguments to the call.

commit 05afa76
Author: eichsjul <julian.eichstaedt@ch.sauter-bc.com>
Date:   Thu Apr 18 14:51:47 2013 +0200

    FEATURE: Added initial implementation of custom data support.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants