VlChart class
A chart: a dataset, the channels every mark shares, how big it is, and the marks.
The fluent surface is a writer of specifications, not the engine. Every
call writes into a specification and toSpec hands that specification over;
nothing here computes a scale, a layout or a pixel. There is no path where the
API computes something the engine would have computed differently, because the
API computes nothing at all.
A channel said on the chart is inherited by every mark on it, so a line and the points on top of it are two marks and one set of axes rather than two charts.
A channel need not state its type — the data says. A column of numbers is a
quantity, a column of ISO dates an instant, anything else a name. A field the
data does not have is an error rather than a guess: errors is non-empty
and the caller can say so instead of drawing an empty axis.
Since 1.0
See also VlDataset.
VlDataset data = VlDataset.create();
data.row().str("region", "North").num("sales", 120.0);
data.row().str("region", "South").num("sales", 93.0);
VlChart chart = VlChart.create(data);
chart.size(300, 200);
chart.bar().x("region").y("sales").aggregate("sum");
chart.toSpec();
VlDataset data = VlDataset.create();
data.row().str("region", "North").num("sales", 120.0);
VlChart chart = VlChart.create(data);
chart.x("region").y("sales").color("region");
chart.area().markOpacity(0.35);
chart.line();
Constructors
- VlChart()
Properties
- cfg ↔ VlJson
-
getter/setter pair
- cursor ↔ String
-
getter/setter pair
- data ↔ VlDataset?
-
getter/setter pair
- enc ↔ VlJson
-
getter/setter pair
-
errors
↔ List<
String> -
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
-
marks
↔ List<
VlChartMark> -
getter/setter pair
- props ↔ VlJson
-
getter/setter pair
- resolve ↔ VlJson
-
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- transforms ↔ VlJson
-
getter/setter pair
Methods
-
arc(
) → VlChartMark - Adds an arc mark to the chart.
-
area(
) → VlChartMark - Adds an area mark to the chart.
-
background(
String colour) → VlChart - The colour behind the plot.
-
bar(
) → VlChartMark - Adds a bar mark to the chart.
-
boxplot(
) → VlChartMark - Adds a boxplot mark to the chart.
-
calculate(
String expression, String _as) → VlChart - Adds a column computed from the others.
-
channel(
String name, String field) → VlChart - Sets a channel that every mark on this view inherits.
-
circle(
) → VlChartMark - Adds a circle mark to the chart.
-
color(
String field) → VlChart - Colour, and the legend that explains it.
-
configJson(
VlJson config) → VlChart - Merges a configuration block into the specification.
-
detail(
String field) → VlChart - Groups the rows without drawing anything of its own: one line per group, no legend.
-
encodeJson(
String channel, VlJson definition) → VlChart - Sets a whole shared channel from an already-built definition.
-
error(
String message) → void -
errorband(
) → VlChartMark - Adds an error band: the same interval as an error bar, drawn as a filled region.
-
errorbar(
) → VlChartMark - Adds an error bar: an interval computed from the rows rather than read off them.
-
filter(
String expression) → VlChart - Keeps only the rows an expression accepts.
-
geoshape(
) → VlChartMark - Adds a geoshape mark to the chart.
-
heading(
String text) → VlChart - The chart's title, drawn above the plot.
-
height(
int value) → VlChart - How tall the plotting area is, in pixels.
-
image(
) → VlChartMark - Adds an image mark to the chart.
-
independent(
String channel) → VlChart - Stops the layers sharing one scale on a channel.
-
inferType(
VlJson ch) → String -
keepOrder(
) → VlChart - Keeps the order the rows arrived in for the shared cursor channel.
-
label(
) → VlChartMark -
Adds a text mark, which draws the value of its
textchannel. -
latest(
) → VlChartMark - The mark added last, for a caller that built one and let go of it.
-
line(
) → VlChartMark - Adds a line mark to the chart.
-
mark(
String markType) → VlChartMark - Adds a mark of any type the compiler knows.
-
mergedEncoding(
VlChartMark m) → VlJson -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
point(
) → VlChartMark - Adds a point mark to the chart.
-
propJson(
String key, VlJson value) → VlChart - Sets any top-level property of the specification.
-
rect(
) → VlChartMark - Adds a rect mark to the chart.
-
resolveTypes(
VlJson encoding) → void -
rule(
) → VlChartMark - Adds a rule mark to the chart.
-
setOnCursor(
String key, VlJson value) → VlChart -
size(
int width, int height) → VlChart - How big the plotting area is, in pixels.
-
square(
) → VlChartMark - Adds a square mark to the chart.
-
tick(
) → VlChartMark - Adds a tick mark to the chart.
-
timeUnit(
String unit) → VlChart - Which part of an instant a shared channel reads.
-
title(
String label) → VlChart - The axis or legend label for the shared cursor channel.
-
toSpec(
) → VlJson - The chart as a Vega-Lite specification.
-
toString(
) → String -
A string representation of this object.
inherited
-
toText(
) → String -
trail(
) → VlChartMark - Adds a trail mark to the chart.
-
transformJson(
VlJson transform) → VlChart - Appends an already-built transform.
-
type(
String kind) → VlChart - States what a shared channel's column holds, when the data cannot say.
-
width(
int value) → VlChart - How wide the plotting area is, in pixels.
-
x(
String field) → VlChart - Position along the horizontal axis.
-
y(
String field) → VlChart - Position along the vertical axis.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited