This question refers to a similar question that I posted here a few days ago ...
Here is an interface that will show where I want the chart to be displayed:

I want to display a chart on a large JPanel on the right side. What the chart is designed to do is compare the statistics of a particular player with the national average and the average value (with three bars). The chart (should) know which player to show the comparison by getting the name of the player from the text box (the one that already has "getPlayerName"). As in the case of my similar question mentioned earlier, I created a class (this time called PlayerVsCountryVsOverallChart) - which will be engaged in constructing a diagram for this particular stat.
The code from the "PlayerVsCountryVsOverallChart" class is pretty similar, but I think there is some logic that prevents the chart from showing (or even doing). As my logic is still evolving (with stuff related to JFreeCharts), I would really appreciate it if someone could learn this for me.
Here is the code for the PlayerVsCountryVsOverallChart class - minus the necessary imports:
public class PlayerVsCountryVsOverallChart extends JPanel { private static final long serialVersionUID = 1L; private ArrayList<Player> players; private StatUtilities stats; public String yAxisLabel = ""; private String chosenPlayer; public String[] compareStatsOptions = new String[] { "Average Balls Bowled", "Average of Bowling Averages", "Average Career Length", "Average Economy Rate", "Average Number of Five Wicket Innings", "Average Innings Played", "Average Matches Played", "Average Runs Conceded", "Average Strike Rate", "Average Wickets Taken" }; ; public PlayerVsCountryVsOverallChart(String applicationTitle, String chartTitle, ArrayList<Player> players, int option, String chosenPlayer) {
I was not sure what to place in SSCCE from this class. I have a feeling that the problem may be with the switch-case expression in the "CategoryDataset createDataset" method ...
Here is the button code for the "Go" button, which should create a chart when clicked (in combination with the option selected in the JComboBox next to it, and the name of the players from the text box):
private void confirmGraphBtnActionPerformed(java.awt.event.ActionEvent evt) { String selectedOption = String.valueOf(chooseGraphOption.getSelectedItem()).toString(); int statsOption = options.indexOf(selectedOption); processCvPvOchart(statsOption); }
Finally, here is the code for the processCvPvOchart method:
public void processCvPvOchart(int option) {
I passed this code to my GitHub project repository at https://github.com/rattfieldnz/Java_Projects/tree/master/PCricketStats . Doing this and testing it can be useful for people who want to help me. As soon as I learn more about disabling my code for SSCCE, I will include smaller pieces of code.