"Raw" Data & Extension Methods
The idea here, is that "raw datatypes" have some unambiguous visualisation which is relatively common to want to plot. Pie charts, bar charts and the like, which are always going to look very similar to the examples on the vega website, and come from a simple datastructure. We want to be able to plot these as quickly as possible.
We achieve this through scala 3's extension methods have a look in the
viz.extensions package for ideas.
Currently, extension methods are not availalbe in scala JS, so you'd have to copy paste these into a repl in order to get the idea.
import viz.PlotTargets.desktopBrowser import viz.extensions.*
Labelled bar chart
List(("A", 4),("B", 6),("C", -1)).plotBarChart(List())
(1 to 5).plotBarChart()
(1 to 5).plotPieChart()
Pie chart with labels...
(1 to 5).map(i => (scala.util.Random.nextString(5), i)).plotPieChart(List())
List( "how much wood would a wood chuck chuck if a wood chuck could chuck wood", "a wood chuck would chuck as much wood as a wood chuck could chuck if a wood chuck could chuck wood" ).plotWordcloud()
List((1.0,2.0),(3.0,4.0),(0.5 , 5.0),(3.14159, 1.0)).plotScatter()
import viz.extensions.jvm.* List((1.0,2.0),(3.0,4.0),(0.5 , 5.0),(3.14159, 1.0)).plotRegression()