-
Notifications
You must be signed in to change notification settings - Fork 34
classes_lib_controls_chartjs3.class
Represents a Chart.js chart
Extends: Control » Renderable
Appends data for a Pie chart.
Definition: public function addPieData($name_value_pairs)
Returns: static
Parameters:
-
array $name_value_pairs
key-value pairs of data
Adds a plugin to be loaded.
Definition: public function addPlugin($name)
Returns: static
Parameters:
-
string $name
Plugin name
SHORTCUT Create a Bar chart
Get/Set dataset related configuration.
Definition: public function dataset($index, $name, $value=null)
Returns: mixed
Returns $this is value is given, else the data requested
Parameters:
-
int $index
Datase index -
string $name
Config name -
mixed $value
Optional value
INTERNAL Handler for points of type Date
SHORTCUT Create a Doughnut chart
Iterates series.
Definition: public function eachSeries($callback)
Returns: static
Parameters:
-
callable $callback
Callback that received each searies
Fill the chart with data using a callback.
Definition: public function fill($seriesCallback)
Returns: $this
Parameters:
-
callable $seriesCallback
Callback that will receive the series name and must return an array with data
Fills all series with contiguous points.
Definition: public function fillGaps($increment)
Returns: $this
Parameters:
-
\Closure|int $increment
An integer value or a callback, that receives a X-value and returns the next
Prepare the data to be ajax usable.
Definition: public function getAjaxData()
Returns: array
The data
Gets/Sets the legend.
Definition: public function legend($name, $value=null)
Returns: mixed
Returns $this is value is given, else the data requested
Parameters:
-
string $name
Name -
mixed $value
Optional value
SHORTCUT Create a Line chart
SHORTCUT Create a multi-series time chart
Sets a handler to be called when points are missing. This can be the case when harmonizing data (so that every series has the same X-Values) or when is called.
Definition: public function onMissingPoint($missingPointCallback)
Returns: $this
Parameters:
-
\Closure $missingPointCallback
Callback function that receives series_name, x and xval parameters and must return a point
Sets or gets an option
if you specify a $value will set it and retunr $this
. else will return the option value
Definition: public function opt($name, $value=null)
Returns: mixed
If setting an option returns $this
, else returns the option value
Parameters:
-
string $name
option name -
mixed $value
option value or null
SHORTCUT Create a Pie chart
OVERRIDE Control::PreRender
Get/Set scale related configuration.
Definition: protected function scales($scaleId, $name, $value=null)
Returns: mixed
Returns $this is value is given, else the data requested
Parameters:
-
$scaleId
NOT DOCUMENTED -
string $name
Config name -
mixed $value
Optional value
SHORTCUT ChartJS3::scales
SHORTCUT ChartJS3::scales
Sets data.
Definition: public function setChartData(iterable $data, string $x_value_row, $pointType, $pointdatacallback=false)
Returns: $this
Parameters:
-
iterable $data
The actual data -
string $x_value_row
Name of the field that represents the series name -
string $pointType
Optional classname of the Point handler -
Closure $pointdatacallback
Optional closure receiving $row,$series,$x_value_row_name
Sets a ColorRange for the chart.
Definition: public function setColorRange($range)
Returns: $this
Parameters:
-
\ScavixWDF\Base\Color\ColorRange $range
Range of colors
Sets the chart colors.
Definition: public function setColors($colors)
Returns: $this
Parameters:
-
array $colors
Array of color valus
Sets if the chart should load it's data via AJAX.
Definition: public function setDelayed($url, $refresh_interval)
Returns: static
Parameters:
-
string $url
The data URL -
int $refresh_interval
Optional interval to refresh the data (default: -1 = off)
Sets the named chart colors.
Definition: public function setNamedColors($colors)
Returns: $this
Parameters:
-
array $colors
Associative array of color valus
Sets Y-Axis to be a percentual scale.
Definition: public function setPercentAxesY()
Returns: $this
Sets data for a Pie chart.
Definition: public function setPieData($name_value_pairs)
Returns: static
Parameters:
-
array $name_value_pairs
key-value pairs of data
Sets series names.
Definition: public function setSeries($seriesNames, $append=false)
Returns: $this
Parameters:
-
array $seriesNames
Series names -
bool $append
If true, series will be appended, else existing will be replaced
Sets series data.
Definition: public function setSeriesData(iterable $data, string $series_row, string $x_value_row, string $y_value_row, $pointType, $pointdatacallback=false)
Returns: $this
Parameters:
-
iterable $data
The actual data -
string $series_row
Name of the field with the series name -
string $x_value_row
Name of the field with the x-values -
string $y_value_row
Name of the field with the y-values -
callable|string $pointType
Optional classname of the Point handler -
Closure $pointdatacallback
Optional closure receiving $row,$series,$series_row_name,$x_value_row_name,$y_value_row_name
Defines the drawing order of the data series.
Definition: public function setSeriesOrder($names)
Returns: static
Parameters:
-
array $names
Seriesnames in correct order
Sets this chart to be stacked.
Definition: public function setStacked()
Returns: $this
Sets the xAxes to be a time-scale.
Definition: public function setTimeAxesX($unit=false)
Returns: $this
Parameters:
-
string $unit
OPtional unit specifier
Sets the chart title.
Definition: public function setTitle($text)
Returns: $this
Parameters:
-
string $text
Title
Sets the chart type.
Definition: public function setType($type)
Returns: $this
Parameters:
-
string $type
The type name
SHORTCUT Create a Stacked-Bar chart
INTERNAL Handler for points of type String
INTERNAL Handler for points of type Time
Gets/Sets the tooltip.
Definition: public function tooltip($name, $value=null)
Returns: mixed
Returns $this is value is given, else the data requested
Parameters:
-
string $name
Name -
mixed $value
Optional value
INTERNAL Handler for points of type Week
Gets/Sets X-Axes labels.
Definition: public function xLabels($labels=null)
Returns: mixed
$this is lables is given, else the data requested
Parameters:
-
array $labels
Optional labels as array