Factory helpers

Convenience helpers for one-shot chart creation from raw data.

textcharts.bar_chart.from_data(data, title=None, metric_label='Value', sort_by='value', options=None, subject=None)[source]

Create BarChart from objects with label/value attributes.

Parameters:
  • data (Sequence)

  • title (str | None)

  • metric_label (str)

  • sort_by (str)

  • options (ChartOptions | None)

  • subject (str | None)

Return type:

BarChart

textcharts.box_plot.from_series(series, title=None, y_label='Value', show_stats=True, show_mean=True, options=None, subject=None)[source]

Create BoxPlot from objects with name/values attributes.

Parameters:
  • series (Sequence)

  • title (str | None)

  • y_label (str)

  • show_stats (bool)

  • show_mean (bool)

  • options (ChartOptions | None)

  • subject (str | None)

Return type:

BoxPlot

textcharts.cdf_chart.from_series(platform_queries, title=None, x_label='Value', y_label='Cumulative Share', options=None, subject=None)[source]

Create CDFChart from raw query timing data.

Parameters:
  • platform_queries (Sequence[tuple[str, Sequence[float]]]) – Sequence of (platform_name, query_times) tuples.

  • title (str | None) – Optional chart title.

  • options (ChartOptions | None) – Chart rendering options.

  • x_label (str)

  • y_label (str)

  • subject (str | None)

Returns:

Configured CDFChart instance.

Return type:

CDFChart

textcharts.comparison_bar.from_data(data, title=None, metric_label='Value', options=None, subject=None)[source]

Create ComparisonBar from comparison data.

Accepts ComparisonBarData objects or dicts with compatible keys.

Parameters:
  • data (Sequence)

  • title (str | None)

  • metric_label (str)

  • options (ChartOptions | None)

  • subject (str | None)

Return type:

ComparisonBar

textcharts.diverging_bar.from_data(data, title=None, options=None, subject=None)[source]

Create DivergingBar from regression data.

Accepts DivergingBarData objects or dicts with compatible keys.

Parameters:
  • data (Sequence)

  • title (str | None)

  • options (ChartOptions | None)

  • subject (str | None)

Return type:

DivergingBar

textcharts.heatmap.from_matrix(matrix, queries, platforms, title=None, value_label='', x_label='Platform', show_values=True, color_scheme='diverging', options=None, subject=None)[source]

Create Heatmap from matrix data (compatible with QueryHeatmap).

Parameters:
  • matrix (Sequence[Sequence[float]])

  • queries (Sequence[str])

  • platforms (Sequence[str])

  • title (str | None)

  • value_label (str)

  • x_label (str)

  • show_values (bool)

  • color_scheme (str)

  • options (ChartOptions | None)

  • subject (str | None)

Return type:

Heatmap

textcharts.histogram.from_data(data, title=None, y_label='Value', sort_by='label', max_per_chart=33, show_mean_line=True, options=None, subject=None)[source]

Create Histogram from objects with label/value attributes.

Parameters:
  • data (Sequence)

  • title (str | None)

  • y_label (str)

  • sort_by (str)

  • max_per_chart (int)

  • show_mean_line (bool)

  • options (ChartOptions | None)

  • subject (str | None)

Return type:

Histogram

textcharts.line_chart.from_points(points, title=None, x_label='Run', y_label='Y', show_trend=False, options=None, subject=None)[source]

Create LineChart from objects with series/x/y attributes.

Parameters:
  • points (Sequence)

  • title (str | None)

  • x_label (str)

  • y_label (str)

  • show_trend (bool)

  • options (ChartOptions | None)

  • subject (str | None)

Return type:

LineChart

textcharts.normalized_speedup.from_ratios(platform_times, baseline=None, title=None, options=None, subject=None)[source]

Create NormalizedSpeedup from platform timing data.

Parameters:
  • platform_times (Sequence[tuple[str, float]]) – Sequence of (platform_name, total_time_ms) tuples.

  • baseline (str | None) – Name of baseline platform, or “slowest”/”fastest” for auto-selection.

  • title (str | None) – Optional chart title.

  • options (ChartOptions | None) – Chart rendering options.

  • subject (str | None)

Returns:

Configured NormalizedSpeedup instance.

Return type:

NormalizedSpeedup

textcharts.percentile_ladder.from_series(platform_queries, title=None, metric_label='ms', options=None, subject=None)[source]

Create PercentileLadder from raw query timing data.

Parameters:
  • platform_queries (Sequence[tuple[str, Sequence[float]]]) – Sequence of (platform_name, query_times) tuples.

  • title (str | None) – Optional chart title.

  • metric_label (str) – Unit label for values.

  • options (ChartOptions | None) – Chart rendering options.

  • subject (str | None)

Returns:

Configured PercentileLadder instance.

Return type:

PercentileLadder

textcharts.rank_table.from_matrix(matrix, items, groups, title=None, options=None, subject=None)[source]

Create RankTable from the same matrix format as Heatmap.

Parameters:
  • matrix (Sequence[Sequence[float]]) – 2D matrix of numeric values [item_idx][group_idx].

  • items (Sequence[str]) – Item labels (row labels).

  • groups (Sequence[str]) – Group labels (column labels).

  • title (str | None) – Optional chart title.

  • options (ChartOptions | None) – Chart rendering options.

  • subject (str | None)

Returns:

Configured RankTable instance.

Return type:

RankTable

textcharts.scatter_plot.from_points(points, title=None, x_label='X', y_label='Y', show_pareto=True, options=None, subject=None)[source]

Create ScatterPlot from objects with name/x/y attributes.

Parameters:
  • points (Sequence)

  • title (str | None)

  • x_label (str)

  • y_label (str)

  • show_pareto (bool)

  • options (ChartOptions | None)

  • subject (str | None)

Return type:

ScatterPlot

textcharts.sparkline_table.from_data(rows, metrics, title=None, options=None, subject=None)[source]

Create SparklineTable from metric data.

Parameters:
  • rows (list[str]) – List of row names.

  • metrics (list[tuple[str, dict[str, float], bool]]) – List of (metric_name, {row: value}, higher_is_better) tuples.

  • title (str | None) – Optional chart title.

  • options (ChartOptions | None) – Chart rendering options.

  • subject (str | None)

Returns:

Configured SparklineTable instance.

Return type:

SparklineTable

textcharts.stacked_bar.from_data(data, title=None, options=None, subject=None)[source]

Create StackedBar from phase breakdown data.

Parameters:
  • data (Sequence[StackedBarData]) – Sequence of StackedBarData instances.

  • title (str | None) – Optional chart title.

  • options (ChartOptions | None) – Chart rendering options.

  • subject (str | None) – Domain noun phrase prepended to default title.

Returns:

Configured StackedBar instance.

Return type:

StackedBar