Skip to content
Snippets Groups Projects
Commit 4c748099 authored by Hugo Debuyser's avatar Hugo Debuyser Committed by Matias Mennecart
Browse files

Changement au niveau de la logique des couleurs et ajout de messages d'indications

parent b32395fb
No related branches found
No related tags found
No related merge requests found
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.*?>
<?import javafx.scene.*?>
<?import javafx.scene.chart.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.image.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.text.*?>
<?import javafx.stage.*?>
<?import javafx.scene.image.ImageView?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.image.Image?>
<Stage fx:id="stage" xmlns="http://javafx.com/javafx/17.0.12" xmlns:fx="http://javafx.com/fxml/1" fx:controller="fr.univlille.sae.classification.controller.MainStageController">
<scene>
<Scene>
......@@ -16,27 +16,39 @@
<children>
<VBox prefHeight="488.0" prefWidth="691.0">
<children>
<HBox prefHeight="356.0" prefWidth="691.0">
<HBox alignment="TOP_CENTER" prefHeight="356.0" prefWidth="691.0" spacing="5.0">
<children>
<Region prefHeight="338.0" prefWidth="65.0" />
<ScatterChart fx:id="scatterChart" prefHeight="342.0" prefWidth="609.0">
<xAxis>
<NumberAxis fx:id="absAxe" prefHeight="21.0" prefWidth="498.0" side="BOTTOM" />
</xAxis>
<yAxis>
<NumberAxis fx:id="ordAxe" side="LEFT" />
</yAxis>
</ScatterChart>
<Button fx:id="settingsView" onAction="#openAxesSetting" mnemonicParsing="false">
<AnchorPane prefHeight="200.0" prefWidth="200.0">
<children>
<Region prefHeight="338.0" prefWidth="65.0" />
<ScatterChart fx:id="scatterChart" prefHeight="342.0" prefWidth="609.0">
<xAxis>
<NumberAxis fx:id="absAxe" prefHeight="21.0" prefWidth="498.0" side="BOTTOM" />
</xAxis>
<yAxis>
<NumberAxis fx:id="ordAxe" side="LEFT" />
</yAxis>
</ScatterChart>
<Label fx:id="AxesSelected" alignment="CENTER" layoutX="175.0" layoutY="152.0" prefHeight="38.0" prefWidth="259.0">
<font>
<Font size="21.0" />
</font></Label>
</children>
<HBox.margin>
<Insets left="10.0" />
</HBox.margin>
</AnchorPane>
<Button fx:id="settingsView" mnemonicParsing="false" onAction="#openAxesSetting">
<graphic>
<ImageView fitHeight="100.0" fitWidth="30.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@gear.png" />
</image></ImageView>
</image>
</ImageView>
</graphic>
<HBox.margin>
<Insets right="10.0" top="30.0" />
</HBox.margin>
<HBox.margin>
<Insets top="40.0" />
</HBox.margin>
</Button>
</children>
</HBox>
......
......@@ -9,6 +9,7 @@ import javafx.fxml.FXML;
import javafx.scene.chart.*;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.stage.*;
......@@ -42,6 +43,9 @@ public class MainStageController {
@FXML
ScatterChart scatterChart;
@FXML
Label AxesSelected;
Stage loadStage;
private MainStageView mainStageView;
......@@ -80,4 +84,8 @@ public class MainStageController {
public ScatterChart getScatterChart() {
return this.scatterChart;
}
public void setAxesSelected(String texte) {
this.AxesSelected.setText(texte);
}
}
......@@ -3,6 +3,8 @@ package fr.univlille.sae.classification.model;
import com.opencsv.bean.*;
import javafx.scene.paint.Color;
import java.util.Random;
public class Iris extends LoadableData{
@CsvBindByName(column = "sepal.width")
......@@ -54,9 +56,6 @@ public class Iris extends LoadableData{
}
public double getDataType(String axes){
if(axes==null){
return sepalWidth;
}
switch (axes){
case "sepalWidth":
return sepalWidth;
......
......@@ -22,11 +22,13 @@ import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
public class MainStageView implements Observer {
private ClassificationModel model;
private ScatterChart scatterChart;
private MainStageController controller;
private String actualX;
private String actualY;
......@@ -52,10 +54,10 @@ public class MainStageView implements Observer {
root.setTitle("SAE3.3 - Logiciel de classification");
root.show();
loader.getController();
MainStageController controller = loader.getController();
controller = loader.getController();
controller.setMainStageView(this);
scatterChart = controller.getScatterChart();
controller.setAxesSelected("Aucun fichier sélectionné");
}
......@@ -65,17 +67,23 @@ public class MainStageView implements Observer {
scatterChart.getData().clear();
if(!(observable instanceof ClassificationModel)) throw new IllegalStateException();
XYChart.Series series1 = new XYChart.Series();
scatterChart.getData().add(series1);
series1.setName("Iris");
if(model.getType() == DataType.IRIS) {
series1.setName("Iris");
for(LoadableData i : model.getDatas()) {
Iris iris = (Iris)i;
XYChart.Data<Double, Double> dataPoint = new XYChart.Data<>(iris.getDataType(actualX),
iris.getDataType(actualY));
Circle circle = new Circle(5);
circle.setFill(iris.getColor());
dataPoint.setNode(circle);
series1.getData().add(dataPoint);
controller.setAxesSelected("");
if(actualX==null && actualY==null){
controller.setAxesSelected("Aucuns axes sélectionnés");
}
else{
scatterChart.getData().add(series1);
for(LoadableData i : model.getDatas()) {
Iris iris = (Iris)i;
XYChart.Data<Double, Double> dataPoint = new XYChart.Data<>(iris.getDataType(actualX),
iris.getDataType(actualY));
Circle circle = new Circle(5);
circle.setFill(iris.getColor());
dataPoint.setNode(circle);
series1.getData().add(dataPoint);
}
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment