Google Visualization API [message #650858] |
Wed, 26 January 2011 22:23 |
Alexander Maurer 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
thx
|
|
|
|
Powered by
FUDForum. Page generated in 0.02714 seconds