FlintChart

Description

Microsoft Flint charts from a spec, with click events

FlintChart draws a chart with Flint from a chart spec: the data, what each field means (a semantic type), and which field goes on which channel of which chart type. Flint works out the scales, axes, formats and layout, and the theme sets the look. Use it when the toolkit's own SVG charts do not cover the chart type, or when the app must react to a click on a mark, a series, a key entry or an axis label.

The spec is the JSON that a flint fence in Markdown holds, so a chart written for a chat reply can be drawn as a component unchanged. Give it as JSON with FlintChart(string specJson), or build it with FlintChart(FlintChartType) followed by Columns, AddRow, SemanticType, X, Y and ColorBy. The fluent methods write into the spec, so they also adjust a chart made from JSON.

Limits to know:

  • Vega-Lite is the only backend. The ECharts, Chart.js and Plotly backends are not bundled.
  • Flint is about 1.8 MB (about 630 KB gzipped). It is an unlinked file fetched the first time a chart is drawn, and a page with no chart never fetches it.
  • Map and Choropleth fetch their base map from vega.github.io. A page that cannot reach it shows no map.
  • A spec that cannot be drawn (a channel the chart type does not have, a field missing from the data, invalid JSON) shows its reason in the chart's place, and OnError(...) is called. A redraw that fails leaves the previous chart in place.
  • The chart is laid out for the width it has. Give it a width (WS(), a grid cell, a vertical stack); a content-sized parent leaves it at its minimum. It chooses its own height unless FillHeight() is set, which lays it out for the height it is given.

To draw the same spec from Markdown, call .Flint() on the MarkdownBlock. Fences are not drawn as charts until then. See MarkdownBlock.

The component draws no frame of its own. Put it in a Card for a plate.

Samples

Clicks

OnElementClick(...) reports a FlintChartClick. Target is Mark, Series, LegendEntry or AxisLabel, Rows holds the data rows the element stands for, and Row is the first. A reported click changes nothing on the chart; add FlintInteraction.ClickHighlight to also emphasize what was clicked.

From a Flint spec (JSON)

A list of fields on y draws one series each. ChartType(...) switches the chart type and keeps the data and encodings. FillHeight() lays the chart out for the height given by H(...).

Interactions

Interactions(...) mounts Flint's interaction presets. InspectIndex reads values along the x axis and LegendToggle hides a series from the key. An interaction a chart type cannot honor is dropped with a console warning.

API reference

class

FlintChart

public class FlintChart : ComponentBase<FlintChart, HTMLElement>

A chart drawn by Microsoft's Flint from a Flint chart spec: the data, what its fields mean, and which field goes on which channel of which chart type. Flint decides the rest (scales, axes, formats, layout) from that, and the theme (FlintThemes) decides the look; the default theme reads the page's Tesserae tokens, so the chart follows light/dark mode and custom themes.

Remarks

The spec is the same JSON a ```flint fence in MarkdownBlock holds, and can be given as that JSON (FlintChart) or built with the fluent methods, which write into it (Columns/AddRow, SemanticType, Encode, …). A spec given as JSON can be adjusted with the same methods afterwards. Flint is fetched the first time a chart is drawn. The chart is laid out for the width it has, again when that width changes, and drawn again (out of sight, swapped in once drawn) after a change to its spec or a theme change that changes its theme. A spec that cannot be drawn is reported through Error and OnError, and shown in the chart's place until one can. OnElementClick reports a click on a mark, a series, a key entry or a category's axis label, with the rows of the data it stands for.

Namespace
Tesserae
Inheritance
ComponentBase<FlintChart, HTMLElement> → FlintChart

Constructors

NameDescription
FlintChartA chart of type, with no data yet.
Constructor
FlintChart
Overload
FlintChart(FlintChartType)A chart of type, with no data yet.
FlintChart(string)A chart drawn from a Flint chart spec (a ChartAssemblyInput): data, semantic_types and chart_spec, with optional theme_spec, interaction_spec and options. A spec that is not valid JSON is reported like any other that cannot be drawn.
FlintChart(FlintChartType)
public FlintChart(FlintChartType type)

A chart of type, with no data yet.

Parameters

type FlintChartType
FlintChart(string)
public FlintChart(string specJson)

A chart drawn from a Flint chart spec (a ChartAssemblyInput): data, semantic_types and chart_spec, with optional theme_spec, interaction_spec and options. A spec that is not valid JSON is reported like any other that cannot be drawn.

Parameters

specJson string

Properties

NameDescription
SpecGets or sets the chart's spec as Flint chart JSON. Setting it replaces everything the fluent methods set, and redraws.
ErrorGets why the chart could not be drawn the last time it was tried, or null when it was (or has not been tried yet).
IsDrawnGets whether a chart is on screen.
Property
FlintChart.Spec
public string Spec { get ; set ; }

Gets or sets the chart's spec as Flint chart JSON. Setting it replaces everything the fluent methods set, and redraws.

Property
FlintChart.Error
public string Error

Gets why the chart could not be drawn the last time it was tried, or null when it was (or has not been tried yet).

Property
FlintChart.IsDrawn
public bool IsDrawn

Gets whether a chart is on screen.

Methods

NameDescription
ChartTypeNameThe name Flint gives type in a spec's chartType, e.g. "Scatter Plot".
ChartTypeSets the chart type, keeping the data and the encodings, and redraws.
ColumnsNames the fields of the rows AddRow and Data{T} add, in order, and drops the rows there were.
AddRowAdds one row, a value per field named by Columns. A value can be a string, a number, a bool, a DateTime (written as an ISO date) or null.
Data<T>Adds a row per item, with a value per field named by Columns.
DataJsonReplaces the data with rows given as a JSON array of objects, one property per field.
DataUrlDraws the data from a JSON or CSV file at url, in place of rows given here. The file is a request to whatever server hosts it.
ClearDataDrops every row.
SemanticTypeSays what field means, which decides how Flint encodes, scales and formats it.
EncodeDraws field on channel.
RemoveEncodingTakes channel off the chart.
XDraws field along x.
YDraws field along y.
ColorByColours the marks by field.
TitleThe headline: what the chart says, in words.
SubtitleThe reading of the headline: what is measured, of whom, when, in what units.
LabelA short line above the headline, such as a figure label.
SourceWhere the data comes from, drawn as the chart's source line; a link when href is given.
PropertySets one of the chart type's own properties (Flint's chartProperties), such as innerRadius, showPoints, stackMode, binCount, cornerRadius or region. null unsets it.
BaseSizeThe size the chart is laid out for when its data fits comfortably (Flint's default is 400 by 320); it still fits the width it has.
TooltipsWhether hovering a mark shows its values (on by default).
InteractionsReplaces the chart's interactions (Flint's interaction_spec) with these presets; none removes them.
ChartThemeThe theme the chart is drawn in when its spec names none (Tesserae by default), or in any case when overrideSpecTheme is set.
FillHeightLays the chart out for the height it is given (with .Height(...), .HS() or .Grow()) as well as its width. By default the chart chooses its own height for the width it has.
OnElementClickCalled when a mark, a series (a line or an area), a key entry or a category's axis label is clicked, with what was clicked and the rows of the data it stands for. A click reported here changes nothing on the chart; add ClickHighlight to also emphasise what was clicked.
OnErrorCalled with the reason the chart cannot be drawn (a field that is not in the data, a channel the chart type does not have, the library failing to load), once per failed attempt.
RefreshDraws the chart again now, rather than once the current change settles.
Method
FlintChart.ChartTypeName
public static string ChartTypeName(FlintChartType type)

The name Flint gives type in a spec's chartType, e.g. "Scatter Plot".

Method
FlintChart.ChartType
public FlintChart ChartType(FlintChartType type)

Sets the chart type, keeping the data and the encodings, and redraws.

Method
FlintChart.Columns
public FlintChart Columns(params string[] names)

Names the fields of the rows AddRow and Data{T} add, in order, and drops the rows there were.

Method
FlintChart.AddRow
public FlintChart AddRow(params object[] values)

Adds one row, a value per field named by Columns. A value can be a string, a number, a bool, a DateTime (written as an ISO date) or null.

Method
FlintChart.Data<T>
public FlintChart Data<T>(IEnumerable<T> items, Func<T, object[]> values)

Adds a row per item, with a value per field named by Columns.

Method
FlintChart.DataJson
public FlintChart DataJson(string rowsJson)

Replaces the data with rows given as a JSON array of objects, one property per field.

Method
FlintChart.DataUrl
public FlintChart DataUrl(string url)

Draws the data from a JSON or CSV file at url, in place of rows given here. The file is a request to whatever server hosts it.

Method
FlintChart.ClearData
public FlintChart ClearData()

Drops every row.

Method
FlintChart.SemanticType
public FlintChart SemanticType(string field, FlintSemanticType type)

Says what field means, which decides how Flint encodes, scales and formats it.

Method
FlintChart.Encode
Overload
Encode(FlintChannel, string)Draws field on channel.
Encode(FlintChannel, FlintEncoding)Draws encoding's field on channel, the way it says.
Encode(FlintChannel, string[])Draws several measures on one measure channel (y, or x when it is the measure), as a series each: Flint folds them into one series field, coloured and keyed by name.
Encode(FlintChannel, string)
public FlintChart Encode(FlintChannel channel, string field)

Draws field on channel.

Parameters

channel FlintChannel
field string
Encode(FlintChannel, FlintEncoding)
public FlintChart Encode(FlintChannel channel, FlintEncoding encoding)

Draws encoding's field on channel, the way it says.

Parameters

channel FlintChannel
encoding FlintEncoding
Encode(FlintChannel, string[])
public FlintChart Encode(FlintChannel channel, params string[] fields)

Draws several measures on one measure channel (y, or x when it is the measure), as a series each: Flint folds them into one series field, coloured and keyed by name.

Parameters

channel FlintChannel
fields string[]
Method
FlintChart.RemoveEncoding
public FlintChart RemoveEncoding(FlintChannel channel)

Takes channel off the chart.

Method
FlintChart.X
public FlintChart X(string field)

Draws field along x.

Method
FlintChart.Y
public FlintChart Y(string field)

Draws field along y.

Method
FlintChart.ColorBy
public FlintChart ColorBy(string field)

Colours the marks by field.

Method
FlintChart.Title
public FlintChart Title(string title)

The headline: what the chart says, in words.

Method
FlintChart.Subtitle
public FlintChart Subtitle(string subtitle)

The reading of the headline: what is measured, of whom, when, in what units.

Method
FlintChart.Label
public FlintChart Label(string label)

A short line above the headline, such as a figure label.

Method
FlintChart.Source
public FlintChart Source(string text, string href = null)

Where the data comes from, drawn as the chart's source line; a link when href is given.

Method
FlintChart.Property
public FlintChart Property(string name, object value)

Sets one of the chart type's own properties (Flint's chartProperties), such as innerRadius, showPoints, stackMode, binCount, cornerRadius or region. null unsets it.

Method
FlintChart.BaseSize
public FlintChart BaseSize(int width, int height)

The size the chart is laid out for when its data fits comfortably (Flint's default is 400 by 320); it still fits the width it has.

Method
FlintChart.Tooltips
public FlintChart Tooltips(bool show = true)

Whether hovering a mark shows its values (on by default).

Method
FlintChart.Interactions
public FlintChart Interactions(params FlintInteraction[] interactions)

Replaces the chart's interactions (Flint's interaction_spec) with these presets; none removes them.

Method
FlintChart.ChartTheme
public FlintChart ChartTheme(IFlintTheme theme, bool overrideSpecTheme = false)

The theme the chart is drawn in when its spec names none (Tesserae by default), or in any case when overrideSpecTheme is set.

Method
FlintChart.FillHeight
public FlintChart FillHeight(bool fill = true)

Lays the chart out for the height it is given (with .Height(...), .HS() or .Grow()) as well as its width. By default the chart chooses its own height for the width it has.

Method
FlintChart.OnElementClick
public FlintChart OnElementClick(Action<FlintChartClick> onClick)

Called when a mark, a series (a line or an area), a key entry or a category's axis label is clicked, with what was clicked and the rows of the data it stands for. A click reported here changes nothing on the chart; add ClickHighlight to also emphasise what was clicked.

Method
FlintChart.OnError
public FlintChart OnError(Action<string> onError)

Called with the reason the chart cannot be drawn (a field that is not in the data, a channel the chart type does not have, the library failing to load), once per failed attempt.

Method
FlintChart.Refresh
public FlintChart Refresh()

Draws the chart again now, rather than once the current change settles.

enum

FlintChartClickTarget

public enum FlintChartClickTarget

What was clicked on a FlintChart.

Namespace
Tesserae

Values

NameDescription
MarkOne mark: a bar, a point, a slice, a cell. Its row (or the rows it sums) is in Rows.
SeriesA line or an area, which stands for a whole series: every row of the series.
LegendEntryAn entry in the chart's key: every row of that series or category.
AxisLabelA category's label on an axis: every row of that category.
Value
FlintChartClickTarget.Mark
Mark

One mark: a bar, a point, a slice, a cell. Its row (or the rows it sums) is in Rows.

Value
FlintChartClickTarget.Series
Series

A line or an area, which stands for a whole series: every row of the series.

Value
FlintChartClickTarget.LegendEntry
LegendEntry

An entry in the chart's key: every row of that series or category.

Value
FlintChartClickTarget.AxisLabel
AxisLabel

A category's label on an axis: every row of that category.

class

FlintChartClick

public sealed class FlintChartClick

A click on a FlintChart (OnClick): what was clicked, and the rows of the chart's data it stands for, as they were given to the chart.

Namespace
Tesserae

Properties

NameDescription
TargetWhat kind of thing was clicked.
RoleThe role Flint gives what was clicked, e.g. bar, symbol, arc, line, legend-item, axis-label.
RowsThe rows of the chart's data the clicked thing stands for: one for a mark drawn from one row, more for a series, a key entry, a category or a mark that sums several.
RowThe first of Rows, or null.
FieldFor a key entry or an axis label, the field it names; otherwise null.
ValueFor a key entry or an axis label, the value it names (a category, a series); otherwise null.
Property
FlintChartClick.Target
public FlintChartClickTarget Target { get; }

What kind of thing was clicked.

Property
FlintChartClick.Role
public string Role { get; }

The role Flint gives what was clicked, e.g. bar, symbol, arc, line, legend-item, axis-label.

Property
FlintChartClick.Rows
public IReadOnlyList<FlintChartRow> Rows { get; }

The rows of the chart's data the clicked thing stands for: one for a mark drawn from one row, more for a series, a key entry, a category or a mark that sums several.

Property
FlintChartClick.Row
public FlintChartRow Row

The first of Rows, or null.

Property
FlintChartClick.Field
public string Field { get; }

For a key entry or an axis label, the field it names; otherwise null.

Property
FlintChartClick.Value
public object Value { get; }

For a key entry or an axis label, the value it names (a category, a series); otherwise null.

Methods

NameDescription
FromReads Flint's interaction event; null for anything that is not a click on something.
Method
FlintChartClick.From
internal static FlintChartClick From(object detail)

Reads Flint's interaction event; null for anything that is not a click on something.

class

FlintChartRow

public sealed class FlintChartRow

One row of a FlintChart's data, as it was given to the chart.

Namespace
Tesserae

Properties

NameDescription
FieldsThe fields the row has, in its own order.
this[string]The value of field as it was given: a string, a number, a boolean or null.
Property
FlintChartRow.Fields
public string[] Fields

The fields the row has, in its own order.

Indexer
FlintChartRow.this[string]
public object this[string field]

The value of field as it was given: a string, a number, a boolean or null.

Methods

NameDescription
HasWhether the row has field.
GetStringThe value of field as text, or null when the row has none.
GetNumberThe value of field as a number, or null when it is not one.
ToJsonThe row as JSON.
ToString
Method
FlintChartRow.Has
public bool Has(string field)

Whether the row has field.

Method
FlintChartRow.GetString
public string GetString(string field)

The value of field as text, or null when the row has none.

Method
FlintChartRow.GetNumber
public double? GetNumber(string field)

The value of field as a number, or null when it is not one.

Method
FlintChartRow.ToJson
public string ToJson()

The row as JSON.

Method
FlintChartRow.ToString
public override string ToString()
enum

FlintChartType

public enum FlintChartType

The chart types a FlintChart draws: every Vega-Lite template of Flint, grouped the way Flint groups them. Which FlintChannels each one reads is listed on it.

Namespace
Tesserae

Values

NameDescription
ScatterPlotPoints at x and y. Channels: x, y, color, size, shape, detail, opacity, column, row.
MarginalPlotA scatter plot with the distribution of each axis on its margin. Channels: x, y, color, size, shape, opacity.
RegressionA scatter plot with its fitted trend line (regressionMethod: linear, log, exp, pow, quad, poly). Channels: x, y, size, color, column, row.
ConnectedScatterPlotPoints joined in the order of a field. Channels: x, y, order, color, detail, column, row.
RangedDotPlotThe span between two values of each category, drawn as two dots and a rule. Channels: x, y, color.
StripPlotEvery value of a measure as a tick or dot along one axis per category. Channels: x, y, color, size, column, row.
BarChartOne bar per category. Channels: x, y, color, opacity, column, row.
GroupedBarChartBars side by side within each category, one per group. Channels: x, y, group, color, column, row.
StackedBarChartBars stacked within each category, by color (stackMode: stacked, normalize, center). Channels: x, y, color, column, row.
LollipopChartA stem and a dot per category. Channels: x, y, color, column, row.
WaterfallChartRunning totals as floating bars, rises and falls in their own colours. Channels: x, y, color, column, row.
GanttChartTasks as bars from x to x2 along a timeline. Channels: y, x, x2, color, detail, column, row.
BulletChartA measure against its goal, as a bar on qualitative bands. Channels: y, x, goal, color, column, row.
HistogramA measure binned into counts (binCount). Channels: x, color, column, row.
DensityPlotA smoothed distribution of a measure. Channels: x, color, column, row.
RidgelinePlotOne density per category, overlapping like ridges. Channels: x, y, color.
EcdfPlotThe cumulative share of rows at or below each value. Channels: x, color, detail, column, row.
ViolinPlotThe distribution of a measure per category, mirrored. Channels: x, y, color, row.
BoxplotQuartiles, whiskers and outliers of a measure per category. Channels: x, y, color, opacity, column, row.
PyramidChartTwo distributions back to back, such as a population by age and sex. Channels: x, y, color.
CandlestickChartOpen, high, low and close per period. Channels: x, open, high, low, close, column, row.
LineChartA measure over a continuous axis, one line per color. Channels: x, y, color, strokeDash, detail, opacity, column, row.
SparklineA small line without axes, for a trend at a glance. Channels: x, y, color, detail, row, column.
BumpChartThe rank of each series over time. Channels: x, y, color, detail, column, row.
SlopeChartA change between two points in time, one line per series. Channels: x, y, color, detail, column, row.
AreaChartA line with the area under it filled, stacked by color. Channels: x, y, color, opacity, column, row.
StreamgraphStacked areas around a moving centre line. Channels: x, y, color, column, row.
RangeAreaChartThe band between y and y2 over x. Channels: x, y, y2, color, column, row.
PieChartShares of a whole as slices; the measure is size. Channels: size, color, column, row.
DonutChartA pie with a hole (innerRadius). Channels: size, color, column, row.
RoseChartEqual-angle wedges whose radius is the measure. Channels: x, y, color, column, row.
RadarChartMeasures on spokes around a centre, one polygon per series. Channels: x, y, color, column, row.
HeatmapA grid of x by y cells coloured by a measure. Channels: x, y, color, column, row.
CalendarHeatmapA measure per day, laid out as weeks of a year. Channels: x, color.
BarTableA table with an inline bar per row. Channels: y, x, color, column, row.
KpiCardOne headline number per metric, with its goal. Channels: metric, value, goal.
TableThe rows themselves, as a table. No channels.
MapPoints at longitude and latitude on a map (region). Channels: longitude, latitude, color, size, opacity.
ChoroplethRegions of a map coloured by a measure (region, level). Channels: id, color, detail.
Value
FlintChartType.ScatterPlot
ScatterPlot

Points at x and y. Channels: x, y, color, size, shape, detail, opacity, column, row.

Value
FlintChartType.MarginalPlot
MarginalPlot

A scatter plot with the distribution of each axis on its margin. Channels: x, y, color, size, shape, opacity.

Value
FlintChartType.Regression
Regression

A scatter plot with its fitted trend line (regressionMethod: linear, log, exp, pow, quad, poly). Channels: x, y, size, color, column, row.

Value
FlintChartType.ConnectedScatterPlot
ConnectedScatterPlot

Points joined in the order of a field. Channels: x, y, order, color, detail, column, row.

Value
FlintChartType.RangedDotPlot
RangedDotPlot

The span between two values of each category, drawn as two dots and a rule. Channels: x, y, color.

Value
FlintChartType.StripPlot
StripPlot

Every value of a measure as a tick or dot along one axis per category. Channels: x, y, color, size, column, row.

Value
FlintChartType.BarChart
BarChart

One bar per category. Channels: x, y, color, opacity, column, row.

Value
FlintChartType.GroupedBarChart
GroupedBarChart

Bars side by side within each category, one per group. Channels: x, y, group, color, column, row.

Value
FlintChartType.StackedBarChart
StackedBarChart

Bars stacked within each category, by color (stackMode: stacked, normalize, center). Channels: x, y, color, column, row.

Value
FlintChartType.LollipopChart
LollipopChart

A stem and a dot per category. Channels: x, y, color, column, row.

Value
FlintChartType.WaterfallChart
WaterfallChart

Running totals as floating bars, rises and falls in their own colours. Channels: x, y, color, column, row.

Value
FlintChartType.GanttChart
GanttChart

Tasks as bars from x to x2 along a timeline. Channels: y, x, x2, color, detail, column, row.

Value
FlintChartType.BulletChart
BulletChart

A measure against its goal, as a bar on qualitative bands. Channels: y, x, goal, color, column, row.

Value
FlintChartType.Histogram
Histogram

A measure binned into counts (binCount). Channels: x, color, column, row.

Value
FlintChartType.DensityPlot
DensityPlot

A smoothed distribution of a measure. Channels: x, color, column, row.

Value
FlintChartType.RidgelinePlot
RidgelinePlot

One density per category, overlapping like ridges. Channels: x, y, color.

Value
FlintChartType.EcdfPlot
EcdfPlot

The cumulative share of rows at or below each value. Channels: x, color, detail, column, row.

Value
FlintChartType.ViolinPlot
ViolinPlot

The distribution of a measure per category, mirrored. Channels: x, y, color, row.

Value
FlintChartType.Boxplot
Boxplot

Quartiles, whiskers and outliers of a measure per category. Channels: x, y, color, opacity, column, row.

Value
FlintChartType.PyramidChart
PyramidChart

Two distributions back to back, such as a population by age and sex. Channels: x, y, color.

Value
FlintChartType.CandlestickChart
CandlestickChart

Open, high, low and close per period. Channels: x, open, high, low, close, column, row.

Value
FlintChartType.LineChart
LineChart

A measure over a continuous axis, one line per color. Channels: x, y, color, strokeDash, detail, opacity, column, row.

Value
FlintChartType.Sparkline
Sparkline

A small line without axes, for a trend at a glance. Channels: x, y, color, detail, row, column.

Value
FlintChartType.BumpChart
BumpChart

The rank of each series over time. Channels: x, y, color, detail, column, row.

Value
FlintChartType.SlopeChart
SlopeChart

A change between two points in time, one line per series. Channels: x, y, color, detail, column, row.

Value
FlintChartType.AreaChart
AreaChart

A line with the area under it filled, stacked by color. Channels: x, y, color, opacity, column, row.

Value
FlintChartType.Streamgraph
Streamgraph

Stacked areas around a moving centre line. Channels: x, y, color, column, row.

Value
FlintChartType.RangeAreaChart
RangeAreaChart

The band between y and y2 over x. Channels: x, y, y2, color, column, row.

Value
FlintChartType.PieChart
PieChart

Shares of a whole as slices; the measure is size. Channels: size, color, column, row.

Value
FlintChartType.DonutChart
DonutChart

A pie with a hole (innerRadius). Channels: size, color, column, row.

Value
FlintChartType.RoseChart
RoseChart

Equal-angle wedges whose radius is the measure. Channels: x, y, color, column, row.

Value
FlintChartType.RadarChart
RadarChart

Measures on spokes around a centre, one polygon per series. Channels: x, y, color, column, row.

Value
FlintChartType.Heatmap
Heatmap

A grid of x by y cells coloured by a measure. Channels: x, y, color, column, row.

Value
FlintChartType.CalendarHeatmap
CalendarHeatmap

A measure per day, laid out as weeks of a year. Channels: x, color.

Value
FlintChartType.BarTable
BarTable

A table with an inline bar per row. Channels: y, x, color, column, row.

Value
FlintChartType.KpiCard
KpiCard

One headline number per metric, with its goal. Channels: metric, value, goal.

Value
FlintChartType.Table
Table

The rows themselves, as a table. No channels.

Value
FlintChartType.Map
Map

Points at longitude and latitude on a map (region). Channels: longitude, latitude, color, size, opacity.

Value
FlintChartType.Choropleth
Choropleth

Regions of a map coloured by a measure (region, level). Channels: id, color, detail.

enum

FlintChannel

public enum FlintChannel

The encoding channels of a FlintChart: which field drives which visual property. Which ones a chart reads depends on its FlintChartType, and a channel it does not have fails the chart with Flint's reason.

Namespace
Tesserae

Values

NameDescription
ColumnSmall multiples: one panel per value, side by side.
RowSmall multiples: one panel per value, one under another.
Value
FlintChannel.Column
Column

Small multiples: one panel per value, side by side.

Value
FlintChannel.Row
Row

Small multiples: one panel per value, one under another.

enum

FlintSemanticType

public enum FlintSemanticType

What a field of a FlintChart's data means. Flint picks the encoding type, the zero baseline, the colour scheme and the number format from it; a field with none is inferred from its values.

Namespace
Tesserae
enum

FlintEncodingType

public enum FlintEncodingType

How a field is encoded, when the one Flint infers from its FlintSemanticType is not the one meant.

Namespace
Tesserae
enum

FlintAggregate

public enum FlintAggregate

How the rows behind one mark are summed into its value.

Namespace
Tesserae
enum

FlintInteraction

public enum FlintInteraction

The interactions Flint ships as presets, for Interactions. One the chart type cannot honour is dropped with a warning rather than failing the chart.

Namespace
Tesserae

Values

NameDescription
InspectMove the pointer to read values with guides.
InspectIndexMove along one axis to read every series at that position.
ClickHighlightClick a mark, key entry or axis label to emphasise it and mute the rest.
AxisHighlightHover or click a category's axis label to emphasise it.
ClickGroupFocusClick a mark to emphasise every mark of its group.
HoverGroupFocusHover a mark to preview its group.
ClickAnnotateClick a mark to pin an annotation on it.
SelectDrag a rectangle to emphasise the marks inside it.
LassoSelectDraw a freehand region to emphasise the marks inside it.
BrushXDrag an interval along x.
BrushYDrag an interval along y.
BrushAngleDrag an angular sector on a polar chart.
BrushZoomDrag a rectangle to zoom to it.
LinkedBrushBrush marks and emphasise every mark of their group.
LegendToggleClick a key entry to hide or restore its series.
LongPressHold on a mark to emphasise it.
DoubleActivateDouble-click a mark to emphasise it.
NavigateDrag to pan, wheel or pinch to zoom.
DragReorderDrag a mark or an axis label to reorder the categories.
AccessibleNavigationTab into the chart and walk it with the keyboard.
Value
FlintInteraction.Inspect
Inspect

Move the pointer to read values with guides.

Value
FlintInteraction.InspectIndex
InspectIndex

Move along one axis to read every series at that position.

Value
FlintInteraction.ClickHighlight
ClickHighlight

Click a mark, key entry or axis label to emphasise it and mute the rest.

Value
FlintInteraction.AxisHighlight
AxisHighlight

Hover or click a category's axis label to emphasise it.

Value
FlintInteraction.ClickGroupFocus
ClickGroupFocus

Click a mark to emphasise every mark of its group.

Value
FlintInteraction.HoverGroupFocus
HoverGroupFocus

Hover a mark to preview its group.

Value
FlintInteraction.ClickAnnotate
ClickAnnotate

Click a mark to pin an annotation on it.

Value
FlintInteraction.Select
Select

Drag a rectangle to emphasise the marks inside it.

Value
FlintInteraction.LassoSelect
LassoSelect

Draw a freehand region to emphasise the marks inside it.

Value
FlintInteraction.BrushX
BrushX

Drag an interval along x.

Value
FlintInteraction.BrushY
BrushY

Drag an interval along y.

Value
FlintInteraction.BrushAngle
BrushAngle

Drag an angular sector on a polar chart.

Value
FlintInteraction.BrushZoom
BrushZoom

Drag a rectangle to zoom to it.

Value
FlintInteraction.LinkedBrush
LinkedBrush

Brush marks and emphasise every mark of their group.

Value
FlintInteraction.LegendToggle
LegendToggle

Click a key entry to hide or restore its series.

Value
FlintInteraction.LongPress
LongPress

Hold on a mark to emphasise it.

Value
FlintInteraction.DoubleActivate
DoubleActivate

Double-click a mark to emphasise it.

Value
FlintInteraction.Navigate
Navigate

Drag to pan, wheel or pinch to zoom.

Value
FlintInteraction.DragReorder
DragReorder

Drag a mark or an axis label to reorder the categories.

Value
FlintInteraction.AccessibleNavigation
AccessibleNavigation

Tab into the chart and walk it with the keyboard.

class

FlintNames

internal static class FlintNames

The names Flint gives the values of the enums above, which are not C# identifiers.

Namespace
Tesserae

Methods

NameDescription
TryChartTypeThe chart type Flint calls name, if it is one of them.
Method
FlintNames.TryChartType
internal static bool TryChartType(string name, out FlintChartType type)

The chart type Flint calls name, if it is one of them.

class

FlintEncoding

public sealed class FlintEncoding

How one field is drawn on one channel of a FlintChart, for when a field name alone does not say enough (Encode). Every property is optional: what is left unset is decided by Flint from the field's semantic type and the theme.

Namespace
Tesserae

Constructors

NameDescription
FlintEncoding
Constructor
FlintEncoding
public FlintEncoding(string field)

Parameters

field
The field of the data the channel draws.

Properties

NameDescription
FieldThe field of the data the channel draws.
TypeThe encoding type, in place of the one the semantic type implies.
AggregateHow the rows behind one mark are summed.
SortAscendingSorts the channel's categories by their value, ascending (true) or descending (false).
SortByThe field the channel's categories are sorted by, with SortAscending.
SchemeColour channel: a Vega scheme name (viridis, redblue), in place of the theme's ramp.
SchemeColorsColour channel: the stops a ramp or palette runs through, low end first, as #rrggbb.
ReverseColour channel: runs the scale the other way round.
TitleThe name the channel's axis or key prints, in place of the field's; an empty string prints none.
Property
FlintEncoding.Field
public string Field { get; set; }

The field of the data the channel draws.

Property
FlintEncoding.Type
public FlintEncodingType? Type { get; set; }

The encoding type, in place of the one the semantic type implies.

Property
FlintEncoding.Aggregate
public FlintAggregate? Aggregate { get; set; }

How the rows behind one mark are summed.

Property
FlintEncoding.SortAscending
public bool? SortAscending { get; set; }

Sorts the channel's categories by their value, ascending (true) or descending (false).

Property
FlintEncoding.SortBy
public string SortBy { get; set; }

The field the channel's categories are sorted by, with SortAscending.

Property
FlintEncoding.Scheme
public string Scheme { get; set; }

Colour channel: a Vega scheme name (viridis, redblue), in place of the theme's ramp.

Property
FlintEncoding.SchemeColors
public string[] SchemeColors { get; set; }

Colour channel: the stops a ramp or palette runs through, low end first, as #rrggbb.

Property
FlintEncoding.Reverse
public bool Reverse { get; set; }

Colour channel: runs the scale the other way round.

Property
FlintEncoding.Title
public string Title { get; set; }

The name the channel's axis or key prints, in place of the field's; an empty string prints none.

Methods

NameDescription
ToSpecThe encoding as Flint reads it.
Method
FlintEncoding.ToSpec
internal object ToSpec()

The encoding as Flint reads it.

See also