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

Feat/piechart #168

Open
wants to merge 35 commits into
base: dev
Choose a base branch
from
Open

Feat/piechart #168

wants to merge 35 commits into from

Conversation

Tanguylo
Copy link
Collaborator

Start with a piechart with mouse over managing

@Tanguylo Tanguylo marked this pull request as draft June 13, 2022 09:12
@Tanguylo Tanguylo marked this pull request as ready for review June 17, 2022 07:54
@Tanguylo Tanguylo requested review from xavier-ferry, Jeremie-Ch and GhislainJ and removed request for Jeremie-Ch June 17, 2022 07:55
plot_data/core.py Outdated Show resolved Hide resolved
plot_data/templates.py Outdated Show resolved Hide resolved
plot_data/templates.py Outdated Show resolved Hide resolved
script/pie_chart.py Outdated Show resolved Hide resolved
src/primitives.ts Outdated Show resolved Hide resolved
src/subplots.ts Outdated Show resolved Hide resolved
src/subplots.ts Outdated Show resolved Hide resolved
src/subplots.ts Outdated Show resolved Hide resolved
src/subplots.ts Outdated Show resolved Hide resolved
src/plot-data.ts Outdated Show resolved Hide resolved
plot_data/core.py Outdated Show resolved Hide resolved
plot_data/core.py Outdated Show resolved Hide resolved
src/primitives.ts Outdated Show resolved Hide resolved
to_display_attributes: Attribute[]=[];

constructor(public tooltip:Tooltip,

Choose a reason for hiding this comment

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

Can remove tooltip
Can type_ be removed from the constructor ?

src/primitives.ts Outdated Show resolved Hide resolved
src/primitives.ts Outdated Show resolved Hide resolved
src/primitives.ts Outdated Show resolved Hide resolved
src/primitives.ts Outdated Show resolved Hide resolved
src/primitives.ts Outdated Show resolved Hide resolved
src/plot-data.ts Outdated Show resolved Hide resolved
src/plot-data.ts Outdated Show resolved Hide resolved
src/plot-data.ts Outdated Show resolved Hide resolved
src/plot-data.ts Outdated Show resolved Hide resolved
src/primitives.ts Outdated Show resolved Hide resolved
@Tanguylo Tanguylo linked an issue Jun 23, 2022 that may be closed by this pull request
1 task
src/primitives.ts Outdated Show resolved Hide resolved
src/primitives.ts Outdated Show resolved Hide resolved
src/primitives.ts Outdated Show resolved Hide resolved
src/primitives.ts Outdated Show resolved Hide resolved
src/primitives.ts Outdated Show resolved Hide resolved
src/primitives.ts Show resolved Hide resolved
src/subplots.ts Show resolved Hide resolved
src/primitives.ts Outdated Show resolved Hide resolved
src/subplots.ts Outdated Show resolved Hide resolved
src/subplots.ts Outdated Show resolved Hide resolved
…nymore PlotPieChart's one and change radius to have a standard PieChart instantiated in plots with a .transform(matrix)
clicked: boolean = false;
selected: boolean = false;
points_inside: PiePart[] = [this];

Choose a reason for hiding this comment

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

It is really strange to have this kind of things.
This is a first way to handle the mouse. A better implementation, via a MouseHandler is the purpose of a future dev (#172).

I suggest that we keep the code in commit (174b386) as a first implementation

Copy link

@xavier-ferry xavier-ferry left a comment

Choose a reason for hiding this comment

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

As said in comments, some wip related to mouse handling is already implemented here but it does not prevent me from approving this PR

Copy link
Collaborator

@GhislainJ GhislainJ left a comment

Choose a reason for hiding this comment

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

I didn't perform the review for most of the subplot.ts file as the diff was horrendous and changes were mostly convention stuff

@@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased => [0.7.2]
### Add
- Add Piechart drawing
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should update changelog to set it in the right version (ie. current)

name: str = ''):

self.slicing_variable = slicing_variable
if not data_samples:
Copy link
Collaborator

Choose a reason for hiding this comment

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

if data_samples is None: would be the right check

@@ -225,3 +225,35 @@
</body>
</html>
''')

Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this template any different than the cypress' one ? Can't they be mutualized ? Should they ?

@@ -101,6 +101,7 @@ export class MultiplePlots {
}
this.initializeObjectContext(newObject);
this.objectList.push(newObject);
console.log(newObject)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Intempestive log ?

@@ -2,6 +2,7 @@ import { string_to_rgb, rgb_to_string, string_to_hex, rgb_to_hex } from "./color
import { EdgeStyle, SurfaceStyle, PointStyle, TextStyle } from "./style";
import { set_default_values, genColor, drawLines, getCurvePoints, Tooltip, Axis, PointFamily, Attribute, TypeOf } from "./utils";
import { Shape, List, MyObject } from "./toolbox";
import { ContextExclusionPlugin } from "webpack";
Copy link
Collaborator

Choose a reason for hiding this comment

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

Unused import ? Most probably due to VS Code auto import feature

@@ -1,3 +1,4 @@
import { ListenOptions } from "net";
Copy link
Collaborator

Choose a reason for hiding this comment

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

Auto vs code import ?

this.latest_selected_points_index = [];
for (let i=0; i<this.latest_selected_points.length; i++) {
if (this.plotObject instanceof PieChart) {
elements_list = this.plotObject.pieParts;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Future : To keep in mind while refactoring : In order to avoid these kind of if statements everywhere, as any "plotObject" should inherit from a base class, we should define a getter (js equivalent of a python property), that would enable high customizability when we call the getter as well as guarantee simplicity and genericity.

For ex, here, the base class would define the getter as return this.point_list where PieChar would overwrite this behavior to call and yield its own "way" of representing itself, ie. return this.pieParts

And the code would only call for the getter

this.plotObject.graphs[i].point_list[j].selected = false;
this.plotObject.graphs[i].point_list[j].clicked = false;
}
}
}
} else if (this.plotObject instanceof PieChart) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Exact same comment as the previous one here, but with a function.

Globally speaking, wherever there are a lot of "if/else if/else" statements, there is almost everytime a better way to do it by using Oriented Object stuff.

See dc's schema refactor for an example

}
plot_datas: any;
selected: boolean = true;
public constructor(public data: any,
Copy link
Collaborator

Choose a reason for hiding this comment

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

[Wait for refactor] Be aware of JS Indentation Conventions here

@GhislainJ
Copy link
Collaborator

I let some comments even if I approve the PR in order to avoid blocking stuff

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.

Piechart drawing
3 participants