title: How to visualize data from JTable?
body: <p>I want to built a software for data analysis using machine learning algorithms and I need to visualize the data in charts for preprocessing. I use the following code to display data in the <code>JTable</code>:</p>
  <p>I use <code>JFileChooser</code> to open the file and display the data in a table as following:</p>
  <pre><code>JFileChooser Chooser = new JFileChooser();
  FileNameExtensionFilter filter =new FileNameExtensionFilter (&quot;open file 
  &quot;,&quot;csv&quot;);
  Chooser.setFileFilter(filter);
  Chooser.showOpenDialog(null);
  File f = Chooser.getSelectedFile();
  if (f != null) {
     String filename1 = f.getAbsolutePath();
     filepath.setText(filename1);
  } else {
    JOptionPane.showMessageDialog(this, &quot;No File Selected&quot;);
  }      
    filePath1 = filepath.getText();
   File file = new File(filePath1);
      //send data to the other tab 
  jTable1.setModel(new DefaultTableModel(null,new String[] 
  {&quot;column1&quot;,&quot;column2&quot;,&quot;column3&quot;,&quot;column4&quot;}));
       try {
          BufferedReader br = new BufferedReader(new FileReader(file));
          // get the first line
          // get the columns name from the first line
          // set columns name to the jtable model
          String firstLine = br.readLine();
          String[] columnsName = firstLine.split(&quot;,&quot;);
          
          DefaultTableModel model = (DefaultTableModel) jTable1.getModel();
          model.setColumnIdentifiers(columnsName);
         attributesNum= columnsName.length;
          String st;
          String eachline;
          String[] cells;
         DefaultCategoryDataset bardataset =new  DefaultCategoryDataset();
  
          // there is a new line 
          while ((st = br.readLine()) != null) {
           // System.out.println(st); 
               eachline = st.trim();
              cells = eachline.split(&quot;,&quot;);
              //show each line in jtable
              model.addRow(cells);
                                                                                
  </code></pre>
  <p>After that I want to visualize the data in the table in a bar chart in away similar to Weka  but I couldn't find a method to do that what I found is methods to create dataset and fill it inside the code.</p>