Question

I am trying to implement the sample bubble chart into my code as a test before I later on connect it with the database involved. The following is my chartBean.java code:

package jsf;


import java.io.Serializable;
import javax.enterprise.context.Dependent;
import javax.faces.bean.ManagedBean;
import org.primefaces.model.chart.BubbleChartModel;
import org.primefaces.model.chart.BubbleChartSeries;

/**
 *
 * @author AOL
 */
@ManagedBean(name = "chartBean")
@Dependent

public class ChartBean implements Serializable { 

    private BubbleChartModel bubbleModel;

    public ChartBean() {
        createBubbleModel();
    }

    private void createBubbleModel() {
        bubbleModel = new BubbleChartModel();

        bubbleModel.add(new BubbleChartSeries("Acura", 70, 183,55));
        bubbleModel.add(new BubbleChartSeries("Alfa Romeo", 45, 92, 36));
        bubbleModel.add(new BubbleChartSeries("AM General", 24, 104, 40));
        bubbleModel.add(new BubbleChartSeries("Bugatti", 50, 123, 60));
        bubbleModel.add(new BubbleChartSeries("BMW", 15, 89, 25));
        bubbleModel.add(new BubbleChartSeries("Audi", 40, 180, 80));
        bubbleModel.add(new BubbleChartSeries("Aston Martin", 70, 70, 48));
    }
}

I then have some standard database stuff that works fine, lets me do the usual CRUD stuff.

This is the code included in the webpage to try and create the bubble chart:

<h:form>
    <p:bubbleChart id="sample" value="#{chartBean.bubbleModel}" xaxisLabel="Price" yaxisLabel="Labels"
                title="Sample Bubble Chart" style="width:400px;height:300px" />
</h:form>

When I try to access the page without that code it works fine, however, when I add in that line it returns the following error:

/template.xhtml @45,84 value="#{chartBean.bubbleModel}": The class 'jsf.ChartBean' does not have the property 'bubbleModel'.

Was it helpful?

Solution

You have to implement a method that returns the field "bubbleModel". public BubbleChartModel getBubbleModel(){ return bubbleModel; }

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top