Menu

PointSelectEventHandler in SmartGWT

2013-02-20
2013-02-20
  • James Callaghan

    James Callaghan - 2013-02-20

    I've got HighStock running well in my application, but I can't seem to capture PointSelectEvents. I took the following code from another post in this forum:

    public class Playground extends Canvas {
    
        public Playground() {
    
            Chart chart = new Chart().setType(Series.Type.LINE);
            Series s = chart.createSeries();
            s.addPoint(new Point("label 1", 10));
            s.addPoint(new Point("label 2", 20));
            s.addPoint(new Point("label 3", 30));
            SeriesPlotOptions options = new SeriesPlotOptions();
            options.setAllowPointSelect(true);
            options.setPointSelectEventHandler(new PointSelectEventHandler() {
               public boolean onSelect(PointSelectEvent pointSelectEvent) {
                  SC.say("selected");
                  return true;
               }
            });
            chart.setSeriesPlotOptions(options);
            chart.addSeries(s);
    
            this.addChild(chart);
        }
    
    }
    

    When I select a point in the chart, I do not get the alert. Am I doing anything obviously wrong? No errors are reported either on the JS console or in the server log. I'm using SmartGWT 3.0 and Highstock JS v1.2.5

     
  • Shawn Quinn

    Shawn Quinn - 2013-02-20

    Just tried your example out, and it looks like you're 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

     
  • James Callaghan

    James Callaghan - 2013-02-20

    That was exactly the problem. I replaced my highstock.src.js with the one you gave me and everything started to work (including the much more complicated chart I had been working on for a day or two). Thanks for your fast response.

     

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.