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

    • Icon: Bug Bug
    • Resolution: Invalid
    • Icon: Major Major
    • 7.2.1.1
    • 3.0.3
    • Security Level: Jimmy
    • None

      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 } }"));
      

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

              Created:
              Updated:
              Resolved: