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. |
| 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. |
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. |
| Survival (Kaplan-Meier) | Computes Kaplan-Meier survival estimates. |
| 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 normal Q-Q plot. |
| 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 (5-100). Ignored when binwidth is specified. |
binwidth | number | — | Width of each bin in X-axis units. Takes precedence over bins. |
yScale | 'count' | 'density' | 'count' | Y-axis scale: 'count' reports bin counts, 'density' reports probability density (bin counts divided by total count × binwidth, so total area equals 1). |
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. |
bins | number | — | Target number of bins (legacy; falls back to auto interval selection when interval is not set). |
yScale | 'count' | 'density' | 'count' | Y-axis scale: 'count' reports bin counts, 'density' reports probability density. |
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). |
se | boolean | true | When true, emits ymin/ymax for an interval band (Line geom draws the band automatically). The values are interval endpoints, 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 | 0.95 | Interval level (0-1). For example, 0.95 for a 95% interval. |
interval | 'confidence' | 'prediction' | 'prediction' | Interval type. 'confidence' is for the mean response (narrower); 'prediction' is for a new individual observation (wider, includes residual variance). See Custom Graph for assumptions and limits. |
Count (Aggregation)
No parameters.
Density (KDE)
| Name | Type | Default | Description |
|---|
bandwidth | number | — | Kernel bandwidth in X-axis units. When omitted, bandwidth is selected automatically by Silverman's rule of thumb. |
kernel | 'gaussian' | 'gaussian' | Kernel function. Only Gaussian is supported. |
yScale | 'density' | 'count' | 'density' | Y-axis scale: 'density' reports probability density (total area equals 1). '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. |
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), '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 position aesthetic ('y', 'ymin', or 'ymax'). p (0-1) is required for 'quantile'. 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. |
Survival (Kaplan-Meier)
| Name | Type | Default | Description |
|---|
confLevel | number | 0.95 | Confidence level (0-1) for the pointwise confidence interval of S(t). Variance is estimated with Greenwood's formula and the interval is constructed on the log scale (so the bounds stay inside [0, 1]). |
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. For example, 3 draws a line at mean + 3 × SD (UCL), and -3 at mean − 3 × SD (LCL), suitable for control charts. |
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. Omit to keep all categories. |
displayOrder | 'alphabetical' | — | Controls the display order of the kept categories. 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 sample quartiles; 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. |
See also