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

zkcharts doesn't fire ON_PLOT_LEGEND_ITEM_CLICK for a pie chart

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Invalid
    • Affects Version/s: 3.0.3
    • Fix Version/s: 7.2.1.1
    • Security Level: Jimmy
    • Labels:
      None

      Description

      Steps to Reproduce

      1. run the code

          <div apply="org.zkoss.zkcharts.essentials.exporting.ExportComposer">
              <charts id="mychart" type="pie"/>
          </div>
      
      public class ExportComposer extends SelectorComposer<Component> {
      
      	@Wire
          private Charts mychart;
      	private static final String ON_MY_CUSTOM_ITEM = "onMyCustomItem";
          
      	private SingleValueCategoryModel model = new DefaultSingleValueCategoryModel();
      	
      	@Override
          public void doAfterCompose(Component comp) throws Exception {
              super.doAfterCompose(comp);
              model.setValue("Mine",32);
              model.setValue("Yours",12);
              model.setValue("His",20);
              model.setValue("Ours",14);
              model.setValue("Theirs",55);
             
              mychart.setModel(model);
      
              mychart.getPlotOptions().getPie().setShowInLegend(true);
               mychart.addEventListener(ChartsEvents.ON_PLOT_LEGEND_ITEM_CLICK, new EventListener<Event>() {
      
                  @Override
                  public void onEvent(Event event) throws Exception {
                      System.out.println(event);
                  }
      
              });
          }
      };
      

      2. click a legend to hide a division of a pie

      Current Result

      • nothing printed at the server-side
      • ZKCharts doesn't send any AU request

      Expected Result

      ZKCharts sends an AU request

      Debug Information

      Workaround

      handle it at client-side

      chart.getPlotOptions().getPie().addExtraAttr("point",
               new JavaScriptValue("{ events: { legendItemClick: e => false } }"));
      

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved: