How to use JavaScript in ZK Charts using Java - charts

I want to know how we can write the highcharts javaScript methods in ZK charts using java. Is there any example in which i can find to write whole bunch of javaScript inside the java method??

Clients.evalJavaScript seems like what you need.

Related

How can I use Material UI in Scala JS?

My team works with Scala.js and I wanna use Material-UI. But those two's code types look very different. Most of the examples in Material-UI seem to be based on regular Javascript.
I've tried to search about that, but the information is very limited, so I couldn't get any useful information. Is there anyone using Material-UI with Scala.js?
When using most JS libraries from Scala.js, you need what is called a "facade" -- a strongly-typed Scala wrapper that describes how to use the weakly-typed JavaScript library.
There appear to be several Material UI facades, but most of them look a bit half-baked. I'd guess that the most mature is the one in Chandu's scalajs-react-components project -- in general, Chandu has done more with React in Scala.js than most folks. The general top-level page for the project can be found here.

I am confused about JSNI.How and when use of JSNI in Google web toolkit

I am new Google web toolkit.I am confused about JSNI.Why and when use of JSNI in Google web toolkit.Advantage and limitation of JSNI.Thanks in advance.
I use native Javascript code when there is no other way of coding the feature other than in Javascript. For example, there is no wrapper for XmlHttpRequest object in GWT. I could use either third-party solution if it exists, or write my own classes based on javascript-based sample code found around on the web. So, I have this native method that I can call from my pure Java code and that contains only Javascript code. JSNI allows me to share the data between these two worlds.
And after all, after permutations are compiled, both Java and JS native methods are build into Javascript.
If you want to use various Javascript libraries, then JSNI will let you to call methods as designed wrapped into your Java methods. Again, for example, you can include Modernizr.js script into your html page and then have something like this in your class:
private native boolean isCSSAnimationSupported() /*-{
return Modernizr.cssanimations;
}-*/;
I do not use native methods when there is no actual need to inject inline Javascript.
Beside the points alexp already mentioned, there is another situation, where JSNI is a very useful.
Imaging, you have several GWT applications and in case you left one and start another, you want to send some informations to the starting GWT application.
You have several possibilities to do that:
you can use URL parameters
you can use a cookie
or use an JSP and JSNI.
There fore, you use a JSP instead of a HTML as your host page. Inside this JSP you can use a JSP tag of a hidden field to carry your parameter and with JSNI you can read the parameter out of your host page.

GWT IndexedDB available or any update on this?

is there any update on GWT IndexedDB?
Here are two projects of GWT IndexedDB but i dont know if this is usefull because these two projects seem to be dead?!
http://code.google.com/p/indexeddb-gwt/
http://code.google.com/p/gwt-indexeddb/
IS it possible to use GWT IndexedDB by JSNI? Has anybody experience with it?
Would like to learn and to use IndexedDB but dont know because iam using only GWT and not JavaScript.
Please help!
You can use any pure javascript/browser functaonlity from GWT using JSNI.
If youu look at the above linked Indexdb gwt libraries they do just that. They define JSO Overlay wrappers for the corresponding javascript objects. (see here as an example).
Alternatively you could also look into the Elemental library. I am not 100% sure but it might contain wrappers for IndexDB.
So you have 4 choices:
Manually call the indexdb javascript functons using JSNI.
Write your own wrapper using JSO and JSNI
Use on of the indexdb GWT wrappers
Use Elemental library.
I used java Maps (TreeMap) package to emulate indexedDB searching functions and GWT built-in html5 storage wrapper to store data offline in browser.

How to design the header of a website in GWT without using CSS?

I need to make the header and logo (google Code and Stockwatcher) of the stockwatcher example http://code.google.com/webtoolkit/doc/1.6/tutorial/gettingstarted.html without using CSS or HTML, that is all the code should be in JAVA. Can someone tell me how to do it ?
You should be able to create Panels and place elements in them progmatatically without a problem. But if you add more details to your questions I am sure we can be more helpful.
Also, you are linking to an older version of GWT, you might be helped by using the most recent version:
http://code.google.com/webtoolkit/doc/latest/DevGuide.html
This is probably the section you are looking for:
http://code.google.com/webtoolkit/doc/latest/DevGuideUiPanels.html
But I would recommend using UiBinder where you can, instead of pure Java. It is easier and more flexible that way.
http://code.google.com/webtoolkit/doc/latest/DevGuideUiBinder.html

Looking for an interactive pie chart to use with GWT (without extern communication)?

I'm looking for a stand-alone Pie Chart which I can use in a GWT application. The Chart should be interactive, so that I can react on user input (read mouse clicks on the chart).
I've already looked at Google Chart Tools with GWT Visualization. This is exactly what I want. A simple to use PieChart class with user interaction and a simple and comprehensive data input. Except that the data is transfered to Google for the rendering part. The data should not leave the client or our server.
Have you tried Fusion Charts? Here's the Pie Chart showcase. Its a Flash object hence you will need to use JSNI to embed the object into your widget or use a library like GWT2SWF to do it for you.
I have used Fusion Charts + GWT2SWF combination in one of my products, and would recommend it to anyone looking for a interactive flash charting tool (outside of google's toolset)
A colleague of mine found following library: GChart. Rather then using Flash we'll try to draw our own. Not sure how easy this will be.
You mentioned:
"The Data should not leave the server"
With Google visualization APIs (as opposed to the chart apis) the data remains on your server, only the code is downloaded from google.
However, if you meant that you shouldnt need access to google at all, then GCharts is the only remaining and a pretty good option.
Check out GWT-RCharts hosted on http://code.google.com/p/gwt-rcharts/ . It is stand alone i.e doesn't have external dependency like Visualization. The API works on SVG/VML specification so no plugin dependency. You may find it quite easy to install, implement and use. You can find the demo at http://gwt-rcharts.appspot.com/