XyChart Class¶
- class XyChart¶
Represents an XY Chart
- render(array $attributes)¶
Render the Mermaid code enclosed in a <pre> tag
- Parameters:
$attributes (
array) – HTML attributes for the enclosing <pre> tag
- Returns:
Mermaid code enclosed in a <pre> tag
- Return type:
string
- addDataset(DatasetType $type, array $data)¶
Add a dataset
- Parameters:
$type (
DatasetType) – The dataset type$data (
array) – The dataset
- Returns:
A new instance of
XyChartwith the dataset- Return type:
- withTitle(string $title)¶
Set the chart title
- Parameters:
$title (
string) – The title
- Returns:
A new instance of
XyChartwith the title- Return type:
- withOrientation(Orientation $orientation)¶
Set the chart orientation
The default chart orientation is
Orientation::vertical- Parameters:
$orientation (
Orientation) – The chart orientation
- Returns:
A new instance of
XyChartwith the orientation set- Return type:
- withXAxis(?string $title = null, array|int|null $min = null, ?int $max = null)¶
Define the chart X-axis
- Parameters:
$title (
?string) – The X-axis title$min (
array|int|null) – Array of categories or minimum value$max (
?int) – Maximum value; only used if $min is int
- Returns:
A new instance of
XyChartwith the X-axis defined- Return type: