Skip to content

Feat/parallel plot#296

Merged
Tanguylo merged 79 commits intodevfrom
feat/parallel_plot
Sep 18, 2023
Merged

Feat/parallel plot#296
Tanguylo merged 79 commits intodevfrom
feat/parallel_plot

Conversation

@Tanguylo
Copy link
Copy Markdown
Collaborator

@Tanguylo Tanguylo commented Aug 2, 2023

image

@Tanguylo Tanguylo added this to the v0.17.0 milestone Aug 2, 2023
@Tanguylo Tanguylo linked an issue Aug 2, 2023 that may be closed by this pull request
@Tanguylo
Copy link
Copy Markdown
Collaborator Author

Not yet ready

Comment thread src/subplots.ts Outdated
Comment thread src/subplots.ts Outdated

get falseIndicesArray(): boolean[] { return new Array(this.nSamples).fill(false) }

get offset_factor(): Vertex { return this._offset_factor ?? new Vertex(0.035, 0.07) }
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Are these getters and setters necessary ?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yes they are since default values are not the same in parent and children

Copy link
Copy Markdown
Collaborator

@GhislainJ GhislainJ Sep 15, 2023

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I am also questioning about that.

But what is clear is that you cannot expect this to work as expected:

class Parent {
    attribute: type = X;
    constructor() {
       this.function(attribute)
    }
}

class Children extends Parent {
    attribute: type = Y;
    constructor() {
       super()
    }
}

Here, the used value of attribute in children when running the constructor (which is what you want to do) will be X and not Y; because at this moment in the run of constructor, you are still in Parent class, although you are creating a Children instance.

To avoid this behavior, the Internet gives us the above trick.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Collaborator

@GhislainJ GhislainJ Sep 18, 2023

Choose a reason for hiding this comment

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

Ok, I think this case made me understand what is the difference between inside/outside attribute assignment in js, which was not clear at all to me before.

They are actually not equivalent, after all. I think on the other side, that they are a bit similar to python's class attribute vs attribute, even if they are not the same.

Considering this thread, class fields (outside the constructor), are called after the constructor which leads to the shown behavior.

Actually, the prop attribute in our test case, is not static nor a class field, its a plain "instance attribute". In this case, I think we should then use the constructor syntax, even if its a bit more cumbersome (still less cumbersome than getters/setters, which usage is unclear) :

https://www.typescriptlang.org/play?#code/MYGwhgzhAECC0G8BQ1XQA4FcBGICWw0A5kQFzRgB2AngNwprAD2lEALgE6bBtMcAUDNGiy4CGDk3Tl2HPJSLQAvNABEYVUOgBKRFuFsAFnggA6dJPTKJU+sIPGzvXv21aAvltH5Czpq717NCMTUxJrELMLWw8kTyRQSBgAIWgAUwAPNjTKABMYeGRhZlZObl4BfREcHxtpaFl5RRVVbE1hXSKghsx0NIFo9DdhT3iS9gprSjSAdzhXenG2aGwp2ehkhaQElggmEDTTECYiflV4clUAGgowohvVZOuVu7cgA

Comment thread src/subplots.ts
Comment thread src/subplots.ts Outdated
Comment thread src/subplots.ts
Comment thread src/utils.ts Outdated
Comment thread src/utils.ts Outdated
Comment thread src/utils.ts
Comment thread src/utils.ts Outdated
Comment thread src/utils.ts Outdated
@Tanguylo Tanguylo requested a review from GhislainJ September 14, 2023 15:06
@Tanguylo Tanguylo merged commit 25463cb into dev Sep 18, 2023
@Tanguylo Tanguylo deleted the feat/parallel_plot branch September 18, 2023 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Parallel plot selection The values ​​on the axes are not good zoom on parallel coordinates plot

2 participants