Skip to content

Commit

Permalink
Chart warnings eliminated
Browse files Browse the repository at this point in the history
  • Loading branch information
tainfante committed Jan 24, 2018
1 parent ef7eec3 commit 712b001
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 30 deletions.
21 changes: 11 additions & 10 deletions src/mainwindow/Chart.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package mainwindow;

import classes.DateAxis;
import classes.Frame;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.fxml.FXML;
Expand All @@ -22,14 +23,14 @@ public class Chart implements Initializable {
private static volatile Chart ChartINSTANCE;
@FXML
LineChart<Date, Number> lchart;
public static XYChart.Series series1 = new XYChart.Series();
public static XYChart.Series series2 = new XYChart.Series();
public static XYChart.Series series3 = new XYChart.Series();
public static XYChart.Series series4 = new XYChart.Series();
public static XYChart.Series series5 = new XYChart.Series();
public static XYChart.Series series6 = new XYChart.Series();
public static XYChart.Series series7 = new XYChart.Series();
public static XYChart.Series series8 = new XYChart.Series();
public static XYChart.Series<Date, Number> series1 = new XYChart.Series<>();
public static XYChart.Series<Date, Number> series2 = new XYChart.Series<>();
public static XYChart.Series<Date, Number> series3 = new XYChart.Series<>();
public static XYChart.Series<Date, Number> series4 = new XYChart.Series<>();
public static XYChart.Series<Date, Number> series5 = new XYChart.Series<>();
public static XYChart.Series<Date, Number> series6 = new XYChart.Series<>();
public static XYChart.Series<Date, Number> series7 = new XYChart.Series<>();
public static XYChart.Series<Date, Number> series8 = new XYChart.Series<>();
@FXML
private DateAxis xAxis = new DateAxis();
@FXML
Expand Down Expand Up @@ -59,7 +60,7 @@ public class Chart implements Initializable {
@FXML
private TextField maxText;

int samples=200;
private int samples=200;

@Override
public void initialize(URL location, ResourceBundle resources) {
Expand Down Expand Up @@ -213,7 +214,7 @@ public void onChooseVariable(ActionEvent actionEvent) {
}
}

public void channelUpdate(int channelNumber, String name, Color color) {
void channelUpdate(int channelNumber, String name, Color color) {

String rgb = String.format("%d, %d, %d",
(int) (color.getRed() * 255),
Expand Down
31 changes: 11 additions & 20 deletions src/plot/Plot.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,25 +45,18 @@ public static Plot getInstance() {
return PlotINSTANCE;
}

private Frame plotData() throws InterruptedException {
Frame frame;
frame = PortReader.getInstance().getFrameBuffer().take();
return frame;
}

public void startPlotting() {

Thread plottingThread=new Thread(new Runnable() {
Frame receivedFrame;

@Override
public void run() {
while (!stop) {
try {
receivedFrame = plotData();
} catch (InterruptedException e) {
receivedFrame = PortReader.getInstance().getFrameBuffer().take();
}
catch (InterruptedException e) {
e.printStackTrace();

}
receivedFrame.setNumberOfChannels(receivedFrame.getChannelData().size());
for (int i = 0; i < receivedFrame.getNumberOfChannels(); i++) {
Expand All @@ -75,28 +68,28 @@ public void run() {

switch (j) {
case 0:
series1.getData().add(new XYChart.Data(frame.getTime(), data));
series1.getData().add(new XYChart.Data<>(frame.getTime(), data));
break;
case 1:
series2.getData().add(new XYChart.Data(frame.getTime(), data));
series2.getData().add(new XYChart.Data<>(frame.getTime(), data));
break;
case 2:
series3.getData().add(new XYChart.Data(frame.getTime(), data));
series3.getData().add(new XYChart.Data<>(frame.getTime(), data));
break;
case 3:
series4.getData().add(new XYChart.Data(frame.getTime(), data));
series4.getData().add(new XYChart.Data<>(frame.getTime(), data));
break;
case 4:
series5.getData().add(new XYChart.Data(frame.getTime(), data));
series5.getData().add(new XYChart.Data<>(frame.getTime(), data));
break;
case 5:
series6.getData().add(new XYChart.Data(frame.getTime(), data));
series6.getData().add(new XYChart.Data<>(frame.getTime(), data));
break;
case 6:
series7.getData().add(new XYChart.Data(frame.getTime(), data));
series7.getData().add(new XYChart.Data<>(frame.getTime(), data));
break;
case 7:
series8.getData().add(new XYChart.Data(frame.getTime(), data));
series8.getData().add(new XYChart.Data<>(frame.getTime(), data));
break;
}
});
Expand Down Expand Up @@ -126,8 +119,6 @@ public void run() {
plottingThread.setDaemon(true);
plottingThread.setName("Plotting thread");
plottingThread.start();


}
}

0 comments on commit 712b001

Please sign in to comment.