javascript - Using D3 zoom in JavaFX Webview -
i have javafx webview renders graph (using d3). want implement 'zoom on mouse scroll' on graph in javafx application (when mouse hovered on top of webview). able on web-browser using following d3 js code
var svg = d3.select("body").append("svg") .attr("width", width) .attr("height", height) .call(d3.behavior.zoom().on("zoom", zoomhandler)) .append('g'); function zoomhandler() { svg.attr("transform", "translate(" + d3.event.translate + ")" + " scale(" + d3.event.scale + ")"); }
but if similar inside javafx application's webview, graph rendered in webview on scroll, disappears , reappears if bring mouse scroll initial position (when application started)
the following code how use webview render graph
final url urlloadmaingraph = getclass().getresource("html/maingraph.html"); wemaingraph.load(urlloadmaingraph.toexternalform());
is there wrong on being done ?
thanks
i cannot provide solution, have same problem. problem is, have not specified scale.
javafx jumping minimum maximum scale of zoom 1 "tip" on mousewheel :(. if specify in range, work out you. use example zoom little bit outside.
var svg = d3.select("body").append("svg") .attr("width", width) .attr("height", height).call(d3.behavior.zoom().scaleextent([0.75, 1]);
best far... hoping anwsers!
(ps: couldnt comment... thats why kind of answer.
Comments
Post a Comment