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:
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) )
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(); }
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) )
Comment