From the course: Learning JavaFX GUI Development

Unlock the full course today

Join today to access over 23,400 courses taught by industry experts.

Solution Create a bar chart

Solution Create a bar chart

- [Voiceover] I don't know about you but the bar chart seemed a little more complicated to me then the pie chart. Let's take a look at my code. I'll try and explain my thought process as we go. I'm gonna scroll down in the start method, the first thing I had to do was label the two axes. The category axis along the bottom which represented the sales people. And the number axis which is the vertical axis, which was the new car sales. I created my bar chart and in the angle brackets I had to specify the data types of the values. The string represents the sales persons name and the value number represents the sales. I called my bar chart, BC sales, and I set it equal to a new bar chart. I changed the title of the bar chart. Lines 35, 36 and 37 is where I'm creating the series of data for each month. In lines 39 to 41 I set the names to January, February and March. On line 43 is where I actually add the data. I add information to the January series for Mary and Tom, my two sales people…

Contents