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

updating the chart type, duplicates the series

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: 2.1.1
    • Fix Version/s: 3.0.2
    • Security Level: Jimmy
    • Labels:

      Description

      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());
      

        Activity

        There are no comments yet on this issue.

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

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