Hey all,
I'm new to JavaFX and this problem has been bugging me for some time. Any help would be really appreciated.
I have the following code. What I want from it is to have a smooth curve instead of having individual points shown in the graph. I tried looking up the documentations but could not find any way to do it( unless I missed it ). If it's possible can anyone tell me how to do it or point me in the right direction?
Also, I would like to know if it's possible, and if possible, how to paint a portion of the area beneath the chart. What I want to do is listen for a mouse click beneath the curve and paint the area under the curve from that point to the origin.
protected LineChart<Number, Number> createChart() {
NumberAxis xAxis = new NumberAxis();
NumberAxis yAxis = new NumberAxis();
LineChart<Number,Number> ac = new LineChart<Number,Number>(xAxis,yAxis);
// setup chart
ac.setTitle("Test Graph");
xAxis.setLabel("X Axis");
yAxis.setLabel("Y Axis");
// add starting data
XYChart.Series<Number,Number> series = new XYChart.Series<Number,Number>();
series.setName("NoProb");
int x = 0;
while (x < 10) {
series.getData().add(new XYChart.Data<Number,Number>(x,x*x));
x++;
}
ac.getData().add(series);
return ac;
}