Menu

AREA_RANGE issue - problem with points converting

2016-06-16
2018-09-25
  • Adam Gzella

    Adam Gzella - 2016-06-16

    Hi. We have recently switched to gwt-highcharts 1.7 and highcharts 4.2.5.

    After a switch some arearange series stopped working. I have investigated the issue and I have found out that there is probably a bug in class BaseChart, method:
    static JSONValue addPointScalarValues(Point point, JSONObject options, Series.Type seriesType)

    There is no case for AREA_RANGE and default case is creating "x", "y" and "z" options. When you take a look into highcharts-more source code, arearange looks for options called "x", "low" and 'high". I was able to fix the problem by adding
    case AREA_RANGE: at line 2717 in BaseChart.java.

    Would you like me to contribute this fix, or would you be so kind to fix it?

    For reference or others having this issue - we didn't wanted to mantain our own version of gwt-highcharts, so while waiting for a fix, I was able to do workaround. Instead of calling
    series.setPoints(Point[], boolean)

    do conversion of point on your own and call:
    series.setPoints(JSONArray, boolean)

    Code example (convertNumberToJSONValue is taken from BaseChart)

    JSONArray array = new JSONArray();
    int i = 0;
    
    for(...) {
         JSONObject options = new JSONObject();
         options.put("x", convertNumberToJSONValue(rangeDataPoint.getTimestamp()));
         options.put("low", convertNumberToJSONValue(valueFrom));
         options.put("high", convertNumberToJSONValue(valueTo));
          array.set(i++, options);
    }
    series.setPoints(array, redraw);
    
     
  • Bruno Bravo

    Bruno Bravo - 2018-09-25

    Hi Adam Gzella,

    thanks for sharing a workaround :)

     

    Last edit: Bruno Bravo 2018-09-26

Log in to post a comment.