Bar Chart in JavaFx - javafx

I'm new in JavaFx and i want to display a Bar Chart after choosing a date (for the SQL query) and clicking the button "display chart". I'm wondering if it is possible to display the chart in the same Tab Pane where the button is. What should i write in my button listener? Can anyone help me?
If this is possible, i want also to use the progress indicator while waiting for the result.

I'm not going to write the code for you, but I'll try to address some of the questions you raised.
I'm wondering if it is possible to display the chart in the same Tab Pane where the button is.
Yes, that seems to be what the sample image you provided is already doing.
What should i write in my button listener?
The code to fetch the chart data and display the chart. If you have trouble writing this, you should create an mcve which replicates just the specific thing which is going wrong.
If this is possible, i want also to use the progress indicator while waiting for the result.
See the sample code here, which is a "Sample for accessing a local database from JavaFX using concurrent tasks for database operations so that the UI remains responsive." The sample makes use of a progress indicator.
Aside: For future questions, you might benefit from just asking a single question in a question, providing some source code which replicates any issue you have, subdividing your problem into parts and asking a specific question on just one particular part you are having an issue with (for example displaying items in a bar chart could be a different question from asynchronously retrieving items from a database).

Related

Using WKTapGestureRecognizer in WKInterfaceTable row

I'm looking to create a table in WatchKit (watchOS 4.3) that is essentially a grid view and am using a WKInterfaceTable to try to get there. I want 2 square items per row with each triggering a segue to another interface controller.
I have the list populating and everything looks great. However, I'm stuck on the gesture handling. I have a WKTapGestureRecognizer placed in each respective group covering the desired areas, however the connected actions never get triggered on tap.
I did a quick test using the same gesture recognizer outside of a table and it worked right away.
My question is, is it possible to use a WKTapGestureRecognizer in a WKInterfaceTable row? (I haven't been able to find anything in the docs saying this isn't possible)

vis.js 2dchart correlate click event data to the main dataset

I'm still relatively new to javascript but loving vis.js. I've used the 2dchart functions to build some pretty cool stuff. My problem now is that i'm trying to make it a bit more interactive. I'm using a stacked bar graph and I want to be able to click on one of the bars and display some data to the user.
So my question is, is it possible to take the bar you've clicked on and correlate that info to your dataset.
graph2d = new vis.Graph2d(container, dataset, groups, options);
graph2d.on('click', onClick);
function onClick( event ) {
//correlate the clicked item to a dataset ID somehow
If i'm way off here i apologize. Again, i'm newer to this javascript stuff.
Thanks!
I'm the developer of the graph2d module. I'm glad you like it! Unfortunately want you want to do is not really supported at the moment. We do want to support interactivity like that in future releases but at the moment it's very busy and we can't work on new features.
Now there is a way to do this but it's sort of a hack and not user friendly at all but I'll mention it anyway. The click event gives you the x value, so the time. You can also dig into the original click event to see what element you clicked on. You can then check the class name of that item. With the time and the class name (which can be specific to a group) you can search your input data for a match and thus obtain the item that was clicked on. You can then show that in a popup or something similar.
Hope this helps! For more questions you can post an issue on our GitHub page. We try to answer them all as soon as we can.

Best Way to Display Progress Bar For Long SQL Transactions?

So I have C# function that's gathering data results and images and uploading them to the SQL Database.
What I'd like to do is create a progress bar showing the progress through this function(by like incrementing the bar 1/NumOfLoops each pass of the outer most loop).
I was hoping to just use a DIV with changing width as my progress bar, stuck in an update panel.
The issue of course is triggering the update panel to update.
Or is there a better way to go about this?
Yes, this is possible, but you may not the like the solution I link you to, because it involves using an iFrame.
Read Easy incremental status updates for long requests for details on how to use JavaScript to create an iFrame that hosts your long running process .aspx page and then have that page stream back its progress.
Note: In the example, the progress values are streamed back and reported via the text of the button, which is disabled while the long-running process does its work.

flex chat/telnet application send/receive same window in TextArea

Just wanting to know if anybody has seen an example of a telnet/chat or other console like FLEX application where you can use the same TextArea as input/ouput area.
I've been trying to modify the app at:
http://livedocs.adobe.com/flex/3/html/17_Networking_and_communications_8.html
but so far, computer says no.
All the implementations I've seen use a combination of TextInput and TextArea.
The challenge is that we'll be using this app to telnet into some old routers and we'll need to do a fair amount of copy/pasting. Based on what I've seen, it seems that I would need to point the mouse into the TextInput in order to be able to right click and paste, which is not very sleak.....
Your thoughts,
Fran
edit Just realized that I had trimmed out what was directly pertaining to the question: I was unable to find anything that used the TextArea for input and output; see the below suggestions if custom-component suggestions are ok.
The TextArea component only fires a change event whenever a user adds input. Whenever you set the text field programmatically, a change event does not fire--you could maybe use that as a way to know what is user input and console "responses" by looking for carriage-returns (\r).
I'm unsure if you have a requirement to maintain the user's input at the bottom-most line (like a console), even after the console responds with something like auto-complete. If that's the case, then something a bit more complex would have to come into play (such as remembering where the user's input started/ended) or the requirement of a single-component console needs to be reconsidered--sleek is nice, but not always necessary.

Can I suspend drawing to perform multiple successive updates in Flex?

I've written a simple calendar control to allow for selecting single days, weeks, months and so on. The simplicity comes from the fact that I don't really do any drawing myself, opting instead to create a bunch of boxes and labels to act as date cells for the calendar.
When a date or a date range is selected, I need to highlight that range. It's easily done by iterating through the cells and switching their style. [edit:] However, this seems to cause a delay during which the cells are first drawn as if the style name was blank, and then re-drawn with the correct style, despite the fact that I never explicitly set the style to null -- I alternate between "CalendarCell" and "CalendarCellSelected".
If this were Windows Forms, I'd call SuspendLayout on the parent container to make sure the controls are repainted only after I've finished the updates. What I'm looking to know is whether or not a similar solution exists for Flex. I'd like to avoid drawing the entire calendar "manually", so to speak, if that's at all possible.
edit: changed the problem description to more accurately reflect what I'm seeing.
Are you using callLater() at all?
If you use callLater() it may impove your visuals as it batches up changes until it needs to draw a frame or you force a frame draw with validateNow() or similar. It might be enough in your case.
Is your calendar control a UIComponent? Is it using the standard invalidation methods like commitProperties(), updateDisplayList(), etc?
What you might want to do is keep a private array of the cells that will have their styles changed, but then do the actual style switching in your commitProperties() override. I'm just not sure if setStyle() fires an validateNow() because the flickering is a bit surprising.
This may not be exactly what you're looking for, but David Coletta at Adobe has posted a video explaining an EventCoalescer that they use in Buzzword for deferring events that update specific areas of the app UI until the user has stopped moving the insertion point in the text, for example.
This blog post by Hans Van de Velde also has a similar solution, and actual code for it as well.

Resources