Visjs / GWT

495 views
Skip to first unread message

Philippe Pithon

unread,
Jun 20, 2014, 2:57:32 AM6/20/14
to chap-link...@googlegroups.com
Hello,
I know that there is not wrapper gwt for visjs.org but I tried to integrate with JSNI
And I have this error :

Caused by: com.google.gwt.core.client.JavaScriptException: (TypeError) @test.test.client.moduletest::initWave()([]): me._toScreen is undefined at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:249) at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136) at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:571) at com.google.gwt.dev.shell.ModuleSpace.invokeNativeVoid(ModuleSpace.java:299) at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:107) at test.test.client.moduletest.initWave(moduletest.java) at test.test.client.moduletest.onModuleLoad(moduletest.java:167) ... 9 more

ideas ???

----
In gwt.xml I add :
<script  src="vis/vis.js"></script>
and copy vis in public directory

Code in GWT :

public native void initWave()/*-{
    var container = $doc.getElementById('toto');
   
    var data = [
    {id: 1, content: 'item 1', start: '2013-04-20'},
    {id: 2, content: 'item 2', start: '2013-04-14'},
    {id: 3, content: 'item 3', start: '2013-04-18'},
    {id: 4, content: 'item 4', start: '2013-04-16', end: '2013-04-19'},
    {id: 5, content: 'item 5', start: '2013-04-25'},
    {id: 6, content: 'item 6', start: '2013-04-27'}
  ];
  var options = {};
  $wnd.vis.Timeline(container, data, options);
   
   
}-*/;

Jos de Jong

unread,
Jun 20, 2014, 3:41:56 AM6/20/14
to chap-link...@googlegroups.com
You have to create a Timeline with the new keyword, like:

new $wnd.vis.Timeline(container, data, options);

Jos





--
You received this message because you are subscribed to the Google Groups "CHAP Links Library" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chap-links-libr...@googlegroups.com.
To post to this group, send email to chap-link...@googlegroups.com.
Visit this group at http://groups.google.com/group/chap-links-library.
For more options, visit https://groups.google.com/d/optout.

Philippe Pithon

unread,
Jun 20, 2014, 5:16:52 AM6/20/14
to chap-link...@googlegroups.com
Now, I have this error with insert "new" :

(Error) @test.test.client.moduletest::initWave()([]): Unknown dataType 

my code :

public native void initWave()/*-{
    var container = $doc.getElementById('toto');
   
    var data = [
    {id: 1, content: 'item 1', start: '2013-04-20'},
    {id: 2, content: 'item 2', start: '2013-04-14'},
    {id: 3, content: 'item 3', start: '2013-04-18'},
    {id: 4, content: 'item 4', start: '2013-04-16', end: '2013-04-19'},
    {id: 5, content: 'item 5', start: '2013-04-25'},
    {id: 6, content: 'item 6', start: '2013-04-27'}
  ];
  var options = {};
  new $wnd.vis.Timeline(container, data, options);
   
   
}-*/;

Philippe Pithon

unread,
Jun 20, 2014, 5:27:14 AM6/20/14
to chap-link...@googlegroups.com
If I remove data (arg null), the timeline is display ! (but with no data...)

new $wnd.vis.Timeline(container, null, options);

Ideas ?

Jos de Jong

unread,
Jun 20, 2014, 6:03:04 AM6/20/14
to chap-link...@googlegroups.com
Ehhh, that sounds logic: if you don't provide data, the Timeline will display no data.

For future discussions related to vis.js, could you please use the github issues section of vis.js? https://github.com/almende/vis/issues

Philippe Pithon

unread,
Jun 20, 2014, 6:18:11 AM6/20/14
to chap-link...@googlegroups.com
Yes, but when I put data, I have this error : 

Jos de Jong

unread,
Jun 20, 2014, 6:25:02 AM6/20/14
to chap-link...@googlegroups.com
Are you using vis.js 2.0.0? There was a fix there with correctly recognizing Array input. If I remember correctly, GWT does some non-regular things with native Arrays, that may cause this issue.


Philippe Pithon

unread,
Jun 20, 2014, 7:17:32 AM6/20/14
to chap-link...@googlegroups.com
it works with 2.0.0 !!!!

thank you very much for your quick responses!

Philippe.

Jos de Jong

unread,
Jun 20, 2014, 7:37:17 AM6/20/14
to chap-link...@googlegroups.com
ok great
Reply all
Reply to author
Forward
0 new messages