Hey!! is anyone familiar with the graphs and charts availability in javaFX.
i know how to create a bar graph but i have some doubts..
i'm creating a bar graph with the tutorial provided by Oracle but it is taking the values on y-axis that are provided in the program itself..so everytime you run it ,it'll display a graph with the same set of values..
But what i want is the graph should be able to read the vaues form a table in Ms access and then display the graph according to the values from table ,so that every time i run it it'll be showing the values currently in the database..
Is it possible?
Please let me know if there's a way of achieving this.There must be a way else what's the point of having these graphs and charts in javaFX if they're only going to take static values..
Please let me know..
Yes i used the same tutorial..ohk .
I have a table in ms access with 2 columns "blood group" and "no.of units".
see now the no of units in a blood bank keeps varying when a patient reuires some units of a blood group or when a hospital adds up units to it's blood bank.
so what i want is that graph should be able to read the "no.of units " from the table and display the level of each blood group accordingly.so even when the column "no of units" gets modified due to certain operation when i click on a button it should be able to display the graph with the current values of each blood group from the table..
Now can you tell how should i do it ??
I don't know what ObservableList is? can you just write a statement how to achieve it.
i know this much : i'll create a JDBC connection execute a query preparedStatement ps=con.prepare("select * from <table_name>")
// since "no of units " is the second column in table i can retrieve that value with rs.getInt(2);
now tell me what should i do in while loop so that i can add to the graph the values read from the table.
Check the javadocs of the XYChart.getData() method - it returns a list of all data series in that chart.
You'd get the updated data from the DB in the same manner as the original data. I thought you had that in place already? If not, the example code shows how to add data points to a series individually - you just need to use that in the loop handling the ResultSet.
Wait, you said "blood group" is a column. Then you would have a single row for each group, no? So you should only be adding a single data point in each iteration through your loop, precisely for the blood group that row deals with.
Ohh ohk..but can you suggest what should i use for connectivity..I mean i couldn't use Oracle ,i'm using XP and after sometimes oracle gets corrupt and uses up all my space .there was a file called "log" in one of the folders it got corrupted and it's size got 3 gb.and evry time i used to free up some space from my drive say 700bm then "log" will become 3.7 gb..so i had to remove oracle..
Then i installed ORACLE EXPRESS EDITION ,it worked finr but haven't used it for a while.
So can you tell how to connect with it ..or any other alternative which might be good.
I strongly advise to get into the habit of using column names instead of column indices, though: "rs.getString("bloodGroup"), rs.getInt("units")" instead of "rs.getString(1), rs.getInt(2)", especially if you do a "SELECT *" - which does not guarantee the order in which columns are returned. Or at least do a "SELECT bloodGroup, units from blood" - where the order of columns is guaranteed.
I don't know the first thing about Oracle, except that I would consider it stable and solid. If you're having problems with your installation, start a new topic in the Oracle or JDBC forums.
But if you use Oracle (or any other serious DB) you should use its JDBC drivers, never the JDBC/ODBC bridge. Searching for "download oracle jdbc drivers" should find those fast, and the documentation shows how to use them.