Interactive

org.appliedtopology.tda4j.plot.Interactive
See theInteractive companion object
final case class Interactive(panels: Vector[Panel] = ..., controls: Vector[Control] = ..., title: String = ..., scripts: Vector[String] = ..., selections: Vector[Selection] = ...) extends Plot

A plot with controls: a page whose panels respond to sliders, with no library to load. The panels are the plots of the library (a Figure or a Scene) drawn as usual; what changes when a control moves is what the Behaviors of their items say. Like every plot it is an immutable value, built by chaining:

Plot.filtration(points) // a complex, its diagram, a slider for the scale
 .withPlay(10)
 .withTitle("Noisy circle")

Interactive()
 .withSlider("t", 0, 1)
 .withPanel(Panel(figure).react(Mark.Points(...), Behavior.shownFrom("t", 0.3)))

The page is one HTML file, and Interactive.at gives the still picture at any value, so the same plot makes the frames of a video or the slides of a talk (frames, saveFrames).

'''Extending it.''' withScript(js) runs your JavaScript on the page with tda4j, the page's controller: tda4j.get(name), tda4j.set(name, value), tda4j.onChange(name, f), and tda4j.reactor(kind, f) to define what a Behavior.Custom of that kind does (f(item, behavior, value), item.el being the SVG element). Every change is also announced as a tda4j:change event on the page's root element, for anything else on the page.

Value parameters

controls

the sliders, top to bottom

panels

what is drawn, left to right and wrapping

scripts

JavaScript to run on the page (see above)

title

the page's heading

Attributes

Companion
object
Experimental
true
Source
Interactive.scala
Graph
Supertypes
trait Serializable
trait Product
trait Equals
trait Plot
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def +(tweak: Tweak): Interactive

tweak in every panel; a tweak a 3-D panel cannot have (an axis) leaves it as it is, and Labels(title = ...) titles the page, not the panels.

tweak in every panel; a tweak a 3-D panel cannot have (an axis) leaves it as it is, and Labels(title = ...) titles the page, not the panels.

Attributes

Source
Interactive.scala
def at(values: Map[String, Double]): Snapshot

The still picture with the controls at values (the others at their starting values): the same items, in the same places, as the page shows at those values.

The still picture with the controls at values (the others at their starting values): the same items, in the same places, as the page shows at those values.

Attributes

Source
Interactive.scala
def at(state: PageState): Snapshot

The still picture with the sliders and selections as state has them: what the page shows after the viewer has done the same. Sliders it leaves out are at their starting values, selections at nothing chosen.

The still picture with the sliders and selections as state has them: what the page shows after the viewer has done the same. Sliders it leaves out are at their starting values, selections at nothing chosen.

Attributes

Source
Interactive.scala
def at(name: String, value: Double): Snapshot

The still picture with the control name at value.

The still picture with the control name at value.

Attributes

Source
Interactive.scala
def at(value: Double): Snapshot

The still picture with the first control at value.

The still picture with the first control at value.

Attributes

Source
Interactive.scala
def fragment(theme: Theme = ...): String

The plot as a fragment to embed in a page (an ``, or a `

The plot as a fragment to embed in a page (an ``, or a `

` with its own script for 3-D).

Attributes

Source
Interactive.scala
def frames(count: Int): Seq[Snapshot]

count still pictures with the first control at even steps from its minimum to its maximum, for a video or a slide for each.

count still pictures with the first control at even steps from its minimum to its maximum, for a video or a slide for each.

Attributes

Source
Interactive.scala
def frames(values: Seq[Double]): Seq[Snapshot]

A still picture for each of values of the first control.

A still picture for each of values of the first control.

Attributes

Source
Interactive.scala
def framesAtStops(): Seq[Snapshot]

A still picture at every stop of the first control: one for each change of the picture.

A still picture at every stop of the first control: one for each change of the picture.

Attributes

Source
Interactive.scala
def html(theme: Theme = ...): String

A complete HTML page, following the reader's light or dark setting under Theme.Auto.

A complete HTML page, following the reader's light or dark setting under Theme.Auto.

Attributes

Source
Interactive.scala
def mapPanels(figures: Figure => Figure, scenes: Scene => Scene): Interactive

figures applied to the 2-D panels and scenes to the 3-D ones.

figures applied to the 2-D panels and scenes to the 3-D ones.

Attributes

Source
Interactive.scala
def saveFrames(directory: String, count: Int, theme: Theme = ...): Seq[String]

Writes count frames (see frames) as frame-0000.svg, frame-0001.svg, ... in directory, in theme, and returns their paths. Files carry no background unless the style asks for one (withStyle("print")).

Writes count frames (see frames) as frame-0000.svg, frame-0001.svg, ... in directory, in theme, and returns their paths. Files carry no background unless the style asks for one (withStyle("print")).

Attributes

Source
Interactive.scala
def saveFrames(directory: String, count: Int, theme: String): Array[String]

saveFrames in the theme called theme (auto, light or dark), the paths as an array: for callers with a word and no Seq (MATLAB, Python).

saveFrames in the theme called theme (auto, light or dark), the paths as an array: for callers with a word and no Seq (MATLAB, Python).

Attributes

Source
Interactive.scala
def saveFrames(directory: String, count: Int): Array[String]

saveFrames in the light theme, for callers that cannot use a default argument (Java, MATLAB).

saveFrames in the light theme, for callers that cannot use a default argument (Java, MATLAB).

Attributes

Source
Interactive.scala
def svgFile(theme: Theme = ...): String

The plot at its starting values, as one still picture.

The plot at its starting values, as one still picture.

Attributes

Source
Interactive.scala
override def toString: String

Returns a string representation of the object.

Returns a string representation of the object.

The default representation is platform dependent.

Attributes

Returns

a string representation of the object.

Definition Classes
Any
Source
Interactive.scala
def touched(panel: Int, window: Window, selection: String, state: PageState = ...): Set[Int]

The keys of the selection selection that the rectangle window chooses on the 3-D panel number panel (counting every panel of the page from 0) with the sliders and selections as state has them: what the page chooses when the viewer drags that rectangle in the view of the scene (see Panel.Spatial.brushable). window is in the units of the view plane, as PageState.brush has it, and only items that are drawn in state count.

The keys of the selection selection that the rectangle window chooses on the 3-D panel number panel (counting every panel of the page from 0) with the sliders and selections as state has them: what the page chooses when the viewer drags that rectangle in the view of the scene (see Panel.Spatial.brushable). window is in the units of the view plane, as PageState.brush has it, and only items that are drawn in state count.

Attributes

Source
Interactive.scala

This plot with one more control.

This plot with one more control.

Attributes

Source
Interactive.scala
def withPalette(name: String): Interactive

Every panel in the palette called name: brand, reference, print, grayscale, okabe-ito or clear.

Every panel in the palette called name: brand, reference, print, grayscale, okabe-ito or clear.

Attributes

Source
Interactive.scala
def withPanel(figure: Figure): Interactive

This plot with figure as one more panel.

This plot with figure as one more panel.

Attributes

Source
Interactive.scala
def withPanel(scene: Scene): Interactive

This plot with the 3-D scene as one more panel.

This plot with the 3-D scene as one more panel.

Attributes

Source
Interactive.scala
def withPanel(panel: Panel): Interactive

This plot with panel as one more panel.

This plot with panel as one more panel.

Attributes

Source
Interactive.scala
def withPlay(seconds: Double): Interactive

A play button on the first slider, sweeping to its maximum in seconds.

A play button on the first slider, sweeping to its maximum in seconds.

Attributes

Source
Interactive.scala
def withPlay(name: String, seconds: Double): Interactive

A play button on the slider name, sweeping to its maximum in seconds.

A play button on the slider name, sweeping to its maximum in seconds.

Attributes

Source
Interactive.scala
def withScript(javascript: String): Interactive

JavaScript to run on the page; see the class's note on extending it.

JavaScript to run on the page; see the class's note on extending it.

Attributes

Source
Interactive.scala

This plot with one more selection: a set of keys the viewer chooses by pointing at items (see Selection).

This plot with one more selection: a set of keys the viewer chooses by pointing at items (see Selection).

Attributes

Source
Interactive.scala
def withSelection(name: String): Interactive

This plot with a selection called name.

This plot with a selection called name.

Attributes

Source
Interactive.scala
def withSelection(name: String, labels: Seq[String]): Interactive

This plot with a selection called name, listed under the panels with labels(key) for each chosen key.

This plot with a selection called name, listed under the panels with labels(key) for each chosen key.

Attributes

Source
Interactive.scala
def withSetting(spec: String): Interactive

One change written as text, element.property=value, to every panel. See Settings.

One change written as text, element.property=value, to every panel. See Settings.

Attributes

Source
Interactive.scala
def withSlider(name: String, min: Double, max: Double): Interactive

This plot with a slider name from min to max, starting at min.

This plot with a slider name from min to max, starting at min.

Attributes

Source
Interactive.scala
def withSlider(name: String, min: Double, max: Double, value: Double, label: String): Interactive

This plot with a slider name from min to max, starting at value and written label beside it.

This plot with a slider name from min to max, starting at value and written label beside it.

Attributes

Source
Interactive.scala
def withStyle(name: String): Interactive

Every panel in the style called name: default, slides, print or clear.

Every panel in the style called name: default, slides, print or clear.

Attributes

Source
Interactive.scala
def withTextScale(factor: Double): Interactive

A factor on every text size of every panel.

A factor on every text size of every panel.

Attributes

Source
Interactive.scala
def withTitle(text: String): Interactive

The heading of the page.

The heading of the page.

Attributes

Source
Interactive.scala
def zoomable(axes: ZoomAxes = ...): Interactive

This plot with every 2-D panel that the page can zoom made zoomable (see Panel.Flat.zoomable): the viewer zooms in on a region with the buttons beside a panel or Ctrl and the mouse wheel, pans by dragging, and the axes follow. A panel whose axes the page cannot draw again (a log axis, a number format) and a 3-D panel are left as they are. With axes, the axes the zoom changes.

This plot with every 2-D panel that the page can zoom made zoomable (see Panel.Flat.zoomable): the viewer zooms in on a region with the buttons beside a panel or Ctrl and the mouse wheel, pans by dragging, and the axes follow. A panel whose axes the page cannot draw again (a log axis, a number format) and a 3-D panel are left as they are. With axes, the axes the zoom changes.

Attributes

Source
Interactive.scala

Inherited methods

def fragment(theme: String): String

fragment in the theme called theme (auto, light or dark), for callers that have a word, not a Theme (Python: a notebook shows an interactive plot by its fragment).

fragment in the theme called theme (auto, light or dark), for callers that have a word, not a Theme (Python: a notebook shows an interactive plot by its fragment).

Attributes

Inherited from:
Plot
Source
Plot.scala
def productElementNames: Iterator[String]

An iterator over the names of all the elements of this product.

An iterator over the names of all the elements of this product.

Attributes

Inherited from:
Product
Source
Product.scala
def productIterator: Iterator[Any]

An iterator over all the elements of this product.

An iterator over all the elements of this product.

Attributes

Returns

in the default implementation, an Iterator[Any]

Inherited from:
Product
Source
Product.scala
def save(path: String, theme: String): String

save in the theme called theme (auto, light or dark), for callers that have a word, not a Theme (MATLAB: fig.save('diagram.svg', 'dark')).

save in the theme called theme (auto, light or dark), for callers that have a word, not a Theme (MATLAB: fig.save('diagram.svg', 'dark')).

Attributes

Inherited from:
Plot
Source
Plot.scala
def save(path: String): String

save in the default theme for the file type, for callers that cannot use a default argument (Java, MATLAB: fig.save('diagram.svg')).

save in the default theme for the file type, for callers that cannot use a default argument (Java, MATLAB: fig.save('diagram.svg')).

Attributes

Inherited from:
Plot
Source
Plot.scala
def save(path: String, theme: Option[Theme] = ...): String

Writes the plot to path: an .svg file in plain light colors with no background (another theme on request; see svgFile), or an .html page (interactive for 3-D) that follows the reader's light or dark setting and has its background. Returns the absolute path.

Writes the plot to path: an .svg file in plain light colors with no background (another theme on request; see svgFile), or an .html page (interactive for 3-D) that follows the reader's light or dark setting and has its background. Returns the absolute path.

Attributes

Inherited from:
Plot
Source
Plot.scala
def view(): this.type

Shows the plot in the live viewer, a browser tab that adds every plot view()ed (see Viewer). Inside Plot.viewWith the plot goes to the program that hosts the session instead.

Shows the plot in the live viewer, a browser tab that adds every plot view()ed (see Viewer). Inside Plot.viewWith the plot goes to the program that hosts the session instead.

Attributes

Inherited from:
Plot
Source
Plot.scala