Skip to main content

jmaki charting in GWT: How to define Y-Axis labels?

6 replies [Last post]
lores
Offline
Joined: 2008-01-28

We are creating a GWT based Web User Interface where we need to display some simple charts. I found and successfully set up jmaki within gwt, but i do have some questions.

I was able to create simple pie/bar/line charts (starting with this document: https://ajax.dev.java.net/gwt-charting.html), but it seems that the api within GWT is extremely limited. Is it a "Hey, look, it's possible!" library or is it going to get enhanced soon?

I'm happy with the limited selection of colour models for the moment, but i would like to be able to add proper y-axis labels and horizontal lines so that the user is actually able to 'read' the data. In a next step it would also be nice to be able to define font size, colors etc.

As mentioned, this library looks promising, it just doesn't look very complete.

Also, i do get error messages - as i said, the code works nevertheless, it just doesn't seem proper. Thank you for any comments on the state of this project.

Reto
----------------------
The development shell servlet received a request for 'resources/config.json' in module 'foo.bar.EntryPoint'
[WARN] Resource not found: resources/config.json
----------------------
java.lang.NegativeArraySizeException
at com.google.gwt.dev.shell.ie.SwtOleGlue.extractStringFromOleCharPtr(SwtOleGlue.java:93)
at com.google.gwt.dev.shell.ie.SwtOleGlue.extractStringArrayFromOleCharPtrPtr(SwtOleGlue.java:79)
at com.google.gwt.dev.shell.ie.IDispatchImpl.GetIDsOfNames(IDispatchImpl.java:268)
at com.google.gwt.dev.shell.ie.IDispatchImpl.method5(IDispatchImpl.java:192)
at org.eclipse.swt.internal.ole.win32.COMObject.callback5(COMObject.java:108)
at org.eclipse.swt.internal.ole.win32.COM.VtblCall(Native Method)
at org.eclipse.swt.internal.ole.win32.IDispatch.Invoke(IDispatch.java:64)
at org.eclipse.swt.ole.win32.OleAutomation.invoke(OleAutomation.java:493)
at org.eclipse.swt.ole.win32.OleAutomation.invoke(OleAutomation.java:417)
at com.google.gwt.dev.shell.ie.ModuleSpaceIE6.doInvokeOnWindow(ModuleSpaceIE6.java:63)
at com.google.gwt.dev.shell.ie.ModuleSpaceIE6.doInvoke(ModuleSpaceIE6.java:150)
at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:468)
at com.google.gwt.dev.shell.ModuleSpace.invokeNativeVoid(ModuleSpace.java:270)
at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:137)
at jmaki.charting.client.PieChart._addDataSet(PieChart.java:47)
at jmaki.charting.client.JMakiChart.loadComplete(JMakiChart.java:221)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.gwt.dev.shell.ie.IDispatchImpl.callMethod(IDispatchImpl.java:126)
at com.google.gwt.dev.shell.ie.IDispatchProxy.invoke(IDispatchProxy.java:150)
at com.google.gwt.dev.shell.ie.IDispatchImpl.Invoke(IDispatchImpl.java:293)
at com.google.gwt.dev.shell.ie.IDispatchImpl.method6(IDispatchImpl.java:196)
at org.eclipse.swt.internal.ole.win32.COMObject.callback6(COMObject.java:117)
at org.eclipse.swt.internal.ole.win32.COM.VtblCall(Native Method)
at org.eclipse.swt.internal.ole.win32.IDispatch.Invoke(IDispatch.java:64)
at org.eclipse.swt.ole.win32.OleAutomation.invoke(OleAutomation.java:493)
at org.eclipse.swt.ole.win32.OleAutomation.invoke(OleAutomation.java:417)
at com.google.gwt.dev.shell.ie.ModuleSpaceIE6.doInvokeOnWindow(ModuleSpaceIE6.java:63)
at com.google.gwt.dev.shell.ie.ModuleSpaceIE6.doInvoke(ModuleSpaceIE6.java:150)
at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:468)
at com.google.gwt.dev.shell.ModuleSpace.invokeNativeVoid(ModuleSpace.java:270)
at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:137)
at jmaki.charting.client.JMakiChart.initJS(JMakiChart.java:466)
at jmaki.charting.client.JMakiChart.onLoad(JMakiChart.java:205)
at com.google.gwt.user.client.ui.Widget.onAttach(Widget.java:118)
at com.google.gwt.user.client.ui.Panel.doAttachChildren(Panel.java:162)
at com.google.gwt.user.client.ui.Widget.onAttach(Widget.java:113)
at com.google.gwt.user.client.ui.Panel.doAttachChildren(Panel.java:162)
at com.google.gwt.user.client.ui.Widget.onAttach(Widget.java:113)
at com.google.gwt.user.client.ui.Panel.doAttachChildren(Panel.java:162)
at com.google.gwt.user.client.ui.Widget.onAttach(Widget.java:113)
at com.google.gwt.user.client.ui.Composite.onAttach(Composite.java:97)
at com.google.gwt.user.client.ui.Widget.setParent(Widget.java:241)
at com.google.gwt.user.client.ui.Panel.adopt(Panel.java:119)
at com.google.gwt.user.client.ui.ComplexPanel.add(ComplexPanel.java:85)
at com.google.gwt.user.client.ui.VerticalPanel.add(VerticalPanel.java:52)
at ch.bitforge.eventguide.web.client.EventGuide.switchView(EventGuide.java:136)
at ch.bitforge.eventguide.web.client.EventGuide.onModuleLoad(EventGuide.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:342)
at com.google.gwt.dev.shell.BrowserWidget.attachModuleSpace(BrowserWidget.java:326)
at com.google.gwt.dev.shell.ie.BrowserWidgetIE6.access$200(BrowserWidgetIE6.java:36)
at com.google.gwt.dev.shell.ie.BrowserWidgetIE6$External.gwtOnLoad(BrowserWidgetIE6.java:70)
at com.google.gwt.dev.shell.ie.BrowserWidgetIE6$External.invoke(BrowserWidgetIE6.java:125)
at com.google.gwt.dev.shell.ie.IDispatchImpl.Invoke(IDispatchImpl.java:293)
at com.google.gwt.dev.shell.ie.IDispatchImpl.method6(IDispatchImpl.java:196)
at org.eclipse.swt.internal.ole.win32.COMObject.callback6(COMObject.java:117)
at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:1925)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2966)
at com.google.gwt.dev.GWTShell.pumpEventLoop(GWTShell.java:689)
at com.google.gwt.dev.GWTShell.run(GWTShell.java:550)
at com.google.gwt.dev.GWTShell.main(GWTShell.java:321)

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
a_martinez
Offline
Joined: 2008-05-28

Hi,
do you have any news concerning the NegativeArraySizeException? I get this error if I click on a Tab in a TabPanel.

a_martinez

gmurray71
Offline
Joined: 2003-07-31

Hi,

Thank you for your interest in the GWT library. We tried to expose as much as the underlying library would allow.

Currently the underly library does not support labels on the X and Y Axes but I could add them. The only caveat is that we won't be able to do any rotation on the label on the y axis. Is this going to be a problem?

As for the error below I'll look into where it is occuring.

Do you have anything else you would like to do with the charts?

-G

toddmason
Offline
Joined: 2008-02-27

I would certainly be interested in seeing the Y-Axis labels added. In the interim is there a way to work around this issue?

Thanks in advance.

- Todd

gmurray71
Offline
Joined: 2003-07-31

Hi Todd,

I'll get to work on this this weekend.

It shouldn't be too much work.

-Greg

toddmason
Offline
Joined: 2008-02-27

Thanks Greg. :~)

Todd

gmurray71
Offline
Joined: 2003-07-31

Just back from getting married in Japan. I added the x and y Axes labels to the JavaScript and enabled it via the JSON loading.

You enabled them by having a title property as part of the x or y axes.

In GWT you will have to load via a external file for now. I'll try to add a Java API soon.

Example:

xAxis : {
title : 'Greg',
labels : [{ label : 'January'},
{ label : 'February'},
{ label : 'March'},
{ label : 'April'},
{ label : 'May'},
{ label : 'June'},
{ label : 'July'},
{ label : 'August'},
{ label : 'September'},
{ label : 'October'},
{ label : 'November'},
{ label : 'December'}
]
},

I will also try to enable in Java the paddingLeft, paddingBottom JavaScript args that will help give the widget more space for the labels.

Can you give the latest a try?