Custom Graph Reference
A complete list of Geometries and Statistics available in Custom Graph. Click the help button (?) in the layer settings for details on each item.
Geometry
| Geometry | Description |
|---|
| Point (Scatter) | Displays data as individual points. |
| Line | Connects data points with lines. Draws an interval band automatically when ymin/ymax are present. |
| Bar | Vertical bars for categorical data. Use Fill (not Color) to change bar color. |
| Area | Filled area under line. |
| Tile (Heatmap) | Grid of colored cells. Use Fill to set cell colors. |
| Step (Kaplan-Meier) | Stair-step line pattern. Used for Kaplan-Meier curves and ECDF. |
| Ribbon (Confidence Band) | Shaded area between ymin and ymax (confidence bands). |
| Error Bar | Error bars showing ymin to ymax range with caps. |
| Crossbar | Rectangle spanning ymin to ymax with a line at y. Combine with the Summary statistic to draw an interval around a center value (e.g. mean and mean±SE). |
| Box Plot | Box-and-whisker plot per group: box from Q1 to Q3, median line, whiskers, and individual points beyond the whiskers. Use with the Boxplot statistic. |
| Vertical Line (Reference) | Fixed vertical reference line. Configure style in the layer settings. |
| Horizontal Line (Reference) | Fixed horizontal reference line. Configure style in the layer settings. |
| Contour | Draws a curve from a series of points. Used for Cook's distance contours in regression diagnostics. |
| Density 2D | 2D kernel density estimation as contour lines. For 1D density curves, use the Density (KDE) statistic. |
| Text (Label) | Displays text labels at data points. Requires the Label aesthetic. |
| Label (Annotation) | Displays text boxes with leader lines at data points. Includes automatic collision avoidance. |
Geometry–aesthetic compatibility
Each geometry accepts a specific set of aesthetics — visual mappings such as position, color, and size. Mapping an unsupported aesthetic to a geometry has no effect.
| Geometry | x | y | color | fill | stroke | size | shape | alpha | linetype | ymin | ymax | label |
|---|
| point | R | R | • | | • | • | • | • | | | | |
| line | R | R | • | | | • | | • | • | ○ | ○ | |
| bar | R | R | | • | | | | • | | | | |
| area | R | R | • | • | | | | • | | | | |
| tile | R | R | | • | | | | • | | | | |
| step | R | R | • | | | • | | • | • | | | |
| ribbon | R | | • | • | | | | • | | R | R | |
| errorbar | R | | • | | | | | • | | R | R | |
| crossbar | R | R | • | • | | | | • | | R | R | |
| boxplot | R | R | • | • | | • | • | • | | R | R | |
| vline | • | | • | | | | | | | | | |
| hline | | • | • | | | | | | | | | |
| contour | R | R | • | | | | | • | | | | |
| density2d | R | R | | | | | | • | | | | |
| text | R | R | • | | | • | | • | | | | R |
| label | R | R | • | | | | | • | | | | • |
R = required, ○ = optional (triggers additional behavior when present), • = supported.
- Required aesthetics must be mapped to a column or provided by a statistic.
- color vs fill: Bar and Tile use
fill for their interior color, not color. Area accepts both — color for the outline and fill for the interior. Ribbon draws no outline; color sets its fill color, and Ribbon's fill is only used with a threshold color scale. Crossbar and Box Plot use fill for the rectangle interior and color for the lines (for Box Plot: box outline, whiskers, median line, and the points beyond the whiskers).
- stroke: Only Point supports
stroke, which sets a separate outline color.
- shape on Box Plot splits the boxes by the mapped column's levels (like
color and fill) and draws the points beyond the whiskers with distinct marker shapes. size applies only to the points beyond the whiskers.
- ymin / ymax: Line draws an interval band when both are present. Ribbon, Errorbar, Crossbar, and Box Plot require them.
- q1 / q3: Box Plot needs quartiles for the top and bottom edges of the box. They cannot be mapped to a column, so the table lists no column for them, and only the Boxplot statistic supplies them.
- label: Text requires a mapped column. Label needs either
aes.label or geom.defaults.labelContent.
- weight: This aesthetic has no column in the table because it does not affect how any Geometry is drawn. It maps a numeric column of frequency weights (how many observations each row stands for), and only statistics that support weights (ROC Curve) read it. The
$n tooltip variable counts the rows used in the calculation and does not sum the weights.
Geometry–position compatibility
Each Geometry accepts a different set of position adjustments. See Position for what each position type means. Specifying a position type not listed below in tabs.addGraphLayer / tabs.updateGraphLayer returns an INVALID_INPUT error. When position is omitted, bar geom defaults to stack and other geoms default to identity.
| Geometry | Allowed positions |
|---|
| point | identity, dodge, jitter |
| line | identity |
| bar | identity, stack, dodge, fill |
| area | identity, stack, fill |
| tile | identity |
| step | identity |
| ribbon | identity |
| errorbar | identity, dodge, jitter |
| crossbar | identity, dodge |
| boxplot | identity, dodge |
| vline | identity |
| hline | identity |
| contour | identity |
| density2d | identity |
| text | identity |
| label | identity |
MIDAS validates the position against the statistics as well as the geometry. The statistics listed in the following table can be combined only with the listed positions. Statistics not in the table accept every position. The set you can actually specify is the intersection with the geometry's allowed positions, and a position outside the intersection returns the same INVALID_INPUT error. stack and fill stack or normalize only the y values while the box and whisker values produced by the Boxplot stat stay unchanged, so the axis labeling would contradict the graph content. This is why the Boxplot stat cannot be combined with these positions.
| Statistics | Allowed positions |
|---|
| Boxplot (Quartiles + Whiskers) | identity, dodge, jitter |
Geometry and continuous color scales
A channel assigned a continuous color scale (sequential or diverging) does not split a layer into series. Line, Area, Step, and Ribbon each draw one path per layer, and the color becomes a gradient that varies along the X axis. In a flipped coordinate system it varies along the Y axis. Each data point places a gradient stop at its own position with the color resolved from that point's value, and the color is interpolated between points. Splitting the path by value would leave single-point paths for a column whose values differ from row to row, and a path with no length is not drawn.
To split paths by value, set the channel's scaleType to categorical.
Area's stack and fill positions stack one series onto another, which a continuous color scale does not provide. MIDAS draws such a layer with position identity and shows a warning above the graph. Bar draws one rectangle per point, so it stacks even with a continuous color scale.
Statistics
| Statistics | Description |
|---|
| Identity (No transformation) | Passes data through without transformation. |
| Bin (Histogram) | Groups numeric data into bins and counts occurrences. |
| Time Bin (Datetime Histogram) | Groups datetime data into time intervals. |
| Smooth (Regression) | Fits a smoothing curve with linear regression or LOESS. Optionally computes ymin/ymax as either a prediction interval for a new individual observation or a confidence interval for the mean response; Line geom draws the band automatically, Ribbon geom can also be used. |
| Count (Aggregation) | Counts occurrences for each X value. |
| Density (KDE) | Estimates probability density using kernel density estimation. |
| Summary (Aggregation) | Aggregates Y values by X using mean, sum, median, min, max, standard deviation, or variance. |
| Boxplot (Quartiles + Whiskers) | Computes the median, quartiles (linear interpolation), whisker ends (most extreme data values within coef × IQR of the quartiles), and the individual data values beyond the whiskers for each group. Use with the Box Plot geometry. |
| Survival (Kaplan-Meier) | Computes Kaplan-Meier survival estimates. Map the time to X (positive values) and the event indicator to Y (1 = event, 0 = censored). If X contains zero or negative values or Y contains values other than 0 and 1, no curve is drawn and the layer warning lists which values appear in how many rows. |
| ROC Curve | Computes ROC curve points (false positive rate vs true positive rate) from binary labels and scores. Ties in the score are merged into one threshold, so the area under the curve matches the AUC computed with ties counted as one half. Map the score to X and the label to Y — 0/1 values, or proportions of positives in [0, 1] for aggregated data. Optionally map a frequency weight (e.g., the number of trials behind each proportion) to Weight. |
| X Mean | Calculates the mean of X values. Use with vline geom to draw a vertical reference line. |
| X Median | Calculates the median of X values. Use with vline geom to draw a vertical reference line. |
| Y Mean | Calculates the mean of Y values. Use with hline geom to draw a horizontal reference line. |
| Cumulative Sum (Pareto) | Computes cumulative sum of Y values. Combine with Sort and Bar + Line to create Pareto charts. |
| Sort (Pareto) | Sorts data by Y values in descending order. Combine with Cumulative Sum to create Pareto charts. |
| ECDF (Empirical CDF) | Computes empirical cumulative distribution function. |
| QQ (Normal Q-Q Plot) | Computes quantiles for a normal Q-Q plot, using Hazen plotting positions ((i + 0.5) / n) for the theoretical quantiles. |
| Transform (Linear) | Applies linear transformation (multiply and add) to Y values. |
Statistics parameters
Each Statistic accepts a params object in the stats array passed to tabs.addGraphLayer / tabs.updateGraphLayer. The tables below list the parameter name, TypeScript type, default value, and a short description for every Statistic.
await window.midas.tabs.addGraphLayer('tab_001', {
geom: { type: 'point' },
stats: [
{ type: 'smooth', params: { method: 'loess', span: 0.5, interval: 'confidence' } }
],
aes: { x: 'weight', y: 'mpg' }
});
In the type column: A | B means either value is accepted, T[] means an array of T, and a trailing ? on a field name (e.g. p?) marks it as optional. For the full behavior of each Statistic — assumptions, limits, and worked examples — see Custom Graph.
Identity (No transformation)
No parameters.
Bin (Histogram)
| Name | Type | Default | Description |
|---|
bins | number | 30 | Number of bins (1-100). Ignored when binwidth is specified. |
binwidth | number | — | Width of each bin in X-axis units (must be positive). Takes precedence over bins. |
yScale | 'count' | 'density' | 'proportion' | 'count' | Y-axis scale: 'count' reports bin counts; 'density' reports probability density (bin counts divided by the number of binned observations × binwidth, so the area over equal-width bins equals 1); 'proportion' reports each bin's share of its own group, so the values of every group sum to 1. With a categorical aesthetic such as fill, both 'density' and 'proportion' use a per-group denominator, so each group reaches an area of 1 (density) or a total of 1 (proportion) on its own; stacking groups whose denominators differ produces a total with no interpretation. Both denominators count the observations that were binned, which excludes missing values of the binned column. |
boundary | number | — | Position of a bin edge in X-axis units. Bins are aligned so that one edge falls on this value. |
center | number | — | Position of a bin center in X-axis units. Takes precedence over boundary. |
Time Bin (Datetime Histogram)
| Name | Type | Default | Description |
|---|
interval | 'auto' | '1min' | '5min' | '15min' | '30min' | '1hour' | '6hour' | '12hour' | '1day' | '1week' | '1month' | '3month' | '1year' | 'auto' | Time interval for bins. 'auto' chooses based on data range. '1min' through '1week' are fixed-width intervals; '1month', '3month', and '1year' bin by calendar boundaries in the viewer's local time (start of month, quarter, or year), so bin widths follow the calendar (e.g. 28-31 days for months) and observations near a boundary can fall into a different bin when the graph is viewed in a different time zone. |
yScale | 'count' | 'density' | 'proportion' | 'count' | Y-axis scale: 'count' reports bin counts (with calendar intervals the bins span unequal durations, so counts reflect both the rate and the length of each bin); 'density' reports probability density (bin counts divided by the number of binned observations × each bin's width in milliseconds; calendar intervals use each bin's actual width, so the total area equals 1); 'proportion' reports each bin's share of its own group, so the values of every group sum to 1 (the bin width does not enter, so with calendar intervals the share also reflects the length of each bin). With a categorical aesthetic such as fill, both 'density' and 'proportion' use a per-group denominator, so each group reaches an area of 1 (density) or a total of 1 (proportion) on its own; stacking groups whose denominators differ produces a total with no interpretation. Both denominators count the observations that were binned, which excludes missing values of the binned column. |
Smooth (Regression)
| Name | Type | Default | Description |
|---|
method | 'lm' | 'loess' | 'loess' | Smoothing method: 'lm' for ordinary least squares, 'loess' for locally weighted regression (tricube kernel, local linear). When a grouping aesthetic (color, fill, etc.) is mapped, a separate curve is fit per group. |
se | boolean | true | When true, emits ymin/ymax for an interval band (Line geom draws the band automatically). The name follows ggplot2's se argument, but the emitted values are the interval endpoints (ymin/ymax), not a standard error. |
span | number | 0.75 | LOESS span: fraction of points in each local neighborhood (0.1-1.0). Larger values produce smoother curves. Ignored when method is lm. |
level | number | 95 | Interval level in percent (50-99.99), the same unit as confidenceLevel of models.run(). For example, 95 for a 95% interval. For loess, the interval uses simplified degrees of freedom (df = n - tr(L)) and does not account for smoothing bias, so at large spans the actual coverage can deviate from this nominal level. |
interval | 'confidence' | 'prediction' | 'prediction' | Interval type. 'prediction' (the default) is for a new individual observation (wider, includes residual variance); 'confidence' is for the mean response (narrower). See Prediction interval in the glossary for assumptions and limits. |
Count (Aggregation)
No parameters.
Density (KDE)
| Name | Type | Default | Description |
|---|
bandwidth | number | — | Kernel bandwidth in X-axis units (must be positive when specified). When omitted, bandwidth is selected automatically by Silverman's rule of thumb (0.9 × min(SD, IQR/1.34) × n^(-1/5); no curve is drawn when this is 0, e.g. a constant middle 50%, identical values, or a single observation), which assumes a roughly normal shape and can oversmooth multimodal data. |
kernel | 'gaussian' | 'gaussian' | Kernel function. Only Gaussian is supported. |
yScale | 'density' | 'count' | 'density' | Y-axis scale: 'density' reports probability density (area equals 1; with a categorical aesthetic such as color, the curve of each group reaches an area of 1 on its own). 'count' scales density by n × binwidth, where binwidth is computed internally (via Sturges) and may not match a co-plotted Bin layer's Y scale exactly; to overlay a histogram and a density curve on a common scale, set both layers to 'density', which normalizes per group on both sides. The binwidth is computed per group from its own range and observation count, so with a categorical aesthetic the 'count' curves of different groups use different binwidths and their heights are not directly comparable. A group whose values are all identical has a binwidth of 0, so no 'count' curve is drawn for it and the group is reported in the diagnostics. |
Summary (Aggregation)
| Name | Type | Default | Description |
|---|
outputs | SummaryOutputDef[] | [{ fun: 'mean', to: 'y' }] | Output definitions. Each entry is { fun, to, p?, k? }. fun selects the aggregation: 'mean', 'sum', 'median', 'min', 'max', 'sd' (sample SD, n-1 denominator), 'var' (sample variance, n-1 denominator), 'lower_se' (mean - SE, where SE = SD / sqrt(n)), 'upper_se' (mean + SE), 'lower_sd' (mean - SD), 'upper_sd' (mean + SD), 'quantile' (p-quantile with linear interpolation), 'mean_plus_k_sd' (mean + k * SD), 'mean_minus_k_sd' (mean - k * SD). to is the target aesthetic: 'y', 'ymin', or 'ymax' for positions, or 'fill', 'color', 'size', or 'alpha' to drive that scale with the aggregated value. p (0-1) selects the quantile for 'quantile'; when omitted, 0.5 (the median) is used. k (default 1) is the SD multiplier for 'mean_plus_k_sd' / 'mean_minus_k_sd'. |
complete | boolean | false | When true, fills missing X × Y combinations with 0 before aggregation. Intended for count-like aggregations; with 'mean' or 'median' the zero-fill biases the result. |
Boxplot (Quartiles + Whiskers)
| Name | Type | Default | Description |
|---|
coef | number | 1.5 | Whisker length as a multiple of the IQR (must be non-negative). Whiskers extend to the most extreme data values within coef × IQR of the quartiles; data values beyond the whiskers are drawn as individual points. |
Survival (Kaplan-Meier)
| Name | Type | Default | Description |
|---|
confLevel | number | 95 | Confidence level in percent (50-99.99), the same unit as confidenceLevel of models.run(), for the pointwise confidence interval of S(t): each interval holds at a single time point and is not a simultaneous band covering the whole curve. Variance is estimated with Greenwood's formula and the interval is constructed on the log scale, so the lower bound stays positive while S(t) is positive and the upper bound is clipped to 1; at time points where S(t) is exactly 0 or 1 the interval collapses to that value. |
ROC Curve
| Name | Type | Default | Description |
|---|
showReferenceLine | boolean | true | When true, draws the diagonal reference line y = x, the ROC curve of a classifier that assigns labels independently of the data. |
X Mean
| Name | Type | Default | Description |
|---|
label | string | 'Mean: {value}' | Label template for the reference line. {value} is replaced with the computed mean. |
| Name | Type | Default | Description |
|---|
label | string | 'Median: {value}' | Label template for the reference line. {value} is replaced with the computed median. |
Y Mean
| Name | Type | Default | Description |
|---|
offset | number | 0 | Number of sample SDs added to the mean; not a raw offset on the Y-axis. SD is the sample standard deviation (n-1) of the plotted Y values (computed per group when a grouping aesthetic is mapped), not a within-subgroup SD. For example, 3 draws a line at mean + 3 × SD (upper control limit, UCL), and -3 at mean − 3 × SD (lower control limit, LCL). No line is drawn for a group whose SD cannot be computed (a single observation, or values whose range is too wide for double precision); the graph warning names the group. |
label | string | 'Mean: {value}' | Label template for the reference line. {value} is replaced with the computed value. |
Cumulative Sum (Pareto)
| Name | Type | Default | Description |
|---|
normalize | boolean | false | When true, scales the cumulative sum so the total equals 100 (percent). |
Sort (Pareto)
| Name | Type | Default | Description |
|---|
order | 'ascending' | 'descending' | 'descending' | Sort direction applied to Y values. |
limit | number | — | Keep only the top N categories after sorting (a positive integer). Omit to keep all categories. |
displayOrder | 'alphabetical' | — | Re-sorts the kept categories by category name, in Unicode code point order (all uppercase letters come before all lowercase letters). Only 'alphabetical' is supported; omit to keep the sort order selected by 'order'. |
ECDF (Empirical CDF)
No parameters.
QQ (Normal Q-Q Plot)
| Name | Type | Default | Description |
|---|
showReferenceLine | boolean | true | When true, draws a reference line to assess deviation from normality. |
referenceLineType | 'q1q3' | 'identity' | 'q1q3' | Reference line type. 'q1q3' passes through the first and third quartiles, taken as order statistics without interpolation (so they can differ from the interpolated 'quantile' summary); use it for raw data on its original scale. 'identity' is y = x; use it only when the input is already standardized (e.g., z-scores centered at 0 and scaled by SD). |
| Name | Type | Default | Description |
|---|
multiply | number | 1 | Multiplier applied to Y. For example, -1 flips a histogram for a population pyramid. |
add | number | 0 | Offset added after multiplication. |
Palettes
Available values for paletteId in the color / fill aesthetic of layers[].scales. See Agent API for how to set palettes via API.
Categorical
For coloring by categorical variables. Use with scaleType: 'categorical'.
| ID | Name | Colors |
|---|
midas-default | MIDAS Default | 12 |
tableau10 | Tableau 10 | 10 |
d3-category10 | D3 Category10 | 10 |
Default: midas-default.
Sequential
For continuous or ordinal variables. Use with scaleType: 'sequential'.
Also usable with scaleType: 'categorical' and 'threshold'. In those modes, one color per category or threshold region is sampled at equal intervals across the full palette range.
| ID | Name | Colors |
|---|
blues | Blues | 9 |
greens | Greens | 9 |
greys | Greys | 9 |
purples | Purples | 9 |
ylorrd | Yellow-Orange-Red | 9 |
viridis | Viridis | 10 |
plasma | Plasma | 10 |
inferno | Inferno | 10 |
magma | Magma | 10 |
Default: blues. Viridis, Plasma, Inferno, and Magma are perceptually uniform and accommodate color vision diversity.
Diverging
For variables that diverge in both directions from a center value. Use with scaleType: 'diverging'.
Also usable with scaleType: 'threshold'. In that mode, one color per threshold region is sampled at equal intervals across the full palette range.
| ID | Name | Colors |
|---|
rdbu | Red-Blue | 11 |
brbg | Brown-Teal | 11 |
Default: rdbu.
scaleType and paletteId compatibility
| scaleType | Accepted paletteId |
|---|
categorical | Categorical + Sequential palettes |
sequential | Sequential palettes only |
diverging | Diverging palettes only |
threshold | Sequential + Diverging palettes |
With threshold, you can also specify colors directly via thresholdColors. When thresholdColors is set, it takes precedence; when omitted, one color per threshold region is sampled at equal intervals across the paletteId palette.
In the Graph Builder UI, switching the scale type automatically resets an incompatible palette to that scale type's default, and the graph keeps rendering. When an incompatible paletteId is set directly via the API, the graph fails to render at draw time.
Compatibility is checked against the effective scale type. When sequential / diverging is specified for a non-numeric column, the effective type becomes categorical, so a palette that matches the specified type in the table above can still fail. The error message explains how the type was resolved.
Fixed geometry settings
Aesthetics map a column to a visual attribute. A constant color, size, or opacity that does not depend on data belongs in geom.defaults, not in aes. In the Graph Builder UI these settings are in the layer's Geometry section.
- Fixed color: Set the line, point, or text color with
color in geom.defaults; set the fill color of bar, area, tile, ribbon, crossbar, and box plot with fill (any CSS color string). The border color of tile is stroke. Crossbar and box plot also use stroke for their fixed line color (box outline, center line, and whiskers) — they have no color key in geom.defaults.
- Fixed size: Set
size (point radius), strokeWidth (line width of line-drawing geometries), or fontSize (text, label) in geom.defaults. The tables in geom.defaults keys by geometry show which geometry has which key.
- Fixed opacity: Set
alpha in geom.defaults, where 0 is fully transparent and 1 is fully opaque.
await window.midas.tabs.addGraphLayer(tabId, {
geom: { type: 'point', defaults: { color: '#3366CC', size: 8, alpha: 0.5 } },
aes: { x: 'weight', y: 'height' }
});
Passing a fixed value through aes (for example aes.color: { fixedColor: ... } or aes.size: 8) returns an INVALID_INPUT error. aes.* accepts a column name only.
geom.defaults keys by geometry
The keys accepted in geom.defaults differ by geometry. The tables below list each geometry's key names, types, ranges, default values, and descriptions. They are the same set as the items in the Geometry section of the layer settings in the Graph Builder UI, and a key you omit is drawn with its default value. The Range column is the range selectable in the Graph Builder UI.
Two structured settings are not in the tables. Contour's points is an array of { x, y } that makes up the curve and can be set only through the Agent API. Label's labelContent displays Statistics output as the label and is described in Using labels with statistics.
Point (Scatter)
| Key | Type | Range | Default | Description |
|---|
color | string (CSS color) | — | '#4682b4' | Point color used when no column is mapped to the color aesthetic. Any CSS color string. |
size | number | 1–20 | 5 | Point radius in pixels, used when no column is mapped to the size aesthetic. |
alpha | number | 0–1 | 0.7 | Opacity of the layer, from 0 (fully transparent) to 1 (fully opaque). |
Line
| Key | Type | Range | Default | Description |
|---|
color | string (CSS color) | — | '#4682b4' | Line color used when no column is mapped to the color aesthetic. Any CSS color string. |
strokeWidth | number | 1–5 | 2 | Line width in pixels. |
lineType | 'solid' | 'dashed' | 'dotted' | — | 'solid' | Dash pattern of the line. |
alpha | number | 0–1 | 0.9 | Opacity of the layer, from 0 (fully transparent) to 1 (fully opaque). |
Bar
| Key | Type | Range | Default | Description |
|---|
fill | string (CSS color) | — | '#4682b4' | Bar fill color used when no column is mapped to the fill aesthetic. Any CSS color string. |
width | number | 0.1–1 | 0.8 | Bar width as a fraction of the category band width. |
alpha | number | 0–1 | 0.8 | Opacity of the layer, from 0 (fully transparent) to 1 (fully opaque). |
Area
| Key | Type | Range | Default | Description |
|---|
fill | string (CSS color) | — | '#4682b4' | Fill color of the area used when no column is mapped to the fill aesthetic. Any CSS color string. |
alpha | number | 0–1 | 0.5 | Opacity of the layer, from 0 (fully transparent) to 1 (fully opaque). |
Tile (Heatmap)
| Key | Type | Range | Default | Description |
|---|
fill | string (CSS color) | — | '#cccccc' | Cell fill color used when no column is mapped to the fill aesthetic. Any CSS color string. |
stroke | string (CSS color) | — | '#ffffff' | Border color of each cell. Any CSS color string. |
strokeWidth | number | 0–5 | 0.5 | Border width of each cell in pixels. 0 draws no border. |
alpha | number | 0–1 | 1 | Opacity of the layer, from 0 (fully transparent) to 1 (fully opaque). |
Step (Kaplan-Meier)
| Key | Type | Range | Default | Description |
|---|
color | string (CSS color) | — | '#4682b4' | Line color used when no column is mapped to the color aesthetic. Any CSS color string. |
strokeWidth | number | 1–5 | 2 | Line width in pixels. |
lineType | 'solid' | 'dashed' | 'dotted' | — | 'solid' | Dash pattern of the line. |
alpha | number | 0–1 | 0.9 | Opacity of the layer, from 0 (fully transparent) to 1 (fully opaque). |
Ribbon (Confidence Band)
| Key | Type | Range | Default | Description |
|---|
fill | string (CSS color) | — | '#4682b4' | Band fill color used when no column is mapped to the fill aesthetic. Any CSS color string. |
curveType | 'linear' | 'stepAfter' | 'stepBefore' | — | 'linear' | How the band edges connect consecutive points: straight segments, or a step that changes after or before each x value. |
alpha | number | 0–1 | 0.2 | Opacity of the layer, from 0 (fully transparent) to 1 (fully opaque). |
Error Bar
| Key | Type | Range | Default | Description |
|---|
color | string (CSS color) | — | '#333333' | Color of the bars and caps used when no column is mapped to the color aesthetic. Any CSS color string. |
strokeWidth | number | 0.5–5 | 1.5 | Width of the bars and caps in pixels. |
capWidth | number | 0–20 | 8 | Width of the caps at ymin and ymax in pixels. 0 draws no caps. |
alpha | number | 0–1 | 0.8 | Opacity of the layer, from 0 (fully transparent) to 1 (fully opaque). |
Crossbar
| Key | Type | Range | Default | Description |
|---|
fill | string (CSS color) | — | '#4682b4' | Fill color of the rectangle used when no column is mapped to the fill aesthetic. Any CSS color string. |
stroke | string (CSS color) | — | '#333333' | Color of the outline and the center line used when no column is mapped to the color aesthetic. Any CSS color string. |
width | number | 0.1–1 | 0.6 | Rectangle width as a fraction of the category band width. |
strokeWidth | number | 0.5–5 | 1.5 | Width of the outline and the center line in pixels. |
alpha | number | 0–1 | 0.8 | Opacity of the layer, from 0 (fully transparent) to 1 (fully opaque). |
Box Plot
| Key | Type | Range | Default | Description |
|---|
fill | string (CSS color) | — | '#4682b4' | Box fill color used when no column is mapped to the fill aesthetic. Any CSS color string. |
stroke | string (CSS color) | — | '#333333' | Color of the box outline, the median line, and the whiskers used when no column is mapped to the color aesthetic. Any CSS color string. |
width | number | 0.1–1 | 0.6 | Box width as a fraction of the category band width. |
strokeWidth | number | 0.5–5 | 1.5 | Width of the box outline, the median line, and the whiskers in pixels. |
pointSize | number | 1–10 | 2.5 | Radius in pixels of the points drawn beyond the whiskers. |
alpha | number | 0–1 | 0.8 | Opacity of the layer, from 0 (fully transparent) to 1 (fully opaque). |
Vertical Line (Reference)
| Key | Type | Range | Default | Description |
|---|
xintercept | number | — | — | X value at which the line is drawn. When omitted, a line is drawn at each value of the column mapped to x. |
lineType | 'solid' | 'dashed' | 'dotted' | — | 'dashed' | Dash pattern of the line. |
color | string (CSS color) | — | '#888888' | Line color used when no column is mapped to the color aesthetic. Any CSS color string. |
strokeWidth | number | 1–5 | 1 | Line width in pixels. |
alpha | number | 0–1 | 0.7 | Opacity of the layer, from 0 (fully transparent) to 1 (fully opaque). |
Horizontal Line (Reference)
| Key | Type | Range | Default | Description |
|---|
yintercept | number | — | — | Y value at which the line is drawn. When omitted, a line is drawn at each value of the column mapped to y. |
lineType | 'solid' | 'dashed' | 'dotted' | — | 'dashed' | Dash pattern of the line. |
color | string (CSS color) | — | '#888888' | Line color used when no column is mapped to the color aesthetic. Any CSS color string. |
strokeWidth | number | 1–5 | 1 | Line width in pixels. |
alpha | number | 0–1 | 0.7 | Opacity of the layer, from 0 (fully transparent) to 1 (fully opaque). |
Contour
| Key | Type | Range | Default | Description |
|---|
strokeWidth | number | 1–5 | 1.5 | Line width in pixels. |
lineType | 'solid' | 'dashed' | 'dotted' | — | 'solid' | Dash pattern of the line. |
color | string (CSS color) | — | '#888888' | Line color of the curve. Any CSS color string. |
alpha | number | 0–1 | 0.6 | Opacity of the layer, from 0 (fully transparent) to 1 (fully opaque). |
Density 2D
| Key | Type | Range | Default | Description |
|---|
bandwidth | 'auto' | number | — | 'auto' | Kernel bandwidth as a fraction of the mean of the x and y axis ranges. auto chooses the bandwidth by Scott's rule. The UI offers 0.1 to 2; the API accepts any positive number. |
levels | number | 2–20 | 10 | Number of contour levels. |
colorScale | 'YlOrRd' | 'Blues' | 'Greens' | 'Greys' | 'Purples' | 'Viridis' | 'Plasma' | — | 'YlOrRd' | Sequential palette that maps density to color. |
visualization | 'filled-with-lines' | 'filled-only' | 'contour-only' | — | 'filled-with-lines' | Whether to draw filled regions, contour lines, or both. |
alpha | number | 0–1 | 0.8 | Opacity of the layer, from 0 (fully transparent) to 1 (fully opaque). |
Text (Label)
| Key | Type | Range | Default | Description |
|---|
color | string (CSS color) | — | '#333333' | Text color used when no column is mapped to the color aesthetic. Any CSS color string. |
fontSize | number | 6–24 | 11 | Font size in pixels. |
fontWeight | 'normal' | 'bold' | — | 'normal' | Weight of the text. |
textAnchor | 'start' | 'middle' | 'end' | — | 'middle' | Horizontal alignment of the text relative to the point: the text starts at, is centered on, or ends at the point. |
dx | number | -50–50 | 0 | Horizontal offset of the text from the point in pixels. |
dy | number | -50–50 | -8 | Vertical offset of the text from the point in pixels. Negative values move the text up. |
alpha | number | 0–1 | 1 | Opacity of the layer, from 0 (fully transparent) to 1 (fully opaque). |
Label (Annotation)
| Key | Type | Range | Default | Description |
|---|
color | string (CSS color) | — | '#333333' | Text color used when no column is mapped to the color aesthetic. Any CSS color string. |
fontSize | number | 6–24 | 11 | Font size in pixels. |
fontWeight | 'normal' | 'bold' | — | 'normal' | Weight of the text. |
backgroundColor | string (CSS color) | — | '#ffffff' | Background color of the text box. Any CSS color string. |
backgroundAlpha | number | 0–1 | 0.93 | Opacity of the text box background, from 0 (fully transparent) to 1 (fully opaque). |
borderColor | string (CSS color) | — | '#cccccc' | Border color of the text box. Any CSS color string. |
leaderColor | string (CSS color) | — | '#999999' | Color of the leader line from the point to the text box. Any CSS color string. |
padding | number | 0–16 | 4 | Space between the text and the edge of the text box in pixels. |
offsetDistance | number | 10–80 | 30 | Distance from the point to the text box in pixels. |
alpha | number | 0–1 | 1 | Opacity of the layer, from 0 (fully transparent) to 1 (fully opaque). |
Multiple layers with different fixed colors
Add each series as a separate layer with its own geom.defaults.color:
// Layer 1: actual values in blue
await window.midas.tabs.addGraphLayer(tabId, {
geom: { type: 'line', defaults: { color: '#3366CC' } },
aes: { x: 'date', y: 'actual' }
});
// Layer 2: predicted values in red
await window.midas.tabs.addGraphLayer(tabId, {
geom: { type: 'line', defaults: { color: '#CC3333' } },
aes: { x: 'date', y: 'predicted' }
});
Alternative: categorical color mapping
When data is in long format (one row per observation with a grouping column), map the grouping column to color instead of setting a fixed color. The palette assigns a distinct color to each group automatically.
// Long format: each row has a "series" column ("actual" or "predicted")
await window.midas.tabs.addGraphLayer(tabId, {
geom: { type: 'line' },
aes: { x: 'date', y: 'value', color: 'series' }
});
This approach works well when the number of series is dynamic or when you want consistent palette colors across multiple graphs.
Using labels with statistics
When a layer uses a statistic (Count, Summary, Bin, etc.), the stat replaces original column values with aggregated results. An aes.label column mapping cannot reference the original data after transformation. To display stat-computed values as labels, set geom.defaults.labelContent instead of aes.label.
labelContent references stat output variables with the $ prefix:
| Variable | Description |
|---|
$y | Y value after stat transformation (count, mean, etc.). In a layer whose position is fill, it is the proportion of the sum of absolute values at each x position, and a tooltip field without format shows it as a percentage |
$x | X value (bin center, category name) |
$n | Number of observations the point's statistic used (missing values excluded). Applies to Count, Bin, Summary, Boxplot, and similar stats; Smooth (regression curves) does not emit it |
$xmin | Bin lower bound (Bin and Time Bin stats) |
$xmax | Bin upper bound (Bin and Time Bin stats) |
$ymin | Lower bound of interval |
$ymax | Upper bound of interval |
$q1 | First quartile (Boxplot stat) |
$q3 | Third quartile (Boxplot stat) |
// Show mean values as labels on a summary chart
await window.midas.tabs.addGraphLayer(tabId, {
geom: {
type: 'label',
defaults: {
labelContent: { field: '$y', format: '.1f' }
}
},
stats: [{ type: 'summary', params: { outputs: [{ fun: 'mean', to: 'y' }] } }],
aes: { x: 'category', y: 'value' }
});
The labelContent object accepts these properties:
| Property | Type | Description |
|---|
field | string | A $-prefixed variable (see table above), a column name, or a column ID. Column names are resolved case-insensitively |
format | string | d3-format specifier (optional; auto-detected when omitted). Common patterns: .1f (1 decimal), .0% (percent, no decimals), ,.0f (thousands separator) |
prefix | string | Text prepended to the formatted value |
suffix | string | Text appended to the formatted value |
When the variable or column given in field has no value on any point of the layer, MIDAS draws none of that layer's labels and shows a warning above the graph. The warning names the column or variable you set and lists the variables that do have values on that layer. Aggregation leaves no original column values on a point, so referencing an original column from a layer that uses Statistics produces this state.
Coordinates
The coordinate system is a graph-level setting, specified in the coordinates field of tabs.configureGraph or reports.addGraph. Available values:
'cartesian' (default) — Standard Cartesian coordinates
'flipped' — Swaps X and Y axes. Useful for horizontal bar charts with long category labels
In the GUI, this corresponds to the Coordinate System section in Graph Builder. See Custom Graph: Flipping Axes for a visual example.
scales.x / scales.y in flipped coordinates
In flipped coordinates, aes.y data appears on the physical X axis (horizontal) and aes.x data on the physical Y axis (vertical). Every scales.x / scales.y setting (type, domain, ticks, zoomEnabled, title, and the rest) follows the data axis: scales.x controls the axis showing aes.x data (the vertical axis when flipped), and scales.y controls the axis showing aes.y data (the horizontal axis when flipped).
// Horizontal bar chart: aes.x mapped to categories, aes.y to values
await window.midas.tabs.configureGraph(tabId, {
coordinates: 'flipped',
scales: {
x: { title: 'Product' }, // axis for aes.x data — vertical when flipped
y: { title: 'Sales (USD)' } // axis for aes.y data — horizontal when flipped
}
});
The secondary Y axis (scales.y2) is disabled in flipped coordinates.
See also
Also available as a Markdown file.