Menu

EventHandler don't work as expected

Andy
2013-01-22
2013-02-20
  • Andy

    Andy - 2013-01-22

    I'm working with SmartGWT 2.5 and GWT Highcharts 1.4.0 and have trouble to implement any event handler on a Chart. Through putting breakpoints to BaseChart.chartEventCallback(nativeEvent, eventType) and BaseChart.seriesEventCallback(nativeEvent, eventType) I could locate the problem that far, that the eventType which is passed is an empty string. Perhaps you could imagine where a possible mistake could result in this error/problem? I used one chart from the showcase to eliminate errors from that point, added a SeriesClickEventHandler to SeriesPlotOptions and a ClickEventHandler to the chart, and put it into a plain/empty module.

    Link to the diagramme within the showcase: http://www.moxiegroup.com/moxieapps/gwt-highcharts/showcase/#bar-basic

     
  • Andy

    Andy - 2013-01-23

    This is the code to generate the chart:

    chart = new Chart().setType(Series.Type.BAR).setChartTitleText("Historic World Population by Region")
            .setChartSubtitleText("Source: Wikipedia.org")
            .setBarPlotOptions(new BarPlotOptions().setDataLabels(new DataLabels().setEnabled(true)))
            .setLegend(new Legend().setLayout(Legend.Layout.VERTICAL).setAlign(Legend.Align.RIGHT)
            .setVerticalAlign(Legend.VerticalAlign.TOP).setX(-100).setY(100).setFloating(true)
            .setBorderWidth(1).setBackgroundColor("#FFFFFF").setShadow(true))
            .setCredits(new Credits().setEnabled(false)).setToolTip(new ToolTip()
            .setFormatter(new ToolTipFormatter() {
                                       public String format(final ToolTipData toolTipData) {
                                           return toolTipData.getSeriesName() + ": " + toolTipData.getYAsLong()
                                                   + " million";
                                       }}));
    
    chart.getXAxis().setCategories("Africa", "America", "Asia", "Europe", "Oceania");
    
    chart.getYAxis().setAxisTitle(new AxisTitle().setText("Population (millions)").setAlign(AxisTitle.Align.HIGH));
    
    chart.addSeries(chart.createSeries().setName("Year 1800").setPoints(new Number[] {107, 31, 635, 203, 2}));
    chart.addSeries(chart.createSeries().setName("Year 1900").setPoints(new Number[] {133, 156, 947, 408, 6}));
    chart.addSeries(chart.createSeries().setName("Year 2008").setPoints(new Number[] {973, 914, 4054, 732, 34}));
    
    // previous lines from the showcase
    
    chart.setClickEventHandler(new ChartClickEventHandler() {
    
                @Override
                public boolean onClick(final ChartClickEvent chartClickEvent) {
                    return false;
                }
            });
    
    chart.setSeriesPlotOptions(new SeriesPlotOptions().setSeriesClickEventHandler(new SeriesClickEventHandler() {
                    @Override
                    public boolean onClick(final SeriesClickEvent seriesClickEvent) {
                        return false;
                    }
                }));
    
     
  • Shawn Quinn

    Shawn Quinn - 2013-02-20

    You're likely being bit by the same SmartClient/Highcharts compatibility issue described in this thread:

    https://sourceforge.net/p/gwt-highcharts/discussion/general/thread/ef263126/

    A work around fix to the highstock JS file is mentioned in that thread (or you can just give the attached JS file a try if you prefer, which has that patch applied.)

    Per the following thread, the Highslide guys are aware of this issue and have implemented a fix which should be included in an upcoming release of Highcharts and Highstock.

    http://highslide.com/forum/viewtopic.php?f=9&t=24201&p=93648

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.