Highstock - zoom all by function - button

I am using Highstock. Is there any possibility to execute the zoom to All - button programmatically in Java Script? Or is there any function with the same functionality?

It is possible by catching button event and add state. You should only check index and set appropriate.
http://jsfiddle.net/jGALb/
chart.rangeSelector.buttons[4].setState(2);
chart.rangeSelector.clickButton(4,4,true);

Related

Is there a way to set a HERE UI Button to disabled?

I am using a custom-created button on my HERE Map using the JS 3.0 library.
I followed a HERE support engineer's suggestion provided here: HERE Map UI JS - How to add custom buttons to the Map UI?
So far, I have been able to get it to work just fine, but I just found out that I need to be able to enable or disable the button depending on various business rules. But it looks like there is no "setDisabled" functionality for HERE Controls or Buttons?
https://developer.here.com/documentation/maps/api_reference/H.ui.Control.html
https://developer.here.com/documentation/maps/api_reference/H.ui.base.Button.html#.State (I saw that there was the option to initialize a button to be disabled, but not to change an existing one. Seems inefficient to create a new button every time I need to enable or disable it.)
Any suggestions?
Dont use the var ui = H.ui.UI.createDefault(map, maptypes, 'en-US'); line in order to disable buttons or find your self in an "if" statment to access this when a certain button is pressed or statement is passe
There is a setDisabled() method inherited from the parent class H.ui.base.Element which you can use:
// assume custom UI control exists
customControl.setDisabled(true) // <- disables the control
customControl.setDisabled(false) // <- enables the control
Here is jsfiddle working example of custom UI control which disables itself after click.
See H.ui.Control#setDisabled() for more details.

MarkerClustererPlus: Event when marker is shown / hidden in cluster?

When using MarkerClustererPlus - I would like to hang some code on an event that is triggered when a marker that is in a cluster is shown / hidden by the markerClusterer.
MC+ Doco doesn't seem to indicate such an event.
Looking at the MC+ code it appears that the clusterer uses marker.setMap() and markers don't have a "map_changed" event.
I could add code to the clusterer to trigger an event whenever a marker.setMap is invoked but I'd rather not alter code that works so well - don't want to create a configuration management problem whenever markerClustererPlus is updated.
Any suggestions?
Shortly after posting the question, I discovered that I could hang an event on marker, 'map_changed'.
google.maps.event.addListener(myMarker, 'map_changed',
function() { do stuff });
I think this is an MVC state change event rather than an explicit marker event (i.e. it isn't defined as a marker event in the documentation).
(see Google event doco here) and Google marker event doco here
The only remaining question is - it would be nice to verify that this is an MVC state change event rather than an undocumented / unsupported marker event that could break or disappear - How can I do that?

re-draw fullCalendar on the fly

I want the fullCalendar to redraw itself (all the structure and events) without reloading the page.
Scenario:
I am using a patch of fullCalendar that supports the Resource View. For a few user actions I want to change the resources. But I don't want to reload the page.
You could 'destroy' and 'render' the calendar as a whole. But that might be cumbersome - especially in older browsers.
$('#calendar').fullCalendar('destroy');
$('#calendar').fullCalendar('render');
If you don't actually need to render the table, but just rerender the events again, you could use the 'rerenderEvents' method:
$('#calendar').fullCalendar('rerenderEvents');
Hopefully this helps!
Use refetchResources: .fullCalendar( 'refetchResources' )
This will fetch and freshly re-render the resource data, per the FullCalendar documentation.
The problem:
"...The problem is that the calendar is initialized while the modal or div is not visible... " based on this link enter link description here
In my opinion, destroy is not needed in this case, only with render you can see the calendar.
My solution:
<script type="text/javascript">
$('#objectname').show(0,onObjectShow);
function onObjectShow(){$('#calendar').fullCalendar('render');}
</script>
You must to be sure that the object(container of calendar) is fully visible. For example, my first mistake was to put this code on "onClick" event, and click event is triggered before show the object container and has no effect.
Solution Based on this reference.
You can also redraw calendar on the fly using below command-
$(window).trigger("resize");

dragging components in flex

so I am trying to drag around some images in a canvas.
I am adding eventlisteners to the components and calling startDrag() and stopDrag() to pick them up and stuff:
component.addEventListener(MouseEvent.MOUSE_DOWN, component.startDrag)
The problem is that it is selecting the image at its (0,0) location and not where I initially click on it. So there's a sudden "jump" when I click on the image. It is not smooth.
I noticed that startDrag() has two default parameters, one of them is lockCenter and it is default to false. Maybe do I set it equal to true somehow? (I don't know how to pass arguments to my second parameter in addeventlistener)
Another question: if I want to add more conditions to it, like make a new function that uses component.startDrag(), how do I pass the component to this function while adding event listener to it at the same time?
for example: I want to do:
component.addEventListener(MouseEvent.MOUSE_DOWN, some_other_function);
where some_other_function uses component.startDrag();
Thanks!
You should have your event listener call an event handler instead of start drag directly - that way you can pass arguments:
ie:
component.addEventListener(MouseEvent.MOUSE_DOWN, dragStartHandler);
public function dragStartHandler(event:MouseEvent):void{
component.startDrag(true);
}
You don't have to do all that. Use the DragManager. Here's a page to show you how:
http://www.switchonthecode.com/tutorials/simple-flex-drag-and-drop

Does ASP.NET have the equivalent of VB's InputBox function?

VB has a function InputBox() that will prompt the user to enter a single value, then click OK.
Is there a parallel functionality in ASP.NET, that will get the browser to pop up some kind of input box to return a single value?
If not, how do you recommend I achieve this effect?
You can do this in JavaScript
var result = prompt("Question", "Default text");
document.getElementById("HiddenInputBox").value = result;
document.HiddenForm.submit();
But most web apps seem to use of screen forms and simulated modal dialogs (fade and disable rest of screen)
jQuery is your friend for this, try simplemodal
For more functionality, check out the asp.net ajax control toolkit, and specifically the modal popup box control.
http://www.asp.net/ajax/
Yes - use the prompt() javascript function.
var x = prompt("enter a value");

Resources