Skip to main content



      Home
Home » Eclipse Projects » Eclipse Scout » How to clear a chart and reset its data
How to clear a chart and reset its data [message #1871877] Mon, 14 October 2024 15:32 Go to next message
Eclipse UserFriend
Hi there everyone,

I have some charts on a form that I'm trying to clear if there is no data to be passed to the chart so that the chart does not retain the data from the previous dataset.

This is the chart field

        @Order(50)
        public class AgeRangeOfVisitorsChartField extends AbstractChartField<IChart> {
          @Override
          protected int getConfiguredGridH() {
            return 10;
          }

          @Override
          protected byte getConfiguredLabelPosition() {
            return LABEL_POSITION_TOP;
          }

          public class Chart extends AbstractChart {
            @Override
            protected IChartConfig getConfiguredConfig() {
              return super.getConfiguredConfig().withType(IChartType.BAR).withLegendDisplay(false)
                  .withTransparent(true).withColorScheme(ColorScheme.ALTERNATIVE);
            }
          }
        }


I've tried the following:

    getVisitsBox().getFieldByClass(AgeRangeOfVisitorsChartField.class).getChart()
        .setData(new ChartData());

    getVisitsBox().getFieldByClass(AgeRangeOfVisitorsChartField.class).getChart().reinit();

    getVisitsBox().getFieldByClass(AgeRangeOfVisitorsChartField.class).reinit();



But nothing seems to work.

Can anyone please show me how to clear/reset a chart?

Thanks a million,

JD

[Updated on: Tue, 15 October 2024 03:47] by Moderator

Re: How to clear a chart and reset its data [message #1872024 is a reply to message #1871877] Fri, 18 October 2024 02:39 Go to previous message
Eclipse UserFriend
Unfortunately, resetting a chart by applying an empty ChartData seems not to be supported by the Chart widget. However, you should be able to achieve the desired effect by applying a ChartData with a single data set with all values set to 0. Otherwise, you could simply replace the entire ChartField using removeField() and addField() on the group box.

Beat
Previous Topic:Scout XA Transactions with MariaDB Cluster
Next Topic:How to remove cancel button to stop transaction
Goto Forum:
  


Current Time: Wed Jun 18 18:22:37 EDT 2025

Powered by FUDForum. Page generated in 0.05504 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top