title: primefaces charts not updating when submit a new request
body: <p>I submit data and a chart has been displayed But again when I submit it by inserting new values in form,chart doesn't update itself.Another thing I saw is when I refresh the page then it update the chart and chart with new values get display.<br/>
  For instance If I give values <br/><strong>Wheat=40</strong> and <strong>Sugar=60</strong><br/>and submit , It will display the chart.<br/>Now when I submit <strong>Wheat=90</strong> and <strong>Sugar=10</strong> , it displays nothing but the old chart remain present on the page.<br/>Now If I refresh the page , The chart with updated values will be availabe.<br/>How can I get rid of that problem :( Please suggest a solution if any one have.
  <br/>Here is my code<br/>
  <strong>Chart Code</strong></p>
  
  <pre><code>&lt;p:barChart id="horizontal"
                          value="#{reportingCharts.categoryModel}" legendPosition="se"
                          style="width:635px;height:500px" title="Horizontal Bar Chart"
                          orientation="horizontal" min="0" max="150" animate="true"
                          zoom="true" barMargin="90"
                          rendered="#{chartsRendering.barCharts}" showDatatip="true" shadow="true" /&gt;
  </code></pre>
  
  <p><strong>Button Code</strong></p>
  
  <pre><code>&lt;h:commandButton id="btnLanguage" action="#{reportingCharts.getGraphValuesOnLanguageBasis}"
                                  value="Plot Chart Language"&gt;
                                  &lt;/h:commandButton&gt;
  </code></pre>
  
  <p><strong>getGraphValuesOnLanbguageBasis method</strong></p>
  
  <pre><code>public void getGraphValuesOnLanguageBasis() {
  
          categoryModel = null;
  
  
              resList = (ArrayList&lt;ChartResult&gt;) serviceObj
                  .getChartByLanguage(ranks, language);
  
          if (chartType.equalsIgnoreCase("bar")
                  || chartType.equalsIgnoreCase("line")
                  || chartType.equalsIgnoreCase("column")) {
  
              categoryModel = new CartesianChartModel();
  
              ChartSeries langChart = null;
  
  
              for (int a = 0; a &lt; ranks.length; a++) {
  
                  langChart = new ChartSeries();
                  if(a == 0){
                      for(int z=0;z&lt;language.length;z++){
  
                          langChart.set(languageMap.get(Integer.parseInt(language[z])),0);
  
                      }
                      }
  
                  String rank = "";
                  boolean rankAvailable = false;
                  for (int x = 0; x &lt; resList.size(); x++) {
  
                      if(Integer.parseInt(resList.get(x).getRankId()) == Integer.parseInt(ranks[a])){
                          rank = resList.get(x).getRankName();
  
                          x = resList.size();
                          rankAvailable = true;
  
                      }
                  }
  
  
                  if(rankAvailable == false){
  
                      langChart.setLabel(rankMap.get(Integer.parseInt(ranks[a])));
  
                  }
                  else{
  
                      langChart.setLabel(rank);
                  }
  
  
                  for (int x = 0; x &lt; resList.size(); x++) {
  
  
                      if (Integer.parseInt(resList.get(x).getRankId()) == Integer
                              .parseInt(ranks[a]) &amp;&amp; rankAvailable == true) {
  
                                                  langChart.set(languageMap.get(Integer.parseInt(resList.get(x).getCriteria())), Integer
                                  .parseInt(resList.get(x).getNoOfPersons()));
  
  
                      }
  
                  }
  
                  categoryModel.addSeries(langChart);
  
              }
  
          } else if (chartType.equalsIgnoreCase("pie")) {
  
  
  
                  pieModel = new PieChartModel();
  
  
                  for (int x = 0; x &lt; resList.size(); x++) {
  
                          pieModel.set(languageMap.get(Integer.parseInt(resList.get(x).getCriteria())), Integer
                                  .parseInt(resList.get(x).getNoOfPersons()));
  
                  }
  
          }
          ChartsRendering chartRenderer1 = (ChartsRendering) FacesContext
                  .getCurrentInstance().getExternalContext().getSessionMap()
                  .get("chartsRendering");
  
  
          if (chartType.equalsIgnoreCase("bar")) {
              chartRenderer1.showBarChart();
  
          } else if (chartType.equalsIgnoreCase("line"))
              chartRenderer1.showLineChart();
          else if (chartType.equalsIgnoreCase("column"))
              chartRenderer1.showColumnChart();
          else if (chartType.equalsIgnoreCase("pie"))
              chartRenderer1.showPieChart();
  
      }
  </code></pre>