Menu

Problem with Highcharts 1.7

2016-02-29
2016-03-01
  • Bruno Bravo

    Bruno Bravo - 2016-02-29

    Hi there,

    Recently we upgraded the GWT Highcharts lib from 1.4 to 1.7. Everything was working fine except that now we found a problem with the series chart. I'll tell the steps that create the problem:

    1) I open the page: The column chart is shown on the screen with two columns.

    2) I Apply a filter available on the screen. Now we have the same graph with just one column. That's perfect.

    3) I click in the "Maximize" button (button of my app): the graph is removed from one panel and added to a new panel. Now the graph shows the original two columns. That is a error, with GWT Highcharts 1.4 it keeps just one column. Besides showing the original two columns the second column losts the category label, the chart shows "1" instead of "Company2". I do not know where this number came from, if we had more points in the graph it shows 1, 2, 3 ...

    I guess It may be a problem with the remove point method since in Step 2 when a user apply a filter we remove all points from the chart and add new points, after all we redraw the chart. So, How is it possible to the graph to show the removed points again when changing the graph from one container panel to another?

    We are using a Persistent chart and we've tried to remove the points using the Series method "removePoint" and the method "remove" from the class Point. In both cases we face the problem.

     

    Last edit: Bruno Bravo 2016-02-29
  • Bruno Bravo

    Bruno Bravo - 2016-03-01

    I spent some hours analysing the source code and what I think now the problem is in the method "convertSeriesToJSON" of class "BaseChart.java":

    protected JSONObject convertSeriesToJSON(Series series) {
        JSONObject seriesOptions = series.getOptions();
        if (seriesOptions == null) {
            seriesOptions = new JSONObject();
        }
        JSONValue dataValue = seriesOptions.get("data");
        if (dataValue == null || dataValue.isArray() == null) {
            seriesOptions.put("data", new JSONArray());
        }
        copyPointsToJSONArray(series.getPoints(), (JSONArray) seriesOptions.get("data"), series.getType());
        return seriesOptions;
    }
    

    The array returned by "seriesOptions.get("data")" returns data of points that were removed. So, when a detach the chart from one panel and attach in another the points that have user data are rendered on the chart.

    I can change my application to fix it but I would like to understand why it is happening in the newer versions.

     

    Last edit: Bruno Bravo 2016-03-01

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.