Reputation: 1028
I am using Java Infovis Toolkit. And I want any button option for zooming rather than Mouse wheel. Can Anyone help me with how can I apply two buttons for Zoom in and Zoom out rather than mouse wheel.
Upvotes: 0
Views: 1090
Reputation: 1345
If you have two buttons, for zooming in/out then you can use following handler functions with them.
handler: function(btn){
//zoom in
var val = fd.controller.Navigation.zooming/1000;
var ans = 1 + (10 * val);
fd.canvas.scale(ans, ans);
}
For zoom out,
handler: function(btn){
//zoom out
var val = fd.controller.Navigation.zooming/1000;
var ans = 1 - (10 * val);
fd.canvas.scale(ans, ans);
}
Here fd is the instance of ForceDirected visualization, you can replace that by an instance of your visualization.
Upvotes: 2