-
Notifications
You must be signed in to change notification settings - Fork 0
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
Tanguylo
wants to merge
35
commits into
dev
Choose a base branch
from
feat/piechart
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Feat/piechart #168
Changes from 28 commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
e2280d1
Ajout class Pie
Tanguylo d83ec07
Start with piechart
Tanguylo d5b2e4b
feat(piechart): first piechart drawing
Tanguylo b4514ea
feat(piechart): add colors to piechart
Tanguylo e21e984
feat(piechart):add pie part surface coloring on mouse over
Tanguylo 949df9c
feat(piechart):partial code cleaning
Tanguylo 8427fef
feat(piechart):fix a git mistake with branches
Tanguylo e21259e
feat(piechart):fixing last diff in core.py
Tanguylo ad59106
feat(piechart):remove ' /' line 931
Tanguylo 6c494e2
feat(piechart):add parts selection on click
Tanguylo 9c83b56
feat(piechart):manage piepart paths as piepart attribute
Tanguylo 38ebcb3
feat(piechart):initialize pieparts path when instantiating when crea…
Tanguylo 1937904
feat(piechart):some code cleaning
Tanguylo 4675ede
feat(piechart): fix mistakes following the first 6 comments on this p…
Tanguylo cd1864f
feat(piechart): fix the 5 following remarks of the PR
Tanguylo 1f81acc
feat(piechart): fix the remaining remarks except the drawPieChart method
Tanguylo e3371ec
feat(piechart): take last PR remarks into account
Tanguylo 84fe419
feat(piechart): change type of color_to_plot_data to map
Tanguylo 8bf219a
feat(piechart): modifications following PR remarks
Tanguylo 006de63
feat(piechart): Changes following the PR review
Tanguylo 3cea6f1
feat(piechart): Put color:string='' in the constructor of PieParts fo…
Tanguylo 174b386
feat(piechart_in_multiplot): Handle selection of piePart as expected
Tanguylo 0413f2f
feat(piechart): add commit to branch and reset latest_selected_points…
Tanguylo 87d5ef6
feat(piechart): Undo color_to_plot_data as a Map
Tanguylo 10772ba
feat(piechart): Changes following second PR
Tanguylo 34cdd69
feat(piechart): DataSample and DataSamples type definition and some c…
Tanguylo 7a5f0e6
feat(piechart): Changes in drawPieChart
Tanguylo 54091b1
feat(piechart): Change multiple_plot.py file
Tanguylo 0ecc993
feat(piechart): Call definePieParts in PieChart constructor and not a…
Tanguylo 5c7c296
feat(piechart): Write PR equivalent in CHANGELOG.md file
Tanguylo b4bc6e2
Merge branch 'dev' into feat/piechart
Tanguylo ce09723
merge since 6 months, possible fails
Tanguylo 9896338
Merge branch 'dev' into feat/piechart
Tanguylo 2187adf
feat(piechart): add tests
Tanguylo f8f4b8a
feat(piechart): pylint
Tanguylo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -225,3 +225,35 @@ | |
</body> | ||
</html> | ||
''') | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 ? |
||
|
||
piechart_template = Template(''' | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<script src=$core_path></script> | ||
</head> | ||
<div id="app"> | ||
<canvas id="$canvas_id" width="2000" height="490" | ||
style="border: 1px solid black;"> | ||
</canvas> | ||
|
||
<!-- Sets the basepath for the library if not in same directory --> | ||
|
||
<script> | ||
var width = 0.95*window.innerWidth; | ||
var height = Math.max(0.95*window.innerHeight, 350); | ||
|
||
var data = $data; | ||
var number_plot_data = data.length; | ||
|
||
var plot_data = new PlotData.PlotPieChart( | ||
data, width, height, true, 0, 0, $canvas_id.id | ||
); | ||
plot_data.define_canvas($canvas_id.id); | ||
plot_data.draw_initial(); | ||
plot_data.mouse_interaction(false); | ||
</script> | ||
</div> | ||
</html> | ||
''') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/usr/bin/env python3 | ||
# -*- coding: utf-8 -*- | ||
""" | ||
Created on Fri Jun 3 16:18:31 2022 | ||
|
||
@author: tanguy | ||
""" | ||
|
||
import plot_data | ||
import plot_data.colors as colors | ||
import random | ||
|
||
|
||
data_samples = [] | ||
SHAPES = ['round', 'square', 'triangle', 'ellipse'] | ||
COLORS = [colors.RED, colors.BLUE, colors.GREEN, colors.YELLOW, colors.ORANGE, colors.VIOLET] | ||
for i in range(50): | ||
random_shape = SHAPES[random.randint(0, len(SHAPES) - 1)] | ||
random_color = COLORS[random.randint(0, len(SHAPES) - 1)] | ||
data_samples.append({'mass': random.uniform(0, 50), | ||
'length': random.uniform(0, 100), | ||
'shape': random_shape, | ||
'color': random_color | ||
}) | ||
|
||
|
||
piechart1 = plot_data.PieChart(data_samples=data_samples, | ||
slicing_variable='mass') | ||
|
||
piechart2 = plot_data.PieChart(data_samples=data_samples, | ||
slicing_variable='length') | ||
|
||
|
||
plot_data.plot_canvas(plot_data_object=piechart1, debug_mode=True) | ||
plot_data.plot_canvas(plot_data_object=piechart2, debug_mode=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import {PlotData, Interactions} from './plot-data'; | ||
import {Point2D} from './primitives'; | ||
import { Attribute, PointFamily, check_package_version, Window, TypeOf, equals, Sort, download } from './utils'; | ||
import { PlotContour, PlotScatter, ParallelPlot, PrimitiveGroupContainer, Histogram } from './subplots'; | ||
import { PlotContour, PlotScatter, ParallelPlot, PrimitiveGroupContainer, Histogram, PlotPieChart } from './subplots'; | ||
import { List, Shape, MyObject } from './toolbox'; | ||
import { string_to_hex, string_to_rgb, rgb_to_string } from './color_conversion'; | ||
|
||
|
@@ -83,7 +83,7 @@ export class MultiplePlots { | |
} else if (object_type_ === 'parallelplot') { | ||
this.dataObjects[i]['elements'] = elements; | ||
newObject = new ParallelPlot(this.dataObjects[i], this.sizes[i]['width'], this.sizes[i]['height'], buttons_ON, this.initial_coords[i][0], this.initial_coords[i][1], canvas_id, true); | ||
} else if (object_type_ === 'primitivegroup') { | ||
} else if (object_type_ === 'primitivegroup') { | ||
newObject = new PlotContour(this.dataObjects[i], this.sizes[i]['width'], this.sizes[i]['height'], buttons_ON, this.initial_coords[i][0], this.initial_coords[i][1], canvas_id, true); | ||
} else if (object_type_ === 'primitivegroupcontainer') { | ||
newObject = new PrimitiveGroupContainer(this.dataObjects[i], this.sizes[i]['width'], this.sizes[i]['height'], buttons_ON, this.initial_coords[i][0], this.initial_coords[i][1], canvas_id, true); | ||
|
@@ -101,6 +101,7 @@ export class MultiplePlots { | |
} | ||
this.initializeObjectContext(newObject); | ||
this.objectList.push(newObject); | ||
console.log(newObject) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Intempestive log ? |
||
} | ||
if (elements) {this.initialize_point_families();} | ||
|
||
|
@@ -109,6 +110,7 @@ export class MultiplePlots { | |
this.display_order.push(i); | ||
this.to_display_plots.push(i); | ||
} | ||
|
||
this.mouse_interaction(); | ||
|
||
if (buttons_ON) { | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
if data_samples is None:
would be the right check