Pie Chart Class

class PieChart

Represents a Pie Chart

addValues(array $values)

Add Pie Chart Values

Parameters:
  • $values (array) – The Pie Chart values as key=>value pairs; the keys are the labels for the values

Returns:

A new instance of PieChart with the values added to existing values

Return type:

Pie 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

showData()

Show data values in the legend

Returns:

A new instance of PieChart that will show data values in the legend

Return type:

Pie Chart

withComment(string $comment)

Set the chart comment

Parameters:
  • $comment (string) – The comment

Returns:

A new instance of PieChart with the comment

Return type:

Pie Chart

withValues(array $values)

Set Pie Chart values

Parameters:
  • $values (array) – The Pie Chart values as key=>value pairs; the keys are the labels for the values

Returns:

A new instance of PieChart with the values

Return type:

Pie Chart

withTitle(string $title)

Set the chart title

Parameters:
  • $title (string) – The title

Returns:

A new instance of PieChart with the title

Return type:

Pie Chart