Menu

General speed discussion

2013-10-04
2013-10-08
  • Michael Evans

    Michael Evans - 2013-10-04

    Thanks for the great library layer into Highcharts. It has been working great until I needed dynamic operations (ie. data filtering/manipulation) on large series' (± 3500 points). The time taken by the layer to convert all the points into JSON Values when a series is added, retrieved or dynamically updated is prohibitive. Is it be possible to update the data in the DOM (through the OOPHM barrier) directly without this significant overhead?

    ie. current implementation of getPoints() shows the high overhead

    public Point[] getPoints() {
            ArrayList<Point> convertedPoints = points;
            if (isRendered() && !chart.isPersistent()) {
                convertedPoints = new ArrayList<Point>();
                // After the series has been rendered, convert the live JS data series back into GWT objects
                final JavaScriptObject nativeSeries = chart.get(this.id);
                if (nativeSeries != null) {
                    JsArray<JavaScriptObject> nativePoints = nativeGetData(nativeSeries);
                    for (int i = 0; i < nativePoints.length(); i++) {
                        JavaScriptObject nativePoint = nativePoints.get(i);
                        convertedPoints.add(new Point(nativePoint));
                    }
                }
            }
            return convertedPoints.toArray(new Point[convertedPoints.size()]);
        }
    
     

    Last edit: Michael Evans 2013-10-04
  • Shawn Quinn

    Shawn Quinn - 2013-10-08

    Note that the overhead in the "getPoints()" method you show there is only needed if you want to retrieve the points from the series and have them converted back for you into GWT types after the series is rendered, which often isn't needed if you're managing the data series on your own (internally, GWT Highcharts wouldn't ever trigger that case).

    The "Series.setPoints()" method is most well optimized if you call it with numeric value arrays instead of an array of Point instances. There is still type conversion that happens in that method though. So, you certainly could avoid that all together by going at the Highcharts API (or DOM) directly. If you want to head that route GWT Highcharts does provide public "Series.getNativeSeries()" and "Chart.getNativeChart()" methods that will give you access to the raw Highcharts types that GWT Highcharts is managing.

     

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.