kurtomerfaruk / wicked-charts

Automatically exported from code.google.com/p/wicked-charts
0 stars 0 forks source link

ZKoss implementation #54

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi there,
many thanks for such a great HighCharts Wrapper. With 10 lines of code I 
managed to use it with the ZK framework together, maybe you can include this in 
further releases? 

package testing;

import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.util.Clients;

import com.googlecode.wickedcharts.highcharts.jackson.JsonRenderer;
import com.googlecode.wickedcharts.highcharts.options.Options;

public class ZKWicketChart extends Options
{
    public void renderToComponent(final Component target)
    {
        getChartOptions().setRenderTo(target.getUuid());

        final JsonRenderer jsonRenderer = new JsonRenderer();
        final String json = jsonRenderer.toJson(this);

        Clients.evalJavaScript("new Highcharts.Chart(" + json + ");");
    }
}

Original issue reported on code.google.com by maximili...@googlemail.com on 5 Nov 2013 at 2:02

GoogleCodeExporter commented 9 years ago
Hi,

thanks for sharing this idea. Since I don't know ZKoss, could you please 
explain the advantages of combining it with Wicked Charts? What does the line 
Clients.evalJavaScript() do?

Regards,
Tom

Original comment by tom.homb...@gmail.com on 5 Nov 2013 at 8:20

GoogleCodeExporter commented 9 years ago
Hey,
the ZKoss framework (see http://www.zkoss.org) is a very common javascript 
framework to create web applications based on Java. 

Unfortunately the charts section (see http://www.zkoss.org/zkdemo/chart) 
doesn't offer anything I would like to put on my companies frontends. Therefor 
we got a Highcharts license and were looking for a java wrapper, yours actually 
fits perfectly. 

The mentioned line executes javascript code in the clients browser window. In 
this case I create a new highcharts object. A component in ZK is a very basic 
html element which for example is responsible for setting the unique ID (see 
http://www.zkoss.org/javadoc/latest/zk/org/zkoss/zk/ui/Component.html). I 
combined that with setting the chartOptions.setRenderTo so that the final 
Highcharts object will use the given component. 

Cheers,
Max

Original comment by maximili...@googlemail.com on 11 Nov 2013 at 7:00

GoogleCodeExporter commented 9 years ago
moved issue to github at https://github.com/thombergs/wicked-charts/issues/21

Original comment by tom.homb...@gmail.com on 21 Apr 2014 at 12:02