-
Notifications
You must be signed in to change notification settings - Fork 221
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
Enable 'object constancy' on data refresh by supporting a key function in Dataset #2833
Conversation
Can you please compile using |
@bluong I have loaded the plottable.js and plottable.d.ts that I get running |
So there is some functionality in our |
Yes I've had a look at that - it's the sed:privateDeclarations task. I've played with it a bit but haven't yet managed to find a way to get the same result in Windows - becuase those regex expressions are looking for \n line-ends I think. Private members are emitted in a declaration file to indicate that a private property with that name exists so that a derived class doesn't accidentally use the name (which would step on the private members). It certainly looks nicer for the .d.ts file not to have them, and chances of accidently reusing the private variable would seem slim; but by including those private names in the .d.ts you'll get a compile error if you try to override. |
A lot of things I don't fully understand are happening with the testing stage: as you can see in the travis output phamtomjs is throwing an error. Sometimes I get this locally, but when it runs to completion, I get a number of tasks pending. These tasks are also pending if I run coverage.html in chrome - they all relate to testings for type, or non-numeric values. e.g. currency() - throws exception for non-numeric values.
Again, see the same thing in chrome and phantomjs, although sometimes the fail in phantomjs also reports out of memory:
chrome reports the error a bit differently:
So any guidance you can offer as to what could be going on here would be much appreciated. |
One thing that could be happening is inaccuracies due to being on a different OS / different version of a certain browser. In terms of the Can you |
Looking at these precision errors, running in both Chrome and IE, I have found something interesting: in this code in TestMethods:
The members of the object One circumstance where the members of IE10 apparently returns fractional values like this:
by design: see here Not sure why phantomjs is returning these non-integer values though, or why the test run under travis fails. |
Clean test now, but I have made the byIndex function the default key instead of noConstancy. noConstancy solves the issues around AnimateOnNextRender, but in other tests e.g. metaDataTests=>Dataset is passed in are expecting constancy by index to work... so there is a bit of contradiction. Needs more discussion before pulling I think. |
A huge step forward as the pull request is now a lot more reviewable 😃 I can review it on my end now. In the meantime, can you look to resolve the "plottable.d.ts" issues. Also, if you haven't already, can you submit a signed version of the CLA in the repo? Thanks! |
This reverts commit e0f25c6.
# Conflicts: # plottable.d.ts
Hmm, if you merged in the other pull request into this one, it still seems that there is a huge diff in "plottable.d.ts" |
Yes, I know. But, when I look at the raw files of plottable.d.ts in this PR and in the develop branch, I can't see any difference at all to the naked eye, so it's very puzzling. No other diff tool (ie in Visual Studio or notepad++) sees them as different either. Could it be that, because the earlier commit 'Compiled Outputs', effectively threw the whole file away and wrote it again, that all diffs on subsequent commits accumulate that change? In other words, does git diff compare the 2 files absolutely ( regardless of their history) or does it somehow compute the diff by accumulating the changes in all the commits between them? I'll continue to research this. |
fyi for anybody interested, I'm finding that the git support in VS2015 is too simplistic really for a project of this complexity, I'm running Atlassian sourceTree in parallel to VS, changes made in SourceTree do get immediately reflected in VS. |
I believe that |
We do indeed take the |
# Conflicts: # plottable.d.ts
@@ -4,9 +4,23 @@ module Plottable { | |||
|
|||
export type DatasetCallback = (dataset: Dataset) => void; | |||
|
|||
export class KeyFunctions { | |||
protected static counter: number = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why protected
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, I'll change to private.
@softwords Yep, I think I see what you are saying. I am mainly suggesting that you make a JSFiddle so that I, other viewers, and our QE can have a proof-of-concept of this specific pull request change. In interacting with your Scatter Plot example, it seems that this can work with some tweaking (Given the src attribute, it is hard to tell that the input "plottable.js" actually comes from pull request. We generally use rawgit.com for these situations.) |
In terms of the overall pull request, most of my comments are essentially very small changes / cleaning up. My only concern revolves around the Scatter Plot change. Do we want to now make this change across the rest of the plots? Or do we just have it on Scatter Plot? |
Here's two variations on the previous fiddle: |
http://jsfiddle.net/oaskqta0/8/ |
# Conflicts: # plottable.d.ts
Do you plan on having the |
I'll be guided by you as to how much / how little of this you want to introduce in this PR or delay to subsequent PR. This change is fundamental ( see the 3 steps I described earlier) , but of itself, doesn't add a lot of functionality. From your perspective, I can appreciate that you may want a better idea of where all this is heading before committing anything. |
by the way, thanks for all your patience and assistance, it's much appreciated |
In talking with QE, I think a solution that came up with was essentially to create a side branch that branches off of develop, and then you can make pull requests to that side branch. We'll then iterate on each of those pull requests and then once we feel that the side branch is ready to go, we hopefully simply merge that in. How does that sound to you? In this regard, yes let's remove the Scatter Plot functionality and stick with only the KeyFunction idea. Place that functionality in a separate pull request only dealing with the Scatter Plot change. To my understanding I don't think non-contributors can create branches on our end, I will create a branch at dataConstancy . If this makes sense, can you make a new pull request that targets that branch instead? If so, make have this pull request reference that pull request and vice versa. |
I definitely want to shout my thanks back to you for sticking with our development cycle. Your contribution definitely looks really promising and I would like to find a way to include it into Plottable in the most effective manner. |
that's sound like a good plan - can I suggest you call it objectConstancy, in keeping with Mike Bostock's terminology? I'll wait to hear back on that. |
I'll change the branch to objectConstancy. In regards to the compile sequence, you can try testing your pull request by rebasing on my pull request, possibly. We are expecting that to merge by hopefully early next week. |
Branch created, feel free to make a pull request to that branch |
Just in case, Github does not allow the changing of the target branch on a pull request. Instead, you will need to create a new pull request with the same source branch and change the target branch to "objectConstancy". |
Closing this pull request since it seems we have a reference to the new pull request. |
Resubmitting with cleanups to formatting - previously #2801
also see issue #2512
This pull request
adds the key function to Dataset
uses this key in Drawer when binding data to the selection
provides 2 predefined keys:
-- NoConstancy - which will return a new value each time it is called, therefire ensuring that there is never object constancy; that is, all elements in the selection are removed and recreated
-- ByIndex - returns the index of the datum n the array, which is the default behaviour of d3 anyway
Also removes the logic on AnimateOnNextRender in ScatterPlot. This logic simulates the destruction and recreation of each svg element to create an animation effect. But, if the NoConstancy key is used, d3 destroys and recreates the svg elements itself, so there is no need for this workaround.
This also resolves issue #2707.