Uploaded image for project: 'ZK Charts'
  1. ZK Charts
  2. ZKCHARTS-126

charts _drilldownLevels set but empty after invalidate on setType()

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Normal Normal
    • 10.2.1.0
    • 7.2.2.0
    • None

      Steps to Reproduce

      run attached sample

       

      click drill section (a)

      click "change chart type" button

      click drill section (a), click the "go back" button

      Current Result

      java.util.NoSuchElementException.

      Expected Result

      no exception

      Debug Information

      Caused by invalidate during setType

       

      Charts.invalidate() line: 2530 Charts.invalidate() line: 2530 PlotData.onChange(OptionDataEvent) line: 367 Chart(Optionable).fireEvent(OptionDataEvent) line: 92 Chart(Optionable).fireEvent(EventType, String, Object, DeferredCall) line: 74 Chart(Optionable).fireEvent(EventType, PlotAttribute, Object) line: 56 Chart(Optionable).setAttr(PlotAttribute, Object, T) line: 204 Chart.setType(String) line: 1323 Charts.setType(String) line: 818 
      

       

      Invalidate contains 

      _drilldownLevels.clear()

       

      Next call to Charts.services with the Drill down command will go through:

       

      				if (_drilldownLevels == null) {
      					_drilldownLevels = new LinkedList<Series>();
      					_drilldownLevels.addFirst(evt.getSeries());
      				}
       

       

      Since drilldownLevels is not null, it doesn't go in this conditional statement.

      SInce it doesn't go in the conditional statement, the root level is never added to the drilldownLevels

      When the drill up command is triggered, drill up removes the first entry in the drilldowns

      			if (ChartsEvents.ON_PLOT_DRILL_UP.equals(cmd)) {
      				_drilldownLevels.removeFirst();
      

       At this point, the drilldowns should contain (at least)  the last drill level and the root level.

      Since the root level was never added, the _drilldownLevels is empty after this step, causing following line's 

      _drilldownLevels.getFirst();
      

      to trigger a no element exception

      Workaround

       

        1. Browser.java
          1 kB
        2. BrowserMarketShare.java
          4 kB
        3. repro.zul
          0.2 kB
        4. ReproComposer.java
          4 kB

            jumperchen jumperchen
            MDuchemin MDuchemin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: