Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8699845
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T02:02:47+00:00 2026-06-13T02:02:47+00:00

I submit data and a chart has been displayed But again when I submit

  • 0

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.
For instance If I give values
Wheat=40 and Sugar=60
and submit , It will display the chart.
Now when I submit Wheat=90 and Sugar=10 , it displays nothing but the old chart remain present on the page.
Now If I refresh the page , The chart with updated values will be availabe.
How can I get rid of that problem 🙁 Please suggest a solution if any one have.

Here is my code
Chart Code

<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" />

Button Code

<h:commandButton id="btnLanguage" action="#{reportingCharts.getGraphValuesOnLanguageBasis}"
                                value="Plot Chart Language">
                                </h:commandButton>

getGraphValuesOnLanbguageBasis method

public void getGraphValuesOnLanguageBasis() {

        categoryModel = null;


            resList = (ArrayList<ChartResult>) 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 < ranks.length; a++) {

                langChart = new ChartSeries();
                if(a == 0){
                    for(int z=0;z<language.length;z++){

                        langChart.set(languageMap.get(Integer.parseInt(language[z])),0);

                    }
                    }

                String rank = "";
                boolean rankAvailable = false;
                for (int x = 0; x < 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 < resList.size(); x++) {


                    if (Integer.parseInt(resList.get(x).getRankId()) == Integer
                            .parseInt(ranks[a]) && 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 < 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();

    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T02:02:48+00:00Added an answer on June 13, 2026 at 2:02 am

    The chart won’t update itself after you change the model values but you can update it through ajax. For example if you have a chart:

    <p:barChart id="myBarChart" value=#{yourChartBean.chartModel} ..../>
    

    and a selecteOneMenu which sends new values to your backing bean, define a method which will update the model in your backing bean:

    <p:selectOneMenu id="aMenu" value="#{yourChartBean.menuValue}">
        <p:ajax event="change" update="myBarChart" listener="#{yourChartBean.refreshChart()}"/>
        <f:selectItem itemLabel="This value" itemValue="tv"/>
        <f:selectItem itemLabel="Another value" itemValue="av"/>
    </p:selectOneMenu>
    

    in this case the refreshChart() method is intended to update your chart model:

    public void refreshChart() {
        buildChart();
    } 
    
    private void buildChart() {
        chartModel = new CartesianChartModel();
    
        ChartSeries series1 = new ChartSeries();
        ...
    
        ChartSeries series2 = new ChartSeries();
        ...
    
        categoryModel.addSeries(series1);
        categoryModel.addSeries(series2);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to submit data from a form to an SQL2005 database via a
When I submit data in my form it changes abcd to \abcd\ on the
I'd like to submit data in a form, over HTTPS, without allowing the browser
In my iOS application I have made a form that should submit data into
In my sinatra app i have a form which is used to submit data
I would like to know how to submit POST data for a form using
I am using the PHP below to submit data from an html form to
I am using jquery post to submit data on server and data having json
I'm using TransactionScope to submit data in Linq to SQL. My question is, if
I'm running into the problem of users being able to submit data with '

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.