I’m trying to use Vaadin Charts on a legacy Vaadin application (6.8.12) developed on NetBeans. I have followed the instructions in
this tutorial and the both the widgetset and the overall project compile without problems. Unfortunatelly, no chart objects are portrayed in the web pages at run time; this example, for instance, does not show a thing:
protected Component getChart() {
Chart chart = new Chart(ChartType.BAR);
Configuration conf = chart.getConfiguration();
conf.setTitle("Historic World Population by Region");
conf.setSubTitle("Source: Wikipedia.org");
XAxis x = new XAxis();
x.setCategories("Africa", "America", "Asia", "Europe", "Oceania");
x.setTitle((String) null);
conf.addxAxis(x);
YAxis y = new YAxis();
y.setMin(0);
Title title = new Title("Population (millions)");
title.setVerticalAlign(VerticalAlign.HIGH);
y.setTitle(title);
conf.addyAxis(y);
Tooltip tooltip = new Tooltip();
tooltip.setFormatter("this.series.name +': '+ this.y +' millions'");
conf.setTooltip(tooltip);
PlotOptionsBar plot = new PlotOptionsBar();
plot.setDataLabels(new Labels(true));
conf.setPlotOptions(plot);
conf.setLegend(null);
conf.disableCredits();
List series = new ArrayList();
series.add(new ListSeries(107, 31, 635, 203, 2));
conf.setSeries(series);
chart.drawChart(conf);
return chart;
}
So far the only strange thing I found is this message in the debug window regarding HighCharts:
JavaScriptException: (String): Highcharts error #16:www.highcharts.com/errors/16
Processing time was 140ms for 7645 characters of JSON
Referenced paintables: 34
I’ve searched for similar errors but haven’t found anything yet.
Any hints on what may be going wrong would be helpful. Thank you.
Looking at the
error description , somehow the HighCharts is loaded twice. Just putting two charts in the same page doesn’t cause that, so I don’t know what could cause the situation. Are you embedding the Vaadin app in a page? Running in a portal?
I think his question was more aimed towards whether you are accessing the Vaadin application directly from the server (server:port/yourapp), if it is embedded in a html page (as described
here ) or if you use some type of portal service (like for example liferay).
What sounds a bit weird to me is the part with “both the widgetsets” in regards to “HighCharts is loaded twice” what Marko said but i’m neither a Charts,Highcharts nor a Netbeans expert (Not really using any of them).
Yes, that’s the way I am acessing it. The web page is not embedded.
[quote=Marius ReinwaldWhat sounds a bit weird to me is the part with “both the widgetsets” in regards to “HighCharts is loaded twice” what Marko said but i’m neither a Charts,Highcharts nor a Netbeans expert (Not really using any of them).
[/quote]
There is only one widgetset in the project, and I don’t think there should be more than one. But I’m no expert on Vaadin either
It’s hard to say what could be wrong. I don’t think it should be a NetBeans problem as such, except maybe there’s something odd in the project, like it doesn’t actually use the compiled widget set? Check the request log (with Firebug or some other tool) and see that the correct widget set and other things are loaded correctly.
Following Marko’s sugestion I went checking the http requests made by the app. There are only two that seem relevant, the widgetset and the Highcharts.js:
Why does the page include loader code for HighCharts? The Vaadin servlet does not normally add those and as far as I know, Charts loads HighCharts dynamically in the widget set. Are you maybe also using Invient Charts, which also uses HighCharts?
Hi again Marko. This project used Invient Charts at some point in the past, but it is no longer included in the library path, nor in the widgetset. But this could indeed explain the problems I’m having. I can’t find any references in the code to Invient Charts, but I don’t know exactly all the places I should look into.
I don’t know about Invient Charts installation, but it might require that the extra headers to load HighCharts are written in the Vaadin servlet or something.