PROBLEM whith VisualizationsForVaadin

Hello, I am learning to use vaadin recently.

I’m trying to use VisualizationsForVaadin and I have developed various tests (such as a few examples from other post in this same forum)

For example:


package com.example.vaadin;
import com.vaadin.Application;
import com.vaadin.ui.*;
import org.vaadin.vaadinvisualizations.PieChart;

public class MyApplication extends Application {
  @Override
    public void init() {
        Window mainWindow = new Window("Testvisualizations Application");
        mainWindow.addComponent(label);
        PieChart pc = new PieChart();
        pc.setSizeFull();
        pc.add("Work", 7);
        pc.add("Play", 3);
        pc.add("Eat", 1);
        pc.add("Sleep", 6);
        pc.add("Do Vaadin", 7);
        pc.setOption("width", 400);
        pc.setOption("height", 400);
        pc.setOption("is3D", true);
        mainWindow.addWindow(createSubWindow(pc, "Pie Chart", "536px", "436px"));
        setMainWindow(mainWindow);
    }

    private Window createSubWindow(Component component, String type, String height, String width) {
        Window subwindow = new Window("A subwindow showing " + type);
       // Configure the windws layout; by default a VerticalLayout
        VerticalLayout layout = (VerticalLayout) subwindow.getContent();
        layout.setMargin(true);
        layout.setSpacing(true);
        layout.setSizeFull();
        subwindow.setHeight(height);
        subwindow.setWidth(width);
        subwindow.addComponent(component);
         return subwindow;

    }
}

However, I see only a window with an empty content the following message :


“Widgetset does not contain implementation for org.vaadin.vaadinvisualizations.PieChart. Check its @ClientWidget mapping, widgetsets GWT module descrioption file and re-compile your widgetset. Unrendered UIDL:”

And also:

“org.vaadin.vaadinvisualizations.PieChart(NO CLIENT IMPLEMENTATION FOUND)”

:mad:

other than the library VisualizationsForVaadin i have tried with gwt-visualization-1.1.0 and gwt-visualization-1.0.3

I have done tests with both NetBeans 6.8 and Eclipse

Someone could please tell me if there is a mistake or can point me to a guide on a forum or a blog …

thank you so much

It looks like you have not compiled the widgetset so that it would contain the client side implementation for the add-on. See the
help for using add-ons (Maven, NetBeans and hopefully soon also Maven instructions)
, also linked from the
Directory
(“Help” on the left).

In this case, you should also see the required library information on
the VisualizationsForVaadin add-on page
. A comment by Michael Voigt indicates that you need gwt-visualization-1.0.3, not 1.1.0 . Other forum threads may contain more information.

Hi
Version 1.0.3 of gwt-visualization is not available. Even the “Older Releases” at http://code.google.com/p/gwt-google-apis/wiki/Downloads?tm=2 do not list 1.0.3…
I have tried 1.1.0 and 1.0.2 but the widgetset compile gives errors
Can anyone share a link for gwt-visualization-1.0.3.jar I can’t find it anywhere.

Hi i have the same problem, i cannot find this jar. And i cannot try this addon.
Some solution?
I see the demo version of thi addon is there some repository where i can download it?

There seems to be
gwt-visualization.jar
at the contrib.

Hi, I just built a new jar, using vaadin 6.5.2 and uploaded it into the add on dir, its also using the latest gwt-visualization.jar 1.1.1
All seems to be working OK when I test it here:(
Regards Phil
p.s. supports core charts areachart, barchart,columnchart, linechart, piechart,scatterchart

Hi Phil,

I am using the column chart and line chart of this addon. I have some questions or concerns around it :

  1. When ever select a data point , i get the selection event, but the object returned give “undefined”. How can we get to the exact object that is clicked

  2. Some of the GWT options does not work. For eg, if i try to say : columnChart.setOptions(“hAxis.title”, “ABC”);. This does not changes anything in the graph. But the other options like width, height, legend works.

Please provide me solutions if someone has worked on this before.

Thanks & Regards,
Abhinav

Hi, for 1, have you looked at
Vis code example
it has some examples of selections on Pie Chart and Org Chart.

  1. I havent tried all the options, I’ll try to look at this one in the near future.

Regards Phil

Hi Phil,

  1. For selection event, i have tried doing the same thing what you suggested in that code. I am not using pie charts so am not sure if that has this problem or not but specifically for line chart and column chart, i have seen that the List of selected items that is handled in the listener gives the value “undefined”.

  2. Is there any workaround to put captions on the x-axis for a column chart. And for Line chart, we don’t see the y-axis line drawn on the UI.

Your suggestions will be really helpful.

Thanks,
Abhinav

i have same question with Abhinav.
thank phil for the suggesion additionally.

Hi all,

My workaround for the above problem is replacing the convertOptions method of VVisualizationWidget class with below code. It worked for me. Now I can set hAxis and vAxis options as declared in GWT Visualization gallery pages.

hope this helps,
kinds,


/**USAGE**/
LineChart chart = new LineChart();
chart.setOption("legend", "bottom");
chart.setOption("hAxis.title", "Tarih");
chart.setOption("vAxis.title", "Voltaj");

/**REPLACE METHOD AND RECOMPILE**/
protected AbstractDrawOptions convertOptions(String[] opNames, String[]
 opTypes, Object[] opValues) {
		AbstractDrawOptions ops = createOptions();
		if (opNames == null) {
			return ops;
		}
		AbstractDrawOptions temp = null;
		for (int i = 0; i < opNames.length; i++) {
			String name = opNames[i]
;
			String type = opTypes[i]
;
			Object value = opValues[i]
;

			if (name.contains(".")) {
				int index = name.indexOf(".");
				String objName = name.substring(0, index);
				name = name.substring(index + 1);
				try {
					temp = ops.getObject(objName).cast();
				} catch (TypeException e) {
					Window.alert("exception in convertOptions");
				}
				if (temp == null) {
					temp = JavaScriptObject.createObject().cast();
					ops.set(objName, temp);
				}
			} else {
				temp = ops;
			}

			ApplicationConnection.getConsole().log("Name " + name + " Type " + type + " Value " + value);
			if (OPTYPE_BOOLEAN.equals(type)) {
				ApplicationConnection.getConsole().log("BOOL");
				temp.set(name, ((Boolean) value).booleanValue());
			} else if (OPTYPE_INT.equals(type)) {
				ApplicationConnection.getConsole().log("INT " + value.toString());
				temp.set(name, Double.valueOf(value.toString()));
			} else if (OPTYPE_DOUBLE.equals(type)) {
				ApplicationConnection.getConsole().log("DOU");
				temp.set(name, ((Double) value).doubleValue());
			} else {
				ApplicationConnection.getConsole().log("STR " + name + " " + (String) value);

				temp.set(name, (String) value);

			}
		}

		ops.set("width", (double) getElement().getClientWidth());
		ops.set("height", (double) getElement().getClientHeight());
		return ops;
	}