Skip to content

Commit

Permalink
Y Axis setting
Browse files Browse the repository at this point in the history
  • Loading branch information
tainfante committed Dec 25, 2017
1 parent f65ff20 commit e46ff77
Show file tree
Hide file tree
Showing 3 changed files with 101 additions and 0 deletions.
39 changes: 39 additions & 0 deletions src/mainwindow/Chart.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
package mainwindow;

import classes.DateAxis;
<<<<<<< HEAD
=======
import javafx.event.ActionEvent;
>>>>>>> d308831
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.chart.*;
import javafx.scene.control.Alert;
import javafx.scene.control.CheckBox;
import javafx.scene.control.ChoiceBox;
<<<<<<< HEAD
=======
import javafx.scene.control.TextField;
>>>>>>> d308831

import java.net.URL;
import java.util.Date;
Expand Down Expand Up @@ -44,6 +53,10 @@ public class Chart implements Initializable {
public CheckBox checkEight;
@FXML
private ChoiceBox timeBox;
@FXML
private TextField minText;
@FXML
private TextField maxText;

@Override
public void initialize(URL location, ResourceBundle resources) {
Expand All @@ -66,7 +79,33 @@ public void initialize(URL location, ResourceBundle resources) {
timeBox.getItems().add("10 minutes");
timeBox.getItems().add("5 minutes");
timeBox.getItems().add("1 minute");
yAxis.setForceZeroInRange(false);

}

<<<<<<< HEAD
=======
public void onSubmitChanges(ActionEvent actionEvent) {
String MIN=minText.getText();
String MAX=maxText.getText();
double min=0;
double max=65000;
try
{
min = Double.parseDouble(MIN);
max = Double.parseDouble(MAX);
}
catch(NumberFormatException nfe)
{
Alert alert = new Alert(Alert.AlertType.ERROR);
alert.setTitle("Wrong data type");
alert.setHeaderText("You have submitted wrong data");
alert.setContentText("Please, set some numbers");
alert.showAndWait();
}
yAxis.setAutoRanging(false);
yAxis.setLowerBound(min);
yAxis.setUpperBound(max);
}
>>>>>>> d308831
}
56 changes: 56 additions & 0 deletions src/mainwindow/chart.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@

</right>
<bottom>
<<<<<<< HEAD
<HBox spacing="10.0" styleClass="background">
<children>
<Label text="Show data from last:" />
Expand All @@ -65,5 +66,60 @@
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
</BorderPane.margin>
</HBox>
=======
<VBox>
<HBox>
<children>
<Label text="Set Y Axis parameters" prefWidth="310" styleClass="labels"/>
<Label text="Set X Axis parameters" prefWidth="310" styleClass="labels"/>
</children>
</HBox>
<HBox spacing="10.0" styleClass="background">
<children>
<HBox prefWidth="310" alignment="CENTER">
<padding>
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
</padding>
<children>
<Label text="MIN VALUE:">
<padding>
<Insets right="5.0" />
</padding>
</Label>
<TextField fx:id="minText" prefWidth="40">
<padding>
<Insets right="5.0" />
</padding>
</TextField>
<Label text="MAX VALUE:">
<padding>
<Insets right="5.0" />
</padding>
</Label>
<TextField fx:id="maxText" prefWidth="40">
<padding>
<Insets right="5.0" />
</padding>
</TextField>
<Button onAction="#onSubmitChanges" text="Submit" />
</children>
</HBox>
<HBox prefWidth="310" alignment="CENTER">
<padding>
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
</padding>
<children>
<Label text="Show data from last:" />
<ChoiceBox prefWidth="150.0" fx:id="timeBox"/>
</children>
</HBox>
</children>
<BorderPane.margin>
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
</BorderPane.margin>
</HBox>
</VBox>

>>>>>>> d308831
</bottom>
</BorderPane>
6 changes: 6 additions & 0 deletions src/stylesheets/ChartCSS.css
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,11 @@


}
.labels{
-fx-border-color: #000066;
-fx-font-size: 20px;
-fx-alignment: center;
-fx-background-color: #CCCCFF;
}


0 comments on commit e46ff77

Please sign in to comment.