Documentation

chart
in package
implements JsonSerializable, Stringable, JsModuleFiles

Chart.js component

Tags
author

Stefan Seehafer aka imagine fanpress@nobody-knows.org

copyright

(c) 2019-2023, Stefan Seehafer

license

http://www.gnu.org/licenses/gpl.txt GPLv3

since
4.3

Interfaces, Classes, Traits and Enums

JsonSerializable
Stringable
JsModuleFiles
JavaScript ECMA module files interface

Table of Contents

TYPE_BAR  = 'bar'
TYPE_BUBBLE  = 'bubble'
TYPE_DOUGHNUT  = 'doughnut'
TYPE_LINE  = 'line'
TYPE_PIE  = 'pie'
TYPE_POLAR  = 'polarArea'
TYPE_RADAR  = 'radar'
TYPE_SCATTER  = 'scatter'
$data  : array<string|int, mixed>
Chart data
$id  : string
Chart id
$options  : array<string|int, mixed>
Chart data
$scales  : array<string|int, mixed>
Chart scales
$type  : string
Charts typ
__construct()  : mixed
Constructor
addOptions()  : $this
Add chart config option
getCssFiles()  : array<string|int, mixed>
Returns list of CSS files
getJsFiles()  : array<string|int, mixed>
Returns list of JS files
getJsModuleFiles()  : array<string|int, mixed>
Returns list of JS files
jsonSerialize()  : array<string|int, mixed>
JSON serializer
setLabels()  : $this
Adds label to data
setLegend()  : $this
Set chart legend config
setScales()  : $this
Set charts cales
setValues()  : $this
Sets chart values

Constants

TYPE_BAR

public mixed TYPE_BAR = 'bar'

TYPE_BUBBLE

public mixed TYPE_BUBBLE = 'bubble'

TYPE_DOUGHNUT

public mixed TYPE_DOUGHNUT = 'doughnut'

TYPE_LINE

public mixed TYPE_LINE = 'line'

TYPE_PIE

public mixed TYPE_PIE = 'pie'

TYPE_POLAR

public mixed TYPE_POLAR = 'polarArea'

TYPE_RADAR

public mixed TYPE_RADAR = 'radar'

TYPE_SCATTER

public mixed TYPE_SCATTER = 'scatter'

Properties

$data

Chart data

protected array<string|int, mixed> $data = []

$id

Chart id

protected string $id = ''

$options

Chart data

protected array<string|int, mixed> $options = []

$scales

Chart scales

protected array<string|int, mixed> $scales = ['x' => ['beginAtZero' => true], 'y' => ['beginAtZero' => true]]
Tags
since
5.0.0-a1

$type

Charts typ

protected string $type = ''

Methods

__construct()

Constructor

public __construct(string $type, string $id) : mixed
Parameters
$type : string

Chart.js chart type

$id : string

Chart id

Return values
mixed

getCssFiles()

Returns list of CSS files

public getCssFiles() : array<string|int, mixed>
Return values
array<string|int, mixed>

getJsFiles()

Returns list of JS files

public getJsFiles() : array<string|int, mixed>
Return values
array<string|int, mixed>

getJsModuleFiles()

Returns list of JS files

public getJsModuleFiles() : array<string|int, mixed>
Return values
array<string|int, mixed>

jsonSerialize()

JSON serializer

public final jsonSerialize() : array<string|int, mixed>
Return values
array<string|int, mixed>

setLabels()

Adds label to data

public setLabels(array<string|int, mixed> $labels) : $this
Parameters
$labels : array<string|int, mixed>
Return values
$this

setValues()

Sets chart values

public setValues(chartItem $item, int $index) : $this
Parameters
$item : chartItem
$index : int
Return values
$this

Search results