dbs_annotator.utils.report_chart_utils.build_scales_chart

dbs_annotator.utils.report_chart_utils.build_scales_chart(scale_data, scale_prefs, *, title='', x_label='X', y_label='Scale Value', x_ticks=None, width=1100, height=520, show_general_index=True, rotate_x_ticks=False)[source]

Build a scale-trend chart and return it as PNG bytes.

The chart includes: * Rainbow-coloured individual scale lines * A thick black Aggregate Index line (when show_general_index and ≥ 2 scales) * Green vertical bands for best (dark) and second-best (light) * A compact legend above the plot

Parameters:
  • scale_data (dict[str, dict[int, float]]) – {scale_name: {x_point: value}}

  • scale_prefs (list[tuple[str, str, str, str, str]] | None) – user optimisation preferences (may be None)

  • title (str) – chart title text (empty string for no title)

  • x_label (str) – bottom-axis label

  • y_label (str) – left-axis label

  • x_ticks (list[tuple[int, str]] | None) – optional custom bottom-axis ticks

  • width (int) – image width in px

  • height (int) – image height in px

  • show_general_index (bool) – whether to draw the Aggregate Index line

  • rotate_x_ticks (bool) – whether to rotate x-axis tick labels by 90 degrees

Returns:

PNG image bytes, or None on failure.

Return type:

bytes | None