GroupProject.OriginalChartUI.java Source code

Java tutorial

Introduction

Here is the source code for GroupProject.OriginalChartUI.java

Source

package GroupProject;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.RenderingHints;
import java.awt.Toolkit;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import javax.swing.table.DefaultTableModel;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartPanel;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.axis.NumberAxis;
import org.jfree.chart.plot.CategoryPlot;
import org.jfree.chart.plot.PiePlot3D;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.chart.plot.XYPlot;
import org.jfree.chart.renderer.category.BarRenderer3D;
import org.jfree.chart.renderer.category.CategoryItemRenderer;
import org.jfree.chart.renderer.xy.XYItemRenderer;
import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer;
import org.jfree.data.category.DefaultCategoryDataset;
import org.jfree.data.general.DefaultPieDataset;
import org.jfree.data.xy.XYSeries;
import org.jfree.data.xy.XYSeriesCollection;

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 * This class is to display the original data chart
 * @author Yazhou
 */
public class OriginalChartUI extends javax.swing.JFrame {

    private String chartType;

    /**
     * Creates new form OriginalChart
     */
    public OriginalChartUI() {
        initComponents();
        this.setLocationRelativeTo(null);
    }

    File file = null;

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jFrame1 = new javax.swing.JFrame();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTable1 = new javax.swing.JTable();
        charTypeGroup = new javax.swing.ButtonGroup();
        buttonGroup2 = new javax.swing.ButtonGroup();
        jScrollPane2 = new javax.swing.JScrollPane();
        jTable2 = new javax.swing.JTable();
        buttonGroup3 = new javax.swing.ButtonGroup();
        buttonGroup4 = new javax.swing.ButtonGroup();
        dataResourcePanel = new javax.swing.JPanel();
        dataResourceLabel = new javax.swing.JLabel();
        localPanel = new javax.swing.JPanel();
        localLabel = new javax.swing.JLabel();
        localDataResourceAddr = new javax.swing.JTextField();
        localUploadButton = new javax.swing.JButton();
        localCancelButton = new javax.swing.JButton();
        localBrowseButton = new javax.swing.JButton();
        localLoadButton = new javax.swing.JButton();
        AWSPanel = new javax.swing.JPanel();
        AWSLabel = new javax.swing.JLabel();
        AWSOkButton = new javax.swing.JButton();
        AWSCancelButton = new javax.swing.JButton();
        AWSBrowseButton = new javax.swing.JButton();
        AWSDataSource = new javax.swing.JComboBox();
        measuresPanel = new javax.swing.JPanel();
        measuresLabel = new javax.swing.JLabel();
        measuresXLabel = new javax.swing.JLabel();
        measuresYLabel = new javax.swing.JLabel();
        XItem = new javax.swing.JComboBox();
        YItem = new javax.swing.JComboBox();
        chartTypePanel = new javax.swing.JPanel();
        chartTypeLabel = new javax.swing.JLabel();
        chartTypeListPanel1 = new javax.swing.JPanel();
        chartTypeImg1 = new javax.swing.JPanel();
        PieChart = new javax.swing.JRadioButton();
        Barpic = new javax.swing.JLabel();
        Piepic = new javax.swing.JLabel();
        BarChart = new javax.swing.JRadioButton();
        chartTypeImg2 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        LineChart = new javax.swing.JRadioButton();
        Confirm = new javax.swing.JButton();
        chartTypeListPanel2 = new javax.swing.JPanel();
        chartDisplayPanel = new javax.swing.JPanel();
        generateButton = new javax.swing.JButton();
        jMenuBar1 = new javax.swing.JMenuBar();
        btnBack = new javax.swing.JMenu();

        javax.swing.GroupLayout jFrame1Layout = new javax.swing.GroupLayout(jFrame1.getContentPane());
        jFrame1.getContentPane().setLayout(jFrame1Layout);
        jFrame1Layout.setHorizontalGroup(jFrame1Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 400, Short.MAX_VALUE));
        jFrame1Layout.setVerticalGroup(jFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGap(0, 300, Short.MAX_VALUE));

        jTable1.setModel(
                new javax.swing.table.DefaultTableModel(
                        new Object[][] { { null, null, null, null }, { null, null, null, null },
                                { null, null, null, null }, { null, null, null, null } },
                        new String[] { "Title 1", "Title 2", "Title 3", "Title 4" }));
        jScrollPane1.setViewportView(jTable1);

        jTable2.setModel(
                new javax.swing.table.DefaultTableModel(
                        new Object[][] { { null, null, null, null }, { null, null, null, null },
                                { null, null, null, null }, { null, null, null, null } },
                        new String[] { "Title 1", "Title 2", "Title 3", "Title 4" }));
        jScrollPane2.setViewportView(jTable2);

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        dataResourcePanel.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        dataResourceLabel.setText("Data Resource");

        localLabel.setText("Local");

        localDataResourceAddr.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                localDataResourceAddrActionPerformed(evt);
            }
        });

        localUploadButton.setText("Upload");
        localUploadButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                localUploadButtonActionPerformed(evt);
            }
        });

        localCancelButton.setText("Cancel");
        localCancelButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                localCancelButtonActionPerformed(evt);
            }
        });

        localBrowseButton.setText("Browse");
        localBrowseButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                localBrowseButtonActionPerformed(evt);
            }
        });

        localLoadButton.setText("Load Data");
        localLoadButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                localLoadButtonActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout localPanelLayout = new javax.swing.GroupLayout(localPanel);
        localPanel.setLayout(localPanelLayout);
        localPanelLayout.setHorizontalGroup(localPanelLayout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(localPanelLayout.createSequentialGroup().addContainerGap().addGroup(localPanelLayout
                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(localPanelLayout.createSequentialGroup().addComponent(localLabel).addGap(0, 0,
                                Short.MAX_VALUE))
                        .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                                localPanelLayout.createSequentialGroup().addGroup(localPanelLayout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addGroup(localPanelLayout.createSequentialGroup()
                                                .addComponent(localUploadButton)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                                .addComponent(localLoadButton).addGap(43, 43, 43))
                                        .addGroup(localPanelLayout.createSequentialGroup()
                                                .addComponent(localDataResourceAddr).addPreferredGap(
                                                        javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)))
                                        .addGroup(localPanelLayout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                .addComponent(localCancelButton,
                                                        javax.swing.GroupLayout.Alignment.TRAILING)
                                                .addComponent(localBrowseButton,
                                                        javax.swing.GroupLayout.Alignment.TRAILING))))
                        .addContainerGap()));
        localPanelLayout.setVerticalGroup(localPanelLayout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(localPanelLayout.createSequentialGroup().addComponent(localLabel)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(localPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(localDataResourceAddr).addComponent(localBrowseButton))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(localPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(localUploadButton).addComponent(localCancelButton)
                                .addComponent(localLoadButton))));

        AWSLabel.setText("AWS");

        AWSOkButton.setText("OK");
        AWSOkButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                AWSOkButtonActionPerformed(evt);
            }
        });

        AWSCancelButton.setText("Cancel");
        AWSCancelButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                AWSCancelButtonActionPerformed(evt);
            }
        });

        AWSBrowseButton.setText("Browse");
        AWSBrowseButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                AWSBrowseButtonActionPerformed(evt);
            }
        });

        AWSDataSource.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                AWSDataSourceActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout AWSPanelLayout = new javax.swing.GroupLayout(AWSPanel);
        AWSPanel.setLayout(AWSPanelLayout);
        AWSPanelLayout.setHorizontalGroup(AWSPanelLayout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(AWSPanelLayout.createSequentialGroup().addContainerGap().addGroup(AWSPanelLayout
                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(AWSPanelLayout.createSequentialGroup()
                                .addComponent(AWSDataSource, 0, javax.swing.GroupLayout.DEFAULT_SIZE,
                                        Short.MAX_VALUE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(AWSBrowseButton, javax.swing.GroupLayout.PREFERRED_SIZE, 84,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGroup(AWSPanelLayout.createSequentialGroup()
                                .addGroup(AWSPanelLayout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(AWSLabel)
                                        .addGroup(AWSPanelLayout.createSequentialGroup()
                                                .addComponent(AWSOkButton, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                        71, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addComponent(AWSCancelButton)))
                                .addGap(0, 0, Short.MAX_VALUE)))
                        .addContainerGap()));
        AWSPanelLayout.setVerticalGroup(AWSPanelLayout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(AWSPanelLayout.createSequentialGroup().addComponent(AWSLabel)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(AWSPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(AWSDataSource, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(AWSBrowseButton, javax.swing.GroupLayout.PREFERRED_SIZE, 23,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(AWSPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(AWSOkButton).addComponent(AWSCancelButton))
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

        javax.swing.GroupLayout dataResourcePanelLayout = new javax.swing.GroupLayout(dataResourcePanel);
        dataResourcePanel.setLayout(dataResourcePanelLayout);
        dataResourcePanelLayout.setHorizontalGroup(
                dataResourcePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(localPanel, javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGroup(dataResourcePanelLayout.createSequentialGroup().addComponent(dataResourceLabel)
                                .addGap(0, 0, Short.MAX_VALUE))
                        .addGroup(
                                dataResourcePanelLayout.createSequentialGroup()
                                        .addComponent(AWSPanel, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addContainerGap()));
        dataResourcePanelLayout.setVerticalGroup(dataResourcePanelLayout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(dataResourcePanelLayout.createSequentialGroup().addComponent(dataResourceLabel)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(localPanel, javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(AWSPanel, javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

        measuresPanel.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        measuresLabel.setText("Measures");

        measuresXLabel.setText("X:");

        measuresYLabel.setText("Y:");

        XItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                XItemActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout measuresPanelLayout = new javax.swing.GroupLayout(measuresPanel);
        measuresPanel.setLayout(measuresPanelLayout);
        measuresPanelLayout.setHorizontalGroup(measuresPanelLayout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(measuresPanelLayout.createSequentialGroup().addGroup(measuresPanelLayout
                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, measuresPanelLayout
                                .createSequentialGroup().addGap(12, 12, 12)
                                .addGroup(measuresPanelLayout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                        .addComponent(measuresXLabel, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addComponent(measuresYLabel, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addGroup(measuresPanelLayout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                        .addComponent(XItem, 0, 224, Short.MAX_VALUE).addComponent(YItem, 0,
                                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                        .addGroup(measuresPanelLayout.createSequentialGroup().addContainerGap()
                                .addComponent(measuresLabel)))
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
        measuresPanelLayout.setVerticalGroup(measuresPanelLayout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(measuresPanelLayout.createSequentialGroup().addGap(10, 10, 10).addComponent(measuresLabel)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(
                                measuresPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                        .addComponent(measuresXLabel).addComponent(XItem,
                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 30, Short.MAX_VALUE)
                        .addGroup(measuresPanelLayout
                                .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(YItem, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(measuresYLabel))
                        .addGap(27, 27, 27)));

        chartTypePanel.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        chartTypeLabel.setText("Chart Type");

        charTypeGroup.add(PieChart);
        PieChart.setText("3D Pie Chart");
        PieChart.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                PieChartActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout chartTypeImg1Layout = new javax.swing.GroupLayout(chartTypeImg1);
        chartTypeImg1.setLayout(chartTypeImg1Layout);
        chartTypeImg1Layout.setHorizontalGroup(
                chartTypeImg1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(chartTypeImg1Layout.createSequentialGroup().addGap(36, 36, 36)
                                .addComponent(PieChart, javax.swing.GroupLayout.PREFERRED_SIZE, 99,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
        chartTypeImg1Layout
                .setVerticalGroup(chartTypeImg1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(PieChart, javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));

        Barpic.setIcon(new javax.swing.ImageIcon(getClass().getResource("/GroupProject/bar - Copy.png"))); // NOI18N

        Piepic.setIcon(new javax.swing.ImageIcon(getClass().getResource("/GroupProject/pie.png"))); // NOI18N

        charTypeGroup.add(BarChart);
        BarChart.setText("3D Bar Chart");
        BarChart.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BarChartActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout chartTypeImg2Layout = new javax.swing.GroupLayout(chartTypeImg2);
        chartTypeImg2.setLayout(chartTypeImg2Layout);
        chartTypeImg2Layout.setHorizontalGroup(chartTypeImg2Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 0, Short.MAX_VALUE));
        chartTypeImg2Layout.setVerticalGroup(chartTypeImg2Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 141, Short.MAX_VALUE));

        jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/GroupProject/line.png"))); // NOI18N

        charTypeGroup.add(LineChart);
        LineChart.setText("Line Chart");
        LineChart.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                LineChartActionPerformed(evt);
            }
        });

        Confirm.setText("Confirm");
        Confirm.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ConfirmActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout chartTypeListPanel1Layout = new javax.swing.GroupLayout(chartTypeListPanel1);
        chartTypeListPanel1.setLayout(chartTypeListPanel1Layout);
        chartTypeListPanel1Layout.setHorizontalGroup(chartTypeListPanel1Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(chartTypeListPanel1Layout.createSequentialGroup()
                        .addGroup(chartTypeListPanel1Layout
                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(Barpic)
                                .addComponent(BarChart, javax.swing.GroupLayout.PREFERRED_SIZE, 108,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(chartTypeListPanel1Layout
                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(chartTypeListPanel1Layout.createSequentialGroup()
                                        .addComponent(LineChart, javax.swing.GroupLayout.PREFERRED_SIZE, 96,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(chartTypeImg1, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                .addGroup(chartTypeListPanel1Layout.createSequentialGroup().addComponent(jLabel1)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(Piepic).addGap(0, 0, Short.MAX_VALUE)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(chartTypeImg2, javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addGroup(chartTypeListPanel1Layout.createSequentialGroup().addGap(155, 155, 155)
                        .addComponent(Confirm)
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
        chartTypeListPanel1Layout.setVerticalGroup(
                chartTypeListPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(chartTypeListPanel1Layout.createSequentialGroup()
                                .addGroup(chartTypeListPanel1Layout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(Barpic).addComponent(jLabel1).addComponent(Piepic))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(chartTypeListPanel1Layout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(chartTypeImg1, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addGroup(chartTypeListPanel1Layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                                .addComponent(BarChart).addComponent(LineChart,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE, 23,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE)))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(Confirm))
                        .addGroup(chartTypeListPanel1Layout.createSequentialGroup()
                                .addComponent(chartTypeImg2, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(0, 0, Short.MAX_VALUE)));

        javax.swing.GroupLayout chartTypeListPanel2Layout = new javax.swing.GroupLayout(chartTypeListPanel2);
        chartTypeListPanel2.setLayout(chartTypeListPanel2Layout);
        chartTypeListPanel2Layout.setHorizontalGroup(chartTypeListPanel2Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 206, Short.MAX_VALUE));
        chartTypeListPanel2Layout.setVerticalGroup(chartTypeListPanel2Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 0, Short.MAX_VALUE));

        javax.swing.GroupLayout chartTypePanelLayout = new javax.swing.GroupLayout(chartTypePanel);
        chartTypePanel.setLayout(chartTypePanelLayout);
        chartTypePanelLayout.setHorizontalGroup(chartTypePanelLayout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(chartTypePanelLayout.createSequentialGroup().addContainerGap()
                        .addGroup(chartTypePanelLayout
                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(chartTypeLabel)
                                .addGroup(chartTypePanelLayout.createSequentialGroup()
                                        .addComponent(chartTypeListPanel1, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(466, 466, 466).addComponent(chartTypeListPanel2,
                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
        chartTypePanelLayout.setVerticalGroup(chartTypePanelLayout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(chartTypePanelLayout.createSequentialGroup()
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(chartTypeLabel)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(chartTypePanelLayout
                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                .addComponent(chartTypeListPanel2, javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addGroup(chartTypePanelLayout.createSequentialGroup()
                                        .addComponent(chartTypeListPanel1, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addContainerGap()))));

        chartDisplayPanel.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        chartDisplayPanel.setLayout(new java.awt.BorderLayout());

        generateButton.setText("Generate");
        generateButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                generateButtonActionPerformed(evt);
            }
        });

        btnBack.setText("Back");
        btnBack.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                btnBackMouseClicked(evt);
            }
        });
        jMenuBar1.add(btnBack);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup().addContainerGap()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                .addComponent(chartTypePanel, javax.swing.GroupLayout.PREFERRED_SIZE, 431,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(dataResourcePanel, javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(measuresPanel, javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(generateButton, javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(chartDisplayPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 656,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap()));
        layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup().addContainerGap()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                .addComponent(chartDisplayPanel, javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addGroup(layout.createSequentialGroup()
                                        .addComponent(dataResourcePanel, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(chartTypePanel, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                        .addComponent(measuresPanel, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                        .addComponent(generateButton)))
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

        pack();
    }// </editor-fold>//GEN-END:initComponents

    ArrayList<Student> student = new ArrayList<>();

    //The action after clicking the generate button
    private void generateButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_generateButtonActionPerformed
        // TODO add your handling code here:
        String XTitle = (String) XItem.getSelectedItem();
        String YTitle = (String) YItem.getSelectedItem();
        File file = new File("studentTemp.csv");
        Operation operations = new Operation();
        switch (chartType) {
        case "BarChart":
            Map<String, Float> barChartData = new HashMap<>();
            barChartData = operations.barChart(XTitle, YTitle, student);
            draw3DBarChart(barChartData, XTitle, YTitle);
            break;
        case "LineChart":
            Map<String, Float> lineChartData = new HashMap<>();
            lineChartData = operations.barChart(XTitle, YTitle, student);
            drawLineChart(lineChartData, XTitle, YTitle);
            break;
        case "PieChart":
            Map<String, Long> pieChartData = new HashMap<>();
            pieChartData = operations.pieChart(XTitle, student);
            drawPieChart(pieChartData, XTitle);
            break;
        }
    }//GEN-LAST:event_generateButtonActionPerformed

    private void localDataResourceAddrActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_localDataResourceAddrActionPerformed
        // TODO add your handling code here:

    }//GEN-LAST:event_localDataResourceAddrActionPerformed
     //The action after clicking upload button

    private void localUploadButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_localUploadButtonActionPerformed
        try {
            // TODO add your handling code here:
            FileUpload.Upload(file);
        } catch (IOException ex) {
            Logger.getLogger(OriginalChartUI.class.getName()).log(Level.SEVERE, null, ex);
        }

    }//GEN-LAST:event_localUploadButtonActionPerformed

    //The action after clicking browse button
    private void localBrowseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_localBrowseButtonActionPerformed
        // TODO add your handling code here:
        JFileChooser fileChooser = new JFileChooser();
        FileTypeFilter fileFileter = new FileTypeFilter();
        fileChooser.setFileFilter(fileFileter);
        int returnVal = fileChooser.showOpenDialog(this);

        if (returnVal == JFileChooser.APPROVE_OPTION) {
            file = fileChooser.getSelectedFile();
            //  FileName.setText(file.getName());
            //FileUpload.Upload(file);
            localDataResourceAddr.setText(file.getName());
        } else {
            JOptionPane.showMessageDialog(null, "File access cancelled by user.", "Alert",
                    JOptionPane.ERROR_MESSAGE);
        }
    }//GEN-LAST:event_localBrowseButtonActionPerformed

    //The action after clicking cancel button
    private void localCancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_localCancelButtonActionPerformed
        // TODO add your handling code here:
        localDataResourceAddr.setText("");
    }//GEN-LAST:event_localCancelButtonActionPerformed

    //The action after clicking ok button
    private void AWSOkButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AWSOkButtonActionPerformed
        // TODO add your handling code here:
        String selectedFile = (String) AWSDataSource.getSelectedItem();
        try {
            FileDownload.DownloadFile(selectedFile);

            student = FileDownload.student;

        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }//GEN-LAST:event_AWSOkButtonActionPerformed

    //The action after clicking cancel button
    private void AWSCancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AWSCancelButtonActionPerformed
        // TODO add your handling code here:
        AWSDataSource.removeAllItems();
    }//GEN-LAST:event_AWSCancelButtonActionPerformed

    //The action after clicking browse button
    private void AWSBrowseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AWSBrowseButtonActionPerformed
        // TODO add your handling code here:
        ArrayList<String> fileList = FileDownload.FileList();

        for (int i = 0; i < fileList.size(); i++) {
            AWSDataSource.addItem(fileList.get(i));
        }

    }//GEN-LAST:event_AWSBrowseButtonActionPerformed

    private void AWSDataSourceActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AWSDataSourceActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_AWSDataSourceActionPerformed

    //The action after clicking confirm button
    private void ConfirmActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ConfirmActionPerformed
        // TODO add your handling code here:
        Peer peer = new Peer();
        XItem.removeAllItems();
        YItem.removeAllItems();

        String[] xTitle = null;
        String[] yTitle = null;

        if (BarChart.isSelected()) {
            xTitle = peer.getBarXTitle();
            yTitle = peer.getBarYTitle();
            chartType = "BarChart";
            for (String y : yTitle) {
                YItem.addItem(y);
            }
        }
        if (LineChart.isSelected()) {
            xTitle = peer.getLineXTitle();
            yTitle = peer.getLineYTitle();

            chartType = "LineChart";

            for (String y : yTitle) {
                YItem.addItem(y);
            }
        }
        if (PieChart.isSelected()) {
            xTitle = peer.getPieXTitle();
            chartType = "PieChart";

        }

        for (String x : xTitle) {
            XItem.addItem(x);
        }

    }//GEN-LAST:event_ConfirmActionPerformed

    private void BarChartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BarChartActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_BarChartActionPerformed

    private void PieChartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_PieChartActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_PieChartActionPerformed

    private void XItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_XItemActionPerformed
        // TODO add your handling code here:

    }//GEN-LAST:event_XItemActionPerformed

    //The action after clicking load button
    private void localLoadButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_localLoadButtonActionPerformed

        try {
            // TODO add your handling code here:
            FileLoad.readLocalFile(file);
            student = FileLoad.student;

        } catch (FileNotFoundException ex) {
            Logger.getLogger(OriginalChartUI.class.getName()).log(Level.SEVERE, null, ex);
        } catch (IOException ex) {
            Logger.getLogger(OriginalChartUI.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_localLoadButtonActionPerformed

    private void LineChartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_LineChartActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_LineChartActionPerformed

    //The action after clicking back button
    private void btnBackMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnBackMouseClicked
        Dashboard db = new Dashboard();
        this.setVisible(false);
        db.setVisible(true);
    }//GEN-LAST:event_btnBackMouseClicked

    /**
     *
     */
    //    public void setLableName() {
    //
    //    }

    /**
     * The entrance of the original data display page
     * @param args the command line arguments
     * @throws java.lang.ClassNotFoundException
     * @throws java.lang.InstantiationException
     * @throws java.lang.IllegalAccessException
     * @throws javax.swing.UnsupportedLookAndFeelException
     */
    public static void main(String args[]) throws ClassNotFoundException, InstantiationException,
            UnsupportedLookAndFeelException, IllegalAccessException {
        UIManager.setLookAndFeel("com.jtattoo.plaf.acryl.AcrylLookAndFeel");
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Sea".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(DMChartUI.class.getName()).log(java.util.logging.Level.SEVERE, null,
                    ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(DMChartUI.class.getName()).log(java.util.logging.Level.SEVERE, null,
                    ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(DMChartUI.class.getName()).log(java.util.logging.Level.SEVERE, null,
                    ex);
        }

        //</editor-fold>
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new OriginalChartUI().setVisible(true);

            }
        });
    }

    /**
     * The method to draw line chart
     * @param lineChartData the data used in the line chart
     * @param XTitle the measurement of X axis
     * @param YTitle the measurement of Y axis
     */
    public void drawLineChart(Map<String, Float> lineChartData, String XTitle, String YTitle) {
        String title = XTitle + " VS " + YTitle;
        System.out.print("drawLineChart");

        ArrayList<String> keyArrayList = new ArrayList<>();
        ArrayList<Float> valueArrayList = new ArrayList<>();
        Set set = lineChartData.keySet();
        int i = 1;
        XYSeries series1 = new XYSeries("");

        for (Map.Entry<String, Float> data : lineChartData.entrySet()) {
            String key = data.getKey();
            Float value = data.getValue();
            keyArrayList.add(key);
            valueArrayList.add(value);
            series1.add(Integer.valueOf(key), value);
        }
        XYSeriesCollection dataset = new XYSeriesCollection();
        dataset.addSeries(series1);
        JFreeChart chart = ChartFactory.createXYLineChart(title, XTitle, YTitle, dataset, PlotOrientation.VERTICAL,
                true, true, false);
        XYPlot plot = chart.getXYPlot();
        XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
        renderer.setSeriesPaint(0, Color.BLUE);

        renderer.setSeriesLinesVisible(1, false);
        renderer.setSeriesShapesVisible(1, false);
        plot.setRenderer(renderer);

        plot.setRangeGridlinePaint(Color.GRAY);
        plot.setBackgroundPaint(Color.white);
        ChartPanel chartPanel = new ChartPanel(chart);
        chartDisplayPanel.removeAll();
        chartDisplayPanel.add(chartPanel, BorderLayout.CENTER);
        chartDisplayPanel.validate();
    }

    /**
     * The method to draw pie chart
     * @param pieChartData the data used in the pie chart
     * @param pieTitle the measurement of pie chart
     */
    public void drawPieChart(Map<String, Long> pieChartData, String pieTitle) {

        String title = pieTitle;
        ArrayList<String> keyArrayList = new ArrayList<>();
        ArrayList<Long> valueArrayList = new ArrayList<>();
        ArrayList<Color> colorArrayList = new ArrayList<>();

        colorArrayList.add(new Color(222, 235, 247));
        colorArrayList.add(new Color(109, 166, 217));
        colorArrayList.add(new Color(155, 195, 230));
        colorArrayList.add(new Color(126, 146, 222));
        colorArrayList.add(new Color(96, 158, 218));
        colorArrayList.add(new Color(53, 132, 203));
        colorArrayList.add(new Color(46, 116, 180));
        colorArrayList.add(new Color(31, 77, 119));

        DefaultPieDataset dataset = new DefaultPieDataset();
        Set set = pieChartData.keySet();
        for (Map.Entry<String, Long> data : pieChartData.entrySet()) {
            String key = data.getKey();
            Long value = data.getValue();
            keyArrayList.add(key);
            valueArrayList.add(value);
        }
        for (int i = 0; i < valueArrayList.size(); i++) {
            dataset.setValue(keyArrayList.get(i), valueArrayList.get(i));
        }
        JFreeChart chart = ChartFactory.createPieChart3D(title, dataset);
        chart.setBorderVisible(false);
        chart.setBorderPaint(new Color(255, 255, 255));
        PiePlot3D plot = (PiePlot3D) chart.getPlot();
        for (int i = 0; i < valueArrayList.size(); i++) {
            Color color = colorArrayList.get(i);
            plot.setSectionPaint(keyArrayList.get(i), color);
        }
        plot.setOutlineVisible(false);
        plot.setForegroundAlpha(0.6f);
        plot.setStartAngle(0);
        plot.setBackgroundPaint(new java.awt.Color(255, 255, 255));
        ChartPanel chartPanel = new ChartPanel(chart);
        chartDisplayPanel.removeAll();
        chartDisplayPanel.add(chartPanel, BorderLayout.CENTER);
        chartDisplayPanel.validate();
    }

    /**
     * This method is to split the string by :
     * @param valueString the string needs to be split
     * @return the arraylist of the split string
     */
    public ArrayList<Float> splitPoint(String valueString) {
        ArrayList<Float> pointsValue = new ArrayList<>();
        for (String subString : valueString.split(";")) {
            pointsValue.add(Float.valueOf(subString));
        }
        return pointsValue;
    }

    /**
     * The method to draw bar chart
     * @param barChartData the data used in the bar chart
     * @param XTitle the measurement of X axis
     * @param YTitle the measurement of Y axis
     */
    public void draw3DBarChart(Map<String, Float> barChartData, String XTitle, String YTitle) {
        DefaultCategoryDataset dataset = new DefaultCategoryDataset();
        String title = XTitle + " VS " + YTitle;
        ArrayList<String> keyArrayList = new ArrayList<>();
        ArrayList<Float> valueArrayList = new ArrayList<>();
        Set set = barChartData.keySet();
        int i = 1;
        for (Map.Entry<String, Float> data : barChartData.entrySet()) {
            String key = data.getKey();
            Float value = data.getValue();
            keyArrayList.add(key);
            valueArrayList.add(value);
            dataset.setValue(value, "1", key);
        }
        JFreeChart chart = ChartFactory.createBarChart3D(title, "", "", dataset, PlotOrientation.VERTICAL, false,
                false, false);

        CategoryPlot plot = chart.getCategoryPlot();
        plot.setBackgroundPaint(new java.awt.Color(255, 255, 255));
        plot.setRangeGridlinePaint(Color.GRAY);

        BarRenderer3D barRender = (BarRenderer3D) plot.getRenderer();
        barRender.setSeriesPaint(0, Color.decode("#9DC3E6"));
        ChartPanel chartPanel = new ChartPanel(chart);
        chartDisplayPanel.removeAll();
        chartDisplayPanel.add(chartPanel, BorderLayout.CENTER);
        chartDisplayPanel.validate();
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton AWSBrowseButton;
    private javax.swing.JButton AWSCancelButton;
    private javax.swing.JComboBox AWSDataSource;
    private javax.swing.JLabel AWSLabel;
    private javax.swing.JButton AWSOkButton;
    private javax.swing.JPanel AWSPanel;
    private javax.swing.JRadioButton BarChart;
    private javax.swing.JLabel Barpic;
    private javax.swing.JButton Confirm;
    private javax.swing.JRadioButton LineChart;
    private javax.swing.JRadioButton PieChart;
    private javax.swing.JLabel Piepic;
    private javax.swing.JComboBox XItem;
    private javax.swing.JComboBox YItem;
    private javax.swing.JMenu btnBack;
    private javax.swing.ButtonGroup buttonGroup2;
    private javax.swing.ButtonGroup buttonGroup3;
    private javax.swing.ButtonGroup buttonGroup4;
    private javax.swing.ButtonGroup charTypeGroup;
    private javax.swing.JPanel chartDisplayPanel;
    private javax.swing.JPanel chartTypeImg1;
    private javax.swing.JPanel chartTypeImg2;
    private javax.swing.JLabel chartTypeLabel;
    private javax.swing.JPanel chartTypeListPanel1;
    private javax.swing.JPanel chartTypeListPanel2;
    private javax.swing.JPanel chartTypePanel;
    private javax.swing.JLabel dataResourceLabel;
    private javax.swing.JPanel dataResourcePanel;
    private javax.swing.JButton generateButton;
    private javax.swing.JFrame jFrame1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JTable jTable1;
    private javax.swing.JTable jTable2;
    private javax.swing.JButton localBrowseButton;
    private javax.swing.JButton localCancelButton;
    private javax.swing.JTextField localDataResourceAddr;
    private javax.swing.JLabel localLabel;
    private javax.swing.JButton localLoadButton;
    private javax.swing.JPanel localPanel;
    private javax.swing.JButton localUploadButton;
    private javax.swing.JLabel measuresLabel;
    private javax.swing.JPanel measuresPanel;
    private javax.swing.JLabel measuresXLabel;
    private javax.swing.JLabel measuresYLabel;
    // End of variables declaration//GEN-END:variables
}