javafx - Update ObservableList with data from sorted list? -
i have followed 1 tutorial create tableview filtering. works great, code in tutorial creates new sortedlist (sorteddata) sorted data , binds comparotorproperty table view, uses observablelist data source.
sortedlist<record> sorteddata = new sortedlist<record>(filtereddata); // 4. bind sortedlist comparator tableview comparator. sorteddata.comparatorproperty().bind(tableview.comparatorproperty()); // 5. add sorted (and filtered) data table. tableview.setitems(sorteddata);
in code have pie chart , bar chart. use observablelist data sources, question ; how can bind sorteddata observablelist?
my code data piechart (and barchart) this:
(record record : dataen) { datalist.add(new piechart.data(record.getfieldmonth(), record.getfieldvalue())); }
where record class getters , setters.
so want turn observablelist<record>
observablelist<piechart.data>
, correct? can use easybind:
observablelist<piechart.data> chartdata = easybind.map(sorteddata, r -> new piechart.data(r.getfieldmonth(), r.getfieldvalue())); piechart.setdata(chartdata);
Comments
Post a Comment