Visualization Failing?

I’m trying to get VisualizationForVaadin Add-On working. I have the gwt-visualization 1.1.0, but I’m not getting compile issues.

The issue is when it makes the call to google for the chart, it comes back with nothing. I looked at the URL and tried doing it manually, but even that fails.

Any ides?

Thanks.

Could you post your code so we can take a look, would make it a bit easier.
Regards Phil

Sure Phil. Thanks again for the help. I didn’t do any other configuration changes besides including the jar files for the addon and the visualization from GWT.

The one thing that I still need to do is see what the debug is showing, but it really looked like nothing was coming back.

I built my own navigation framework (that once I get driven by a database, I’ll probably post to the add-on section). That works fine. The displayLayout is the main VerticalLayout. The buildDisplay is the method which all children are required to implement in order to function within the framework.

	public VerticalLayout buildDisplay() {
		displayLayout.removeAllComponents();
		displayLayout.setSizeFull();
		
		p.removeAllComponents();
		p.setSizeFull();
		p.setScrollable(true);
		
	
		timeTrack.clear();
		monthList.clear();
		
		if (this.toDisplay instanceof ProjectList )
		{
			displayLayout.addComponent(p);
			projects = (ProjectList)toDisplay;
			for (Project p:projects)
			{
				VersionList versions = p.getVersions();
				for (VersionInfo v: versions)
				{
					Metric m = v.getMetric();
					Date d = m.getReportDispatched();
					if (d == null) continue;
					Calendar c = Calendar.getInstance();
					c.setTime(d);
					String month = c.get(Calendar.MONTH)+"-"+c.get(Calendar.YEAR);
					
					int index = monthList.indexOf(month);
					if (index >= 0)
					{
						TotalTime t = timeTrack.get(index);
						t.add(m);
					}
					else 
					{
					
						monthList.add(month);
						Collections.sort(monthList);
						index = monthList.indexOf(month);
						TotalTime t = new TotalTime();
						t.add(m);
						timeTrack.add(index, t);
					}																							
				}
			}

			BarChart chart = new BarChart();
			chart.setSizeFull();
			chart.addBar("Hours");
			chart.setCaption("Average Number of Hours");
			chart.addXAxisLabel("Hours");
			for (String s: monthList)
			{
				TotalTime t = timeTrack.get(monthList.indexOf(s));
				chart.add(s,new double[] {t.average()});
				
			}
			p.addComponent(chart);
			displayLayout.addComponent(button);
		}
		else
		{
			displayLayout.addComponent(new Label("no projects"));
		}
		return displayLayout;
	}

Thanks again for the assistance.

As an FYI: the arraylist of months and data is being populated correctly. I tested that out with some system.out calls

Sorry for the late reply :frowning:
This almost always relates to some layout issues, so maybe the Vaadin people will comment (I can never figure out setsizefull anyway). If you see the following code you see how setting size affects the display (I didnt see any size setting in your code)

package com.example.vaadinstuff;

import org.vaadin.vaadinvisualizations.BarChart;

import com.vaadin.Application;
import com.vaadin.ui.*;

public class VaadinstuffApplication extends Application {
	@Override
	public void init() {
		Window mainWindow = new Window("Vaadinstuff Application");
		mainWindow.setSizeFull();
		
		Label label = new Label("Hello Vaadin user");
		mainWindow.addComponent(label);
		VerticalLayout vl = new VerticalLayout();
		vl.setSizeFull();
		//vl.setHeight("300px");
		
		BarChart bc = new BarChart();	
		bc.setOption("is3D", true);	
			
		bc.addXAxisLabel("Year");	
		bc.addBar("Expenses");	
		bc.addBar("Sales");	
		bc.add("2004", new double[]{100,200});	
		bc.add("2005", new double[]{75,100});	
		bc.add("2006", new double[]{32,234});	
		bc.add("2007", new double[]{25,2534});	
		bc.add("2008", new double[]{2343,12});	
		bc.setSizeFull();
		vl.addComponent(bc);
		
		mainWindow.addComponent(vl);
		
		
		
		setMainWindow(mainWindow);
	}

}

Gives

Sub errors >>
Vaadin DEBUG
- Window/de81d48 "Vaadinstuff Application" (height: RELATIVE, 100.0 %)
  - VerticalLayout/1901b54e (height: UNDEFINED)
    - VerticalLayout/602d6b76 (height: RELATIVE, 100.0 %)
      - BarChart/45ea414e (height: RELATIVE, 100.0 %)
Layout problem detected: Component with relative height inside a VerticalLayout with no height defined.
Relative sizes were replaced by undefined sizes, components may not render as expected.

<< Sub erros

However uncomment the line

//vl.setHeight("300px"); and the chart is displayed

Regards Phil

Phil:
Thanks for the reply.

The odd thing is, deubg isn’t showing any issues at all with the layout when I look at debug information. I am also seeing the caption of the bar graph.

I also put the sample code into the applicaiton and it worked fine, so I’m guessing my issue is not a connectivity problem with google or something like that.

What would happen if there is no data to actually display in the chart?

My next step is to put the test data in the actual rendering rather than my real data.

Again, thanks for the help.


EDIT:
Well, I seemed to have fixed it… It looks like it is an ordering of calls problem. If addBar call occurs before the addXAxisLabel method, the chart will not display. I’m not sure why that would be an issue, but after I got it working (I made a couple of other changes), I flipped those two calls again and it failed. I flipped it back and it worked fine.

So much for thinking the sample was duplicated correctly (i didn’t do a direct copy because I was adding business logic in it so I just kind of took it in pieces).

Is this something that is documented somehwere that I should have read? :wink: