title: Reduce chart code
body: <p>I want to reduce chart code because I have too many variables which I believe can be reduced.</p>
  
  <p><strong>Object to store data:</strong></p>
  
  <pre><code>public class EventsObj
  {
      private String date;
      private int info;
      private int error;
      private int warning;
      private int critical;
  
      public EventsObj()
      {
      }
  
      public EventsObj(String date, int info, int error, int warning, int critical)
      {
          this.date = date;
          this.info = info;
          this.error = error;
          this.warning = warning;
          this.critical = critical;
      }
  
      public String getDate()
      {
          return date;
      }
  
      public void setDate(String date)
      {
          this.date = date;
      }
  
      public int getInfo()
      {
          return info;
      }
  ................
  </code></pre>
  
  <p><strong>List for data from SQL query:</strong></p>
  
  <pre><code>    List&lt;EventsObj&gt; eventsObj = new ArrayList&lt;&gt;();
  
   eventsObj.add(new EventsObj(String.valueOf(rs.getTimestamp("EVENT_DATE")), rs.getInt("INFO"), rs.getInt("WARN"), rs.getInt("CRITICAL"), rs.getInt("ERROR"))); 
  </code></pre>
  
  <p>But when I want to use the data in Pie chart I use this ugly code:</p>
  
  <pre><code>ObservableList&lt;PieChart.Data&gt; pieChartData = FXCollections.observableArrayList();
  
  int info = 0;
          int error = 0;
          int warning = 0;
          int critical = 0;
  
          for (int i = 0; i &lt; eventsObj.size(); i++)
          {
              EventsObj get = eventsObj.get(i);
              info = get.getInfo() + info;
              error = get.getError() + error;
              warning = get.getWarning() + warning;
              critical = get.getCritical() + critical;
          }
  
          pieChartData.add(new PieChart.Data("Info", info));
          pieChartData.add(new PieChart.Data("Error", error));
          pieChartData.add(new PieChart.Data("Warning", warning));
          pieChartData.add(new PieChart.Data("Critical", critical));
  
  
          final PieChart chart = new PieChart(pieChartData);
  </code></pre>
  
  <p>Can you propose some more easy solution to get the data from the List and insert it  into the Pie Chart?</p>