I am creating a BarChart in JavaFX with random data, and I have a fxml file with a designated canvas that I want to draw the BarChart on.
I am fine on creating the bar chart, but if I have (for example) a barChart object of type BarChart and the canvas has fx:id "canvas", what is the method or code that lets me use GraphicsContext to draw the bar chart on the canvas? I know that to get the GraphicsContext it would be canvas.getGraphicsContext2D, but once I have that GraphicsContext object, what do I do with it to draw my barChart object on the canvas?