Skip to content

Commit

Permalink
Merge pull request #365 from Dessia-tech/dev
Browse files Browse the repository at this point in the history
v0.24.0
  • Loading branch information
Tanguylo authored Mar 28, 2024
2 parents f10c6d9 + 17a95d9 commit 5dd2b86
Show file tree
Hide file tree
Showing 41 changed files with 898 additions and 406 deletions.
24 changes: 23 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,15 @@ All notable changes to this project will be documented in this file.
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).

## [0.23.0]
## [0.24.0]
### Add
- Allow to directly specify if axes are on or off in Python

### Fix
- LineSegment2D : If it is overloaded, MPL Plot now show the right edge_style instead of generating of random one
- Arc2D: mpl_plot

## [0.23.0]
### Feat
- Add events (Subject) to emit shape hovering and clicking
- Highlight shapes when corresponding function is called from wrapper software
Expand All @@ -16,6 +23,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Refactor
- Implements InteractiveObject for handling all mouse objects in one class
## [0.22.5]
### Fix
- Fix global bug on RemoteFigure.resize methods, fixing a browser crasher bug

## [0.22.4]
### Fix
- Fix bug on tooltip origin when mouse leaving while hovering a shape
- Remove unused code
- Fix html for prettier to work
- Remove name from add plot feature

## [0.22.2]
### Fix
- Local import
- Add tooltip on any shape with Python with Shape object

## [0.22.0]
### Add
Expand Down
2 changes: 1 addition & 1 deletion code_pylint.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
'trailing-whitespace': 11,
'empty-docstring': 7,
'missing-module-docstring': 4,
'too-many-arguments': 20,
'too-many-arguments': 24,
'too-few-public-methods': 5,
'unnecessary-comprehension': 5,
'no-value-for-parameter': 2,
Expand Down
15 changes: 10 additions & 5 deletions cypress/e2e/figures.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ describe("Figure", function() {
{ "name": "", "cx": 3, "cy": 3, "type_": "point" },
{ "name": "", "cx": 8, "cy": 3, "type_": "point" },
{ "name": "", "data": [66, 11.5, 73, 11.5], "point1": [66, 11.5], "point2": [73, 11.5], "type_": "linesegment2d" }
]
],
"axis_on": true
};

it('should create a new instance of Figure from multiplot data with valid arguments', function() {
Expand Down Expand Up @@ -209,7 +210,8 @@ describe("Histogram", function() {
{ "name": "", "values": { "x": 3, "y": 2 }, "x": 3, "y": 2 },
{ "name": "", "values": { "x": 4, "y": 3 }, "x": 4, "y": 3 }
],
"type_": "histogram"
"type_": "histogram",
"axis_on": true
};
const histogram = new Histogram(data, canvas.width, canvas.height, 0, 0, canvasID, false);
histogram.setCanvas(canvas.id);
Expand Down Expand Up @@ -270,7 +272,8 @@ describe("Scatter", function() {
{ "name": "", "values": { "x": 3, "y": 2 }, "x": 3, "y": 2 },
{ "name": "", "values": { "x": 4, "y": 3 }, "x": 4, "y": 3 }
],
"type_": "scatterplot"
"type_": "scatterplot",
"axis_on": true
}
const scatter = new Scatter(data, canvas.width, canvas.height, 0, 0, canvasID, false);
const frameMatrix = new DOMMatrix([
Expand Down Expand Up @@ -334,7 +337,8 @@ describe("Graph2D", function() {
]
},
],
"type_": "graph2d"
"type_": "graph2d",
"axis_on": true
}
const graph = new Graph2D(data, canvas.width, canvas.height, 0, 0, canvasID, false);

Expand Down Expand Up @@ -366,7 +370,8 @@ describe("ParallelPlot", function() {
{ "name": "", "values": { "x": 3, "y": 2, "z": 2 }, "x": 3, "y": 2, "z": 2 },
{ "name": "", "values": { "x": 4, "y": 3, "z": 5 }, "x": 4, "y": 3, "z": 5 }
],
"type_": "parallelplot"
"type_": "parallelplot",
"axis_on": true
}
const parallelplot = new ParallelPlot(data, canvas.width, canvas.height, 0, 0, canvasID, false);
parallelplot.setCanvas(canvas.id);
Expand Down
10 changes: 10 additions & 0 deletions cypress/e2e/remoteFigure.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,16 @@ describe("RemoteFigure.resizeUpdate", function() {
});
});

describe("RemoteFigure.resizeWindow", function() {
it("should resize figure with new window size", function() {
const figure = new RemoteFigure(data, canvas.width, canvas.height, 100, 100, canvas.id);
figure.setCanvas(canvas.id);
figure.resizeWindow(700, 500);
expect(figure.size.x, "size.x").to.be.equal(700);
expect(figure.size.y, "size.y").to.be.equal(500);
});
});

describe("RemoteFigure.reset", function() {
it("should reset scales and selectors", function() {
const figure = new RemoteFigure(data, canvas.width, canvas.height, 100, 100, canvas.id);
Expand Down
6 changes: 3 additions & 3 deletions cypress/e2e/visualRegressions.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const FIGURES_DATA = [
{ name: "parallelplot", data: parallelPlotData, threshold: 0.05 },
{ name: "plotscatter", data: plotScatterData, threshold: 0.05 },
{ name: "primitivegroupcontainer", data: primitiveGroupContainerData, threshold: 0.05 },
{ name: "scattermatrix", data: scattermatrixData, threshold: 0.07 },
{ name: "scattermatrix", data: scattermatrixData, threshold: 0.08 },
{ name: "simpleshapes", data: simpleshapesData, threshold: 0.05 },
{ name: "textscaling", data: textscalingData, threshold: 0.05 },
{ name: "multiplot", data: multiplotData, threshold: 0.05 }
Expand Down Expand Up @@ -77,11 +77,11 @@ FIGURES_DATA.forEach(figureData => {
it("should hover line even if mouse is not exactly on line", function () {
cy.window().then((win) => {
const draw = win.eval('plot_data');
let [canvasMouse, frameMouse, mouseCoords] = draw.projectMouse({"offsetX": 814, "offsetY": 196} as MouseEvent);
let [canvasMouse, frameMouse, mouseCoords] = draw.projectMouse({"offsetX": 809, "offsetY": 196} as MouseEvent);
draw.castMouseMove(canvasMouse, frameMouse, mouseCoords);
expect(draw.relativeObjects.shapes[23].isHovered).to.be.true;

[canvasMouse, frameMouse, mouseCoords] = draw.projectMouse({"offsetX": 822, "offsetY": 196} as MouseEvent);
[canvasMouse, frameMouse, mouseCoords] = draw.projectMouse({"offsetX": 816, "offsetY": 196} as MouseEvent);
draw.castMouseMove(canvasMouse, frameMouse, mouseCoords);
expect(draw.relativeObjects.shapes[23].isHovered).to.be.true;
});
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
102 changes: 71 additions & 31 deletions cypress/templates/emptyMultiplot.template.html
Original file line number Diff line number Diff line change
@@ -1,43 +1,83 @@
<!DOCTYPE html>
<html lang="en">
<style>
.slider {
-webkit-appearance: none;
height: 10px;
background: #d3d3d3;
outline: none;
opacity: 0.7;
-webkit-transition: .2s;
transition: opacity .2s;
}

.slider:hover {
opacity: 1;
}

.slider::-moz-range-thumb {
width: 25px;
height: 10px;
background: #04AA6D;
cursor: pointer;
}
.slider {
-webkit-appearance: none;
height: 10px;
background: #d3d3d3;
outline: none;
opacity: 0.7;
-webkit-transition: .2s;
transition: opacity .2s;
}

.slider:hover {
opacity: 1;
}

.slider::-moz-range-thumb {
width: 25px;
height: 10px;
background: #04AA6D;
cursor: pointer;
}

#buttons {
display: flex;
column-gap: 3rem;
row-gap: 0.5em;
flex-wrap: wrap;
margin-bottom: 0.5rem;
margin-top: 1rem;
margin: 0 auto;
}

#sub_button {
display: flex;
gap: 0.5rem;
flex-wrap: wrap;
}
</style>
<head>
<script src=$core_path></script>
</head>
<div id="buttons">
<button name="mergeON" value="OK" type="button" onclick="plot_data.switchMerge()"> Switch Point Merge </button> &nbsp;&nbsp;
<button name="Zoom" value="OK" type="button" onclick="plot_data.switchZoom()"> Zoom Box </button>
<button name="Zoom+" value="OK" type="button" onclick="plot_data.zoomIn()"> Zoom+ </button>
<button name="Zoom-" value="OK" type="button" onclick="plot_data.zoomOut()"> Zoom- </button> &nbsp;&nbsp;
Cluster:&nbsp; <input type="range" class="slider" min="0" max="2500" value="1250" onclick="plot_data.simpleCluster(value / 10000)"></input>
<button name="resetClusters" value="OK" type="button" onclick="plot_data.resetClusters()"> Reset clusters </button> &nbsp;&nbsp;
<button name="resetView" value="OK" type="button" onclick="plot_data.resetView()"> Reset view </button>
<button name="showPoints" value="OK" type="button" onclick="plot_data.togglePoints()"> Show points </button>
<button name="switchOrientation" value="OK" type="button" onclick="plot_data.switchOrientation()"> Change Disposition </button>
<button name="toogleAxes" value="OK" type="button" onclick="plot_data.htmlToggleAxes()"> Show / Hide Axes </button>
<hr style="border-top: 2px;">
<div id="sub_button">
<button name="mergeON" value="OK" type="button"
onclick="plot_data.switchMerge()"> Switch Point Merge </button>
</div>
<div id="sub_button">
<button name="Zoom" value="OK" type="button"
onclick="plot_data.switchZoom()"> Zoom Box </button>
<button name="Zoom+" value="OK" type="button" onclick="plot_data.zoomIn()"> Zoom+ </button>
<button name="Zoom-" value="OK" type="button" onclick="plot_data.zoomOut()"> Zoom- </button>
</div>
<div id="sub_button">
Cluster: <input type="range" class="slider" min="0" max="2500" value="1250"
onclick="plot_data.simpleCluster(value / 10000)"/>
<button name="resetClusters" value="OK" type="button"
onclick="plot_data.resetClusters()"> Reset clusters </button>
</div>
<div id="sub_button">
<button name="resetView" value="OK" type="button"
onclick="plot_data.resetView()"> Reset view </button>
<button name="showPoints" value="OK" type="button"
onclick="plot_data.togglePoints()"> Show points </button>
<button name="switchOrientation" value="OK" type="button"
onclick="plot_data.switchOrientation()"> Change Disposition </button>
<button name="toogleAxes" value="OK" type="button"
onclick="plot_data.htmlToggleAxes()"> Show / Hide Axes </button>
<button name="logScale" value="OK" type="button"
onclick="plot_data.switchLogScale()"> Log Scale</button>
</div>

<div id="sub_button">
<button name="resize" value="OK" type="button" onclick="plot_data.switchResize()"> Resize Figures </button>
<button name="resizeMP" value="OK" type="button"
onclick="plot_data.resize(...PlotData.computeCanvasSize('#buttons'))"> Resize Multiplot </button>
</div>
</div>
<hr style="border-top: 2px;"/>
<div id="app">
<canvas id="$canvas_id" width="$width" height="$height" style="border: 1px solid black;"></canvas>

Expand Down
Loading

0 comments on commit 5dd2b86

Please sign in to comment.