-
FEATURED COMPONENTS
First time here? Check out the FAQ!
1 | initial version | |
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!");
}
}
}
2 | No.2 Revision |
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!");
}
}
}
3 | No.3 Revision |
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!");
}
}
}
4 | No.4 Revision |
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!");
}
}