Revision history [back]

click to hide/show revision 1
initial version

asked 2016-04-20 13:45:37 +0800

IngoB gravatar image IngoB flag of Germany

ZK Charts: Hide Series

Hi,

i got a chart with several series and want to save the visibility state of all series. Is it possible get the state of each series after the are added to the chart?

I tried to add an eventlistener (ChartsEvents.ON_PLOT_LEGEND_ITEM_CLICK) with different methods, but all fail. It seems it's only clientside.

Is there a way to tell the Java objects, that their state has changed?

    @Override
    public void onEvent(ChartsEvent event) {
        Series series = (Series) event.getSeries();
        if (series.isVisible()) {
            System.out.println("[" + series.getName() + "] is visible!");
        } else {
            System.out.println("[" + series.getName() + "] is NOT visible!");
        }
    }
--------------------------------------------------------------------------------    
    @Override
    public void onEvent(ChartsEvent event) {
        for (int i = 0; i < myChart.getSeriesSize(); i++) {
            Series series = myChart.getSeries(i);
            if (series.isVisible()) {
                System.out.println("[" + series.getName() + "] is visible!");
            } else {
                System.out.println("[" + series.getName() + "] is NOT visible!");
            }
        }
    }

ZK Charts: Hide Series

Hi,

i got a chart with several series and want to save the visibility state of all series. Is it possible get the state of each series after the they are added to the chart?

I tried to add an eventlistener (ChartsEvents.ON_PLOT_LEGEND_ITEM_CLICK) with different methods, but all fail. It seems it's only clientside.

Is there a way to tell the Java objects, that their state has changed?

    @Override
    public void onEvent(ChartsEvent event) {
        Series series = (Series) event.getSeries();
        if (series.isVisible()) {
            System.out.println("[" + series.getName() + "] is visible!");
        } else {
            System.out.println("[" + series.getName() + "] is NOT visible!");
        }
    }
--------------------------------------------------------------------------------    
    @Override
    public void onEvent(ChartsEvent event) {
        for (int i = 0; i < myChart.getSeriesSize(); i++) {
            Series series = myChart.getSeries(i);
            if (series.isVisible()) {
                System.out.println("[" + series.getName() + "] is visible!");
            } else {
                System.out.println("[" + series.getName() + "] is NOT visible!");
            }
        }
    }

ZK Charts: Hide Series

Hi,

i got a chart with several series and want to save the visibility state of all series. Is it possible get the state of each series after they are added to the chart?

------ EDIT ------

I tried to add an eventlistener use the HIDE/SHOW Event (ChartsEvents.ON_PLOT_LEGEND_ITEM_CLICKChartsEvents.ON_PLOT_HIDE, ChartsEvents.ON_PLOT_SHOW) with different methods, which are triggered, if a series is hidden or shown.

BUT they don't work, like I would expect them to. If click on the legend and want to hide a series, the "HIDE" Event is triggered, but all fail. it still says: "... is visible!", although the opposite is true (It seems it's only clientside.hidden

Is there a way to tell the Java objects, that their state has changed?).

    @Override
    public void onEvent(ChartsEvent event) {
        Series series = (Series) event.getSeries();
        if (series.isVisible()) {
            System.out.println("[" + series.getName() + "] is visible!");
        } else {
            System.out.println("[" + series.getName() + "] is NOT visible!");
        }
    }
--------------------------------------------------------------------------------    
    @Override
    public void onEvent(ChartsEvent event) {
        for (int i = 0; i < myChart.getSeriesSize(); i++) {
            Series series = myChart.getSeries(i);
            if (series.isVisible()) {
                System.out.println("[" + series.getName() + "] is visible!");
            } else {
                System.out.println("[" + series.getName() + "] is NOT visible!");
            }
        }
    }

ZK Charts: Hide Series

Hi,

i got a chart with several series and want to save the visibility state of all series. Is it possible get the state of each series after they are added to the chart?

------ EDIT ------

I tried to use the HIDE/SHOW Event (ChartsEvents.ON_PLOT_HIDE, ChartsEvents.ON_PLOT_HIDE, ChartsEvents.ON_PLOT_SHOW) which are triggered, if a series is hidden or shown.

BUT they don't work, like I would expect them to. If click on the legend and want to hide a series, the "HIDE" Event is triggered, but it still says: "... is visible!", although the opposite is true (it's hidden).

    @Override
    public void onEvent(ChartsEvent event) {
        Series series = (Series) event.getSeries();
        if (series.isVisible()) {
            System.out.println("[" + series.getName() + "] is visible!");
        } else {
            System.out.println("[" + series.getName() + "] is NOT visible!");
        }
    }
Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More