tag:blogger.com,1999:blog-1661517518925762010.post7678089641841548255..comments2023-11-30T22:48:28.111-08:00Comments on Java-Buddy: JavaFX 2: Update StackedBarChart dynamically, with TableView.Erikhttp://www.blogger.com/profile/04983894331825656853noreply@blogger.comBlogger5125tag:blogger.com,1999:blog-1661517518925762010.post-74181538891075469362014-10-09T09:43:26.630-07:002014-10-09T09:43:26.630-07:00There's way way too much code in this for what...There's way way too much code in this for what you are trying to achieve. First of all, you can use a TextFieldTableCell instead of your home-grown TableCell implementation. If you additionally use the JavaFX Properties pattern correctly (i.e. put the proper xxxProperty() methods in your Record class), then you can completely eliminate all the wiring between the cell editor and the data.<br /><br />Additionally, if you use Tomas Mikula's excellent EasyBind framework (https://github.com/TomasMikula/EasyBind) (this is scheduled to be part of JavaFX in Java 9) then you can simply use EasyBind.map(...) to create the XYChart.Data lists from the list used for the table, and you can eliminate the MyList class and all the "updating by hand".Unknownhttps://www.blogger.com/profile/16541095203418002954noreply@blogger.comtag:blogger.com,1999:blog-1661517518925762010.post-80736998119067890202014-10-09T01:54:20.087-07:002014-10-09T01:54:20.087-07:00I am not sure why the stackedbarchart is not updat...I am not sure why the stackedbarchart is not updated properly when i try it. I'm using JRE 1.8.0_20Aspriushttps://www.blogger.com/profile/04173197705367712813noreply@blogger.comtag:blogger.com,1999:blog-1661517518925762010.post-42950775144060004382014-06-26T08:30:15.455-07:002014-06-26T08:30:15.455-07:00This code doesn't work adds bars with a gap in...This code doesn't work adds bars with a gap in the middle<br />Anonymoushttps://www.blogger.com/profile/11342531173454924528noreply@blogger.comtag:blogger.com,1999:blog-1661517518925762010.post-69424217155966946162013-03-04T06:19:42.481-08:002013-03-04T06:19:42.481-08:00The main problem is I want the "series"...The main problem is I want the "series" to be Dynamic.For e.g in my proposed Systwm if the user select location then let say 7 series should be generated ,if he selects "sub - practice" then 5 series have to be generated and then i should be able to populate this series via SQL I have done something very similar using pie and bar but i can't figure out this oneandyhttps://www.blogger.com/profile/12960198106366382903noreply@blogger.comtag:blogger.com,1999:blog-1661517518925762010.post-12746599769706388182013-03-04T06:05:31.748-08:002013-03-04T06:05:31.748-08:00n the below example i have 3 series Region 1,2 &am...n the below example i have 3 series Region 1,2 & 3.. i want these series also to be dyanamic what ive done is used a mysql query using the DISTINCT CLAUSE got all the values of the attribute now depending on how many distinct values i have i ned that many Series. n then the values for these Series again needs an invocation of the Mysql query.<br /><br />public class StackedBarChartSmple extends Application {<br /><br />private void init(Stage primaryStage) {<br /> Group root = new Group();<br /> primaryStage.setScene(new Scene(root));<br /> String[] years = {"2007", "2008", "2009"};<br /> CategoryAxis xAxis = CategoryAxisBuilder.create()<br /> .categories(FXCollections.observableArrayList(years)).build();<br /> NumberAxis yAxis = NumberAxisBuilder.create()<br /> .label("Units Sold")<br /> .lowerBound(0.0d)<br /> .upperBound(10000.0d)<br /> .tickUnit(1000.0d).build();<br /> ObservableList barChartData = FXCollections.observableArrayList(<br /> new StackedBarChart.Series("Region 1", FXCollections.observableArrayList(<br /> new StackedBarChart.Data(years[0], 567d),<br /> new StackedBarChart.Data(years[1], 1292d),<br /> new StackedBarChart.Data(years[2], 1292d)<br /> )),<br /> new StackedBarChart.Series("Region 2", FXCollections.observableArrayList(<br /> new StackedBarChart.Data(years[0], 956),<br /> new StackedBarChart.Data(years[1], 1665),<br /> new StackedBarChart.Data(years[2], 2559)<br /> )),<br /> new StackedBarChart.Series("Region 3", FXCollections.observableArrayList(<br /> new StackedBarChart.Data(years[0], 1154),<br /> new StackedBarChart.Data(years[1], 1927),<br /> new StackedBarChart.Data(years[2], 2774)<br /> ))<br /> );<br /><br /> StackedBarChart chart = new StackedBarChart(xAxis, yAxis, barChartData, 25.0d);<br /> root.getChildren().add(chart);<br />}<br /><br />@Override public void start(Stage primaryStage) throws Exception {<br /> init(primaryStage);<br /> primaryStage.show();<br />}<br />public static void main(String[] args) { launch(args); }<br />}andyhttps://www.blogger.com/profile/12960198106366382903noreply@blogger.com