JavaFx DateAxis(Kenya 2011 Road Accidents)
JAVAFX DATEAXIS/SCATTERCHARTAgain openkenyadata has the data of 2011 road incidents link (only),don't understand why cause Kenya has the highest road accidents in Africa, and only one year data set published.
JavaFx doesn't have a dateAxis which lets you set Date as value on a XYChart,thanks their is a library for that ExtFX which has other controls i.e NumberSpinner.
Example of how to use DateAxis
ObservableList<XYChart.Series<Date, Number>> series = FXCollections.observableArrayList();
ObservableList<XYChart.Data<Date, Number>> series1Data = FXCollections.observableArrayList();
//add data to the series
series.add(new XYChart.Series<>("Series1", series1Data));
NumberAxis numberAxis = new NumberAxis(-1,25,1);
DateAxis dateAxis = new DateAxis();
ScatterChart<Date, Number> scatterChart = new ScatterChart<>(dateAxis, numberAxis, series);
scatterChart .setTitle("2011 Road Accidents");
The data is in csv format(comma separated value file),which has time of accidents records,number of deaths,injured and causes and more but we are interested with the mentioned ones.
Accidents recorded total of 1354.
Reading the File
Scanner sc=new Scanner(new BufferedReader(new FileReader("acc.csv")));
int death=Integer.parseInt(rry);//at column 8 death records
Negligence Vs Error