Custom Graph リファレンス

Custom Graph で利用可能な Geometry と Statistics の一覧です。各項目の詳細は、レイヤー設定内のヘルプボタン(?)で確認できます。

テーブル内の Description はアプリ UI の表記と一致させるため英語で記載しています。

Geometry(形状)

GeometryDescription
Point (Scatter)Displays data as individual points.
LineConnects data points with lines. Draws an interval band automatically when ymin/ymax are present.
BarVertical bars for categorical data. Use Fill (not Color) to change bar color.
AreaFilled 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 BarError 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.
ContourDraws a curve from a series of points. Used for Cook's distance contours in regression diagnostics.
Density 2D2D 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(統計変換)

StatisticsDescription
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 MeanCalculates the mean of X values. Use with vline geom to draw a vertical reference line.
X MedianCalculates the median of X values. Use with vline geom to draw a vertical reference line.
Y MeanCalculates 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 のパラメータ

各 Statistic は tabs.addGraphLayer / tabs.updateGraphLayerstats 配列に params オブジェクトを渡します。以下の表は各 Statistic のパラメータ名、TypeScript 型、デフォルト値、説明の一覧です。

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' }
});

型の記法: A | B は A か B のどちらかを指定、T[]T の配列、フィールド名末尾の ?(例: p?)は省略可能を表します。各 Statistic の前提・限界・ユースケースの詳細は Custom Graph を参照してください。

Identity (No transformation)

No parameters.

Bin (Histogram)

NameTypeDefaultDescription
binsnumber30Number of bins (5-100). Ignored when binwidth is specified.
binwidthnumberWidth 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).
boundarynumberPosition of a bin edge in X-axis units. Bins are aligned so that one edge falls on this value.
centernumberPosition of a bin center in X-axis units. Takes precedence over boundary.

Time Bin (Datetime Histogram)

NameTypeDefaultDescription
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.
binsnumberTarget 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)

NameTypeDefaultDescription
method'lm' | 'loess''loess'Smoothing method: 'lm' for ordinary least squares, 'loess' for locally weighted regression (tricube kernel, local linear).
sebooleantrueWhen true, emits ymin/ymax for an interval band (Line geom draws the band automatically). The values are interval endpoints, not a standard error.
spannumber0.75LOESS span: fraction of points in each local neighborhood (0.1-1.0). Larger values produce smoother curves. Ignored when method is lm.
levelnumber0.95Interval 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)

NameTypeDefaultDescription
bandwidthnumberKernel 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)

NameTypeDefaultDescription
outputsSummaryOutputDef[][{ 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'.
completebooleanfalseWhen 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)

NameTypeDefaultDescription
confLevelnumber0.95Confidence 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

NameTypeDefaultDescription
labelstring'Mean: {value}'Label template for the reference line. {value} is replaced with the computed mean.

X Median

NameTypeDefaultDescription
labelstring'Median: {value}'Label template for the reference line. {value} is replaced with the computed median.

Y Mean

NameTypeDefaultDescription
offsetnumber0Number 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.
labelstring'Mean: {value}'Label template for the reference line. {value} is replaced with the computed value.

Cumulative Sum (Pareto)

NameTypeDefaultDescription
normalizebooleanfalseWhen true, scales the cumulative sum so the total equals 100 (percent).

Sort (Pareto)

NameTypeDefaultDescription
order'ascending' | 'descending''descending'Sort direction applied to Y values.
limitnumberKeep 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)

NameTypeDefaultDescription
showReferenceLinebooleantrueWhen 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).

Transform (Linear)

NameTypeDefaultDescription
multiplynumber1Multiplier applied to Y. For example, -1 flips a histogram for a population pyramid.
addnumber0Offset added after multiplication.

See also