syampillai / SOCharts

A wrapper around the "echarts" JavaScript library to use it as a Vaadin component.
Apache License 2.0
27 stars 11 forks source link

In a ganttchart, trying to hide the taskaxis gridlines hides the entire chart #19

Closed yusufnazir closed 1 year ago

yusufnazir commented 1 year ago

ganttChart.getTaskAxis().getGridLines(true).hide(); The moment i call this code, the chart isn't visible anymore. I went through the code, but don't see why it is hiding the chart.

yusufnazir commented 1 year ago

Ok i debugged the splitLine issue and saw the json isn't generated correctly:

  "splitLine": {
        "id": 26,
        "show": false,
      },

There is a comma before the closing bracket. Traced this back to:

public static class GridLines extends Line {

        private int interval = Integer.MIN_VALUE;

        /**
         * Constructor.
         */
        public GridLines() {
        }

        @Override
        public void encodeJSON(StringBuilder sb) {
            super.encodeJSON(sb);
            ComponentPart.addComma(sb);
            if(interval >= -1) {
                sb.append("\"interval\":");
                if(interval == -1) {
                    sb.append("\"auto\"");
                } else {
                    sb.append(interval);
                }
            }
        }

If i move the ComponentPart.addComma(sb); after the line if(interval >= -1) { then is does work.

syampillai commented 1 year ago

Thanks for reporting. I have corrected this in version 3.2.3