Page 1 of 1

GeoChart event handle

Posted: 10 Sep 2017, 10:27
by sentenced37
My controller code is following:

private GChartModel geoChart;

private void generateGeoChart() throws PersistenceBeanException, IllegalAccessException {
List<AslRegion> regionList = DaoManager.load(AslRegion.class);
GChartModelBuilder builder = new GChartModelBuilder().setChartType(GChartType.GEO)
for(AslRegion region: regionList){

geoChart = builder
.addOption("region", "IT")
.addOption("resolution", "provinces")
.addOption("backgroundColor", "white")
.addOption("datalessRegionColor", "white")
.addOption("defaultColor", "#24a4ff")
.addOption("domain", "IT")

public void onSelectRegion(SelectEvent event) {
System.out.println("onSelectRegion CLICKED");
final JsonArray value = (JsonArray) event.getObject();
if (value.size() > 0) {
final JsonElement element = value.get(0);
final String label = new ArrayList<GChartModelRow>(getChart().getRows())
new FacesMessage(FacesMessage.SEVERITY_INFO, "You have selected: " + label, null));
System.out.println("You have selected: " + label);

I was able to show map of Italy on web page but I can't handle selection event. When click on a region of Italy nothing happens.
In my xhtml page I have:
<pe:gChart value="#{homeBean.geoChart}" id="italyMap">
<f:ajax event="select" listener="#{homeBean.onSelectRegion}"/>

I also see in Javascript console the message "TypeError: b.wrapper.getChart(...) is null"

Could you help me?

Re: GeoChart event handle

Posted: 10 Sep 2017, 15:09
by Melloware
Let me investigate and see what I find out. I will get back to you.

What version of Extensions and Primefaces are you using?

Re: GeoChart event handle

Posted: 10 Sep 2017, 21:30
by sentenced37
I'm using Primefaces 6.1 and Primefaces Extensions 6.1.0. If I use Primefaces extensions 6.1.1 no map is displayed

Re: GeoChart event handle

Posted: 10 Sep 2017, 22:59
by sentenced37
A update: using instead of localhost let the map working!!! Incredible.
But now when I click on a region I see this exception: Expecting array but found object: []
I have updated gson dependency from 1.4 to the latest and everything works fine now.

Re: GeoChart event handle

Posted: 11 Sep 2017, 01:15
by Melloware
OK so I am really surpised that worked. So in PFE 6.1.1 we had to change the way charts get loaded and use a new JS. You can read the bug ticket here: ... issues/452

So now in 6.1.1 you have to manually add this script to the page because the component no longer loads it.

Code: Select all

<script src=""></script>
But is is interesting you mentioned upgrading the GSON libary helped fix an issue?

Re: GeoChart event handle

Posted: 11 Sep 2017, 15:49
by Melloware
GSON should have been 2.2.4 included with PFE 6.1. So I am not sure where the 1.4 dependency came from unless you overrode it in your own pom.xml?