Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Google Visualization API(need help)
Google Visualization API [message #650858] Wed, 26 January 2011 22:23 Go to next message
Alexander Maurer is currently offline Alexander MaurerFriend
Messages: 2
Registered: January 2011
Junior Member
Hi guys,

I am fairly new to RAP and I am totally stuck right now and need your help.
want to draw some graphs with the google visualisation api widget for RAP but it just doesn't work for me.

I downloaded it, added it to dependencies etc. but when I want to draw e.g. a Line chart in my View according to the JavaDoc of it, I see nothing, only the empty window in my application.

	public void createPartControl(Composite parent) {
		GridData gridData = new GridData();
		GridLayout layout = new GridLayout(2, false);
		layout.marginHeight = 5;
		layout.marginWidth = 5;
		layout.marginLeft = 5;
		layout.marginRight = 5;	
		layout.marginTop = 5;
		layout.marginBottom = 5;
		layout.horizontalSpacing = 5;
		parent.setLayout(layout);

		JSONGoogleDataTable dataTable = new JSONGoogleDataTable();
		dataTable.addColumn("Month", "Month", "string", null);
		dataTable.addColumn("Provider1", "Provider 1", "number", null);
		dataTable.addColumn("Provider2", "Provider 2", "number", null);
		dataTable.addColumn("Provider3", "Provider 3", "number", null);
		dataTable.addRow(new Object[] {"May", 10, 15, 20});
		dataTable.addRow(new Object[] {"June", 12, 23, 33});
		dataTable.addRow(new Object[] {"July", 11, 25, 50});
		String widgetData = dataTable.toString();
		LineChart lineChart = new LineChart( parent, SWT.NONE );
		lineChart.setWidgetOptions("{width: 300, height: 300}");
		lineChart.setWidgetData(widgetData);
//		gridData = new GridData(300, 300);
		gridData = new GridData( SWT.FILL, SWT.FILL, true, true ); 
		lineChart.setLayoutData(gridData);
		


Ok, so I add the first part of the code to my view, I think it's ok so far, but there is also something about log and events in the second part, and I don't know at all where I have to put that or what I have to do with it.

    public void handleEvent(Event event) {
    log.info("Event: " + event);
    VisualizationWidget widget = (VisualizationWidget)event.widget;
    log.info( "Selected item=" + widget.getSelectedItem() + 
        "; row=" + widget.getSelectedRow() +
        "; column=" + widget.getSelectedColumn() +
        "; value=" + widget.getSelectedValue());


Would be really great if someone could give me some advice, it's kinda hard to get starting without any indepth tutorials or examplecode Sad

thx
Re: Google Visualization API [message #651126 is a reply to message #650858] Thu, 27 January 2011 21:56 Go to previous message
Austin Riddle is currently offline Austin RiddleFriend
Messages: 128
Registered: July 2009
Senior Member
Hi Alexander,

Have you tried to run the demo application that is also there in the incubator? It has sample code for all the widgets.

It looks like some of the widget javadocs may need some updating as well.

The thing I notice right away from your code is the use of the custom options to set the width. One of the nice things about the current implementation is that it handles the size for you. So you don't need to set the width and height only any other custom options...but without the braces {}. If you don't set any custom options then it will probably show up.
Previous Topic:Missing Icons/Images in ISharedImages ?
Next Topic:file upload widget - filter files
Goto Forum:
  


Current Time: Sat Apr 20 00:30:03 GMT 2024

Powered by FUDForum. Page generated in 0.03148 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top