I'm having difficulty with the ChangeListener portion of my code. My goal is to read data (wattage generated) from a small solar panel and stream this data to an XYChart.Series in JavaFX. My xAxis of the chart range is 0-15 (hours) which I would like to be represented as 6a.m. to 9 p.m. for the xAxis tick marks. Is it possible to read and graph the arduino data every 10 minutes (6x/hour)? Any ideas on how to go about setting this one up within the JavaFx class?
I have tested my SerialPort connection with the arduino and I am able to readBytes and print them in the compiler. Now, should I create an ObservableList of the following form: ObservableList<XYChart.Series<String, Number>> xyList1 = FXCollections.observableArrayList();
in order to record the data?
If this is not clear, please let me know and I will do my best to clarify. I could really use some help with this.
Currently, I'm using readBytes (SerialPort class) to get the data from the arduino. I'm not sure how to process that data into the chart format (indicated above) using xyList1.add(new XYChart.Data(xval, yval)). How will I get the xval and yval? If I append it to a StringBuilder, would I use set/get methods then to retrieve the collected data on each cycle (for example, every 5 minutes).
My goal with this project is to have 2 sensors processing data simultaneously, and displaying that data using Java...will I chart both sensor's data within a single Platform.runLater()?
Thank you for your help. Most of what I've found on the subject as been from other project I've found online. If I used something like the following, where would I place the Platform.runLater()?
This is the example I've found from JavaFX8 Introduction By Example Written by: Carl Dea, Merk Heckler, Gerrit Grunwald, Jose Pereda, and Sean Phillips
How would I represent t1 without using the Lambda format used here? I'm setting up a separate method actionPerformed because it is easier for me to read and I will call the method when the start button is pressed.