Ejemplo n.º 1
0
 @Override
 public Void apply(final Object context, final Object d, final int index) {
   int n = valueList.size() - 1;
   int i = (int) Math.floor((Math.random() * n) / 2);
   int j = i + (int) Math.floor((Math.random() * n) / 2) + 1;
   JSObject firstObj = valueList.get(i).getDate().getJsObject();
   JSObject secondObj = valueList.get(j).getDate().getJsObject();
   xScale.domain(Array.fromJavaScriptObjects(webEngine, firstObj, secondObj));
   Transition transition = svg.transition().duration(750);
   transition.select("." + "x" + "." + "axis").call(xAxis);
   transition.select("." + "area").attr("d", area.apply(valueList));
   transition.select("." + "line").attr("d", line.generate(valueList));
   return null;
 };
Ejemplo n.º 2
0
 /**
  * Registers the appropriate tweens so that the zoom behavior dispatches events over the course of
  * the transition: a {@link ZoomEventType#ZOOMSTART} event when the transition starts from the
  * previously-set view, {@link ZoomEventType#ZOOM} events for each tick of the transition, and
  * finally a {@link ZoomEventType#ZOOMEND} event when the transition ends.
  *
  * <p>Note that the transition will be interrupted if the user starts zooming before the
  * transition ends.
  *
  * <p>
  *
  * @param selection
  * @return
  */
 public Zoom event(Transition selection) {
   JSObject jsObject = selection.getJsObject();
   JSObject result = call("event", jsObject);
   return new Zoom(webEngine, result);
 }