StatisticsChartDTO
in package
Encapsulates graph data (title, legend, series data, totals, meta) into a structured array for use in APIs or frontend visualization.
Table of Contents
Properties
- $data : array<string|int, mixed>
- $legend : array<string|int, mixed>
- $meta : array<string|int, mixed>
- $title : string
- $total : int|null
Methods
- __construct() : mixed
- toArray() : array<string|int, mixed>
- Convert the DTO into an associative array for API responses.
Properties
$data
private
array<string|int, mixed>
$data
Data points for the graph (usually array of key/value pairs)
$legend
private
array<string|int, mixed>
$legend
Legend labels used in the graph (e.g. "Yes", "No")
$meta
private
array<string|int, mixed>
$meta
Additional metadata that may be included (e.g. question, filters applied)
$title
private
string
$title
Title of the graph (usually the question text)
$total
private
int|null
$total
Total count of responses (optional, falls back to count($data))
Methods
__construct()
public
__construct(string $title, array<string|int, mixed> $legend, array<string|int, mixed> $data[, int $total = null ][, array<string|int, mixed> $meta = [] ]) : mixed
Parameters
- $title : string
- $legend : array<string|int, mixed>
- $data : array<string|int, mixed>
- $total : int = null
- $meta : array<string|int, mixed> = []
toArray()
Convert the DTO into an associative array for API responses.
public
toArray() : array<string|int, mixed>
Return values
array<string|int, mixed> —Structured graph data