When calling axis.setExtremes() or axis.zoom(), the associated zoom button does not become highlighted.
For example, if I programatically 'zoom' to 1-hour, I would like the '1 hour' zoom button to appear as 'pressed'.
Is there a simple way to accomplish this?
For more context: I want to make my app stately, so that if you view a graph, zoom, then navigate away from the graph and back to it again, I want to restore your 'zoom level'.
I have this basically working by listening for afterSetExtremes and storing the max/min values, and then using those to call 'zoom' on the graph when the user returns.
If there is a simpler way to accomplish this, I'd be fine with that.
Thanks for any direction!
You can also call setState on the button.
http://jsfiddle.net/W56P5/2/
chart.rangeSelector.buttons[3].setState(2);
Related
I'm looking for the most concise way to deal with focus in an application which renders a map in a canvas component. You can pan the map location using arrow keys or ASWD keys. So far, I've been giving the canvas focus at startup and handling key pressed events via canvas.setOnKeyPressed().
This works fine, but I've always known that a problem was on the horizon when other components enter the picture. Once you interact with another component, it gains focus, and you're unable to scroll around the canvas map. I can prevent this from happening with some components like Hyperlinks or Buttons (I don't need tab-navigation) with something like this for those components:
sidePanel.getChildren().forEach(node -> node.setFocusTraversable(false));
But, when we get to things like TextArea or TextField, those do need to hold focus while they're being edited. And I'll need some way to return focus back (or at least unfocus those components) without being an annoyance to the user. (I don't want to have to click the canvas for it to regain focus.)
The options I see for returning focus back to the canvas after the user is done with those fields seem to be:
Add a key handler (ex. ESC or ENTER keypress) on EACH of these components which returns focus back to the canvas.
Maybe not so concise, and a bit of a pain... also feels a bit fragile; if I miss something and the canvas loses focus, it would fail - I need a 100% reliable solution.
Extend each of these components and add similar code to return focus back to Canvas
Even nastier and requires using custom components in Scene Builder, which
is not ideal.
Add a global event handler on the Scene and transmit events to the controller which owns the canvas
I believe an event filter would accomplish this - but on the other hand if the user is simply using arrow keys to move around a TextArea, I wouldn't want the Canvas map to move!
To solve the above problem, possibly the global event handler could ignore ASWD and arrow keypresses if the focus is on certain types of components? Is this worth trying, or am I neglecting a problem this would create?
Are there any other simple options out there that I've missed - and what would you suggest as the best option here? I'd like an automatic solution that doesn't require remembering to add some workaround code every time a UI component is added.
I am creating a game in GMS2. I am using "show_message_async()" in my code. I know that when it is run, a message pops up on the screen and the game still runs in the background. However, I want the game to freeze in the background while the message pops up. Is it possible to do this? And if so how.
You should try looking up instance_deactivate_all(notme) and instance_activatie_all(notme)
https://docs.yoyogames.com/source/dadiospice/002_reference/objects%20and%20instances/instances/deactivating%20instances/index.html
This will disable all objects in a room except the object that's calling it (which should be the menu object that shows the message)
The only tricky part of it, it that it also disables drawing the objects. resulting in an empty screen. For this, you could either use a black screen, or draw a screenshot of the scene before they're disabled.
I agree with Steven's answer. To add on his answer about taking the screenshot of the game, you probably need to make a new surface, then use surface_copy from application_surface before deactivating the object.
I'm trying to find a way to override the default expand/collapse behaviour when clicking on a Group element in a VisJS Timeline.
I'd like to allow other actions from the group contents, and invoke the expand/collapse action programmatically from somewhere else in the UI.
I'm been looking into the code in the v4.21, but I don't seem to find a way to override the _onGroupClick on the ItemSet.
Any suggestions on how to achieve this in the most elegant way? (trying to avoid monkey patching)
thanks,
I've been looking for the same solution, and I found the solution just here
In my case, I just use the 'off' to disconnect the toggle from the general first cell of each row. Then I manually change the showNested property of the groups and call setGroups to open, in this way I can show the action exactly in the item I want not in the whole cell.
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.
I assume I need to override the mouse over and mouse off event so that they don't do anything and then trigger the mouse over event for each column on the graph.
Anybody got any suggestions?
What you are looking for is the property showAllDataTips for the chart to true.
This will force all the available dataTips on the chart to become visible.
I guess this should do what you are trying to get done.
The mouseover event for the graph seems a long shot but its still feasible incase you want to show data tips on some kind of interaction.
But I would suggest on mouse rollover , change showAddDataTips= true and on rollOut showAllDataTips=false .
That should do the trick.
You probably want to use data labels:
By default, BarSeries, ColumnSeries, and PieSeries objects do not
display data labels.
To enable data labels on BarSeries and
ColumnSeries objects, set the value of the labelPosition property
to inside or outside.
To enabled data labels on PieSeries, set the value of the
labelPosition property to inside, outside, callout, or
insideWithCallout.
Cheers!