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

updating the chart type, duplicates the series

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Normal Normal
    • 3.0.2
    • 2.1.1
    • Security Level: Jimmy

      run the attached example (chart-change-type.zul) and toggle the chart type:

      with every update the chart data is appended again (below extracts from the AJAX responses from the server to the browser)

      initial rendering:

      plotData:{"chart":{},"series":[{"data":[4,7],"name":"Claim"}]
      

      after changing type to "bar":

      plotData:{"chart":{"type":"bar"},"series":[{"data":[4,7,4,7],"name":"Claim"}]
      

      after changing type back to "line":

      plotData:{"chart":{"type":"line"},"series":[{"data":[4,7,4,7,4,7],"name":"Claim"}]
      

      WORKAROUND:

      // WORKAROUND 1 - reset the same model
      ChartsModel oldModel = mychart.getModel();
      mychart.setModel(new DefaultCategoryModel());
      mychart.setModel(oldModel);
      
      // WORKAROUND 2 - replace with a new model
      mychart.setModel(createModel());
      

            rudyhuang rudyhuang
            cor3000 cor3000
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 3 hours
                3h