Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    FacetChart with multiple facets loses data with subsequent calls to setData

    I'm trying to implement a multi-facet pie chart whose data can be filtered with an external control - in this case a simple toggle to add/remove some records. With each toggle - and resulting call to setData - I seem to be losing some of my data. I was able to reproduce with a relatively simple test case:
    Code:
        RecordList dataList;
    
        public void onModuleLoad() {
    
            VLayout layout = new VLayout();
    
            final FacetChart chart = new FacetChart();
            chart.setFacets(new Facet("diet"), new Facet("commonName"));
            chart.setValueProperty("lifeSpan");
            chart.setChartType(ChartType.PIE);
    
            DataSource.get("animals").fetchData(null, new DSCallback() {
    
                @Override
                public void execute(DSResponse dsResponse, Object data, DSRequest dsRequest) {
                    dataList = dsResponse.getDataAsRecordList();
                    chart.setData(dsResponse.getData());
    
                }
            });
    
            IButton filter = new IButton("filter");
            IButton restore = new IButton("restore");
    
            filter.addClickHandler(new ClickHandler() {
    
                @Override
                public void onClick(ClickEvent event) {
                    Record[] matching = dataList.findAll(new AdvancedCriteria(OperatorId.AND, new Criterion[] { new Criterion("status", OperatorId.NOT_EQUAL, "Threatened") }));
                    chart.setData(matching);
    
                }
            });
            restore.addClickHandler(new ClickHandler() {
    
                @Override
                public void onClick(ClickEvent event) {
                    RecordList localData = dataList;
                    chart.setData(localData);
    
                }
            });
    
            layout.setHeight100();
            layout.setWidth100();
            chart.setHeight100();
            chart.setWidth100();
            layout.setMembers(chart, filter, restore);
            layout.draw();
        }
    With the test case above - clicking the "filter" button deletes most of the data from the chart - even though it should only remove a handful of records...and then clicking restore does nothing.
    I'm using 5.1p - and I've tried with various builds ( latest was SmartClient Version: v10.1p_2016-10-12/PowerEdition Deployment (built 2016-10-12) )


    #2
    This has been resolved in SGWT 5.1p/SC 10.1p and newer branches. The fix will be available in nightly builds dated 2016-10-28 and beyond.

    Comment

    Working...
    X