CoolCMS API

StatisticsChartConfig
in package

FinalYes

Configures one instance of {@see StatisticsChartControl}.

All charts share a single implementation (form, ApiBridge call, ChartJS markup) and differ only by this configuration, the same way PickerConfig parametrizes the picker.

Table of Contents

Properties

$apiAction  : string
Kebab-case Api bridge action (`api/eshop/statistics/<apiAction>`).
$apiPath  : string|null
Bridge path prefix before `/<apiAction>` ({@see StatisticsChartControl::fetchData()}).
$chartType  : string
`line` (time series) or `bar` (ranking without granularity or status).
$extraParams  : array<string, scalar>
Fixed bridge call parameters in addition to `from`/`to`/`granularity`: the chart scope that is not part of the component filter (held by the page URL), such as `['productId' => 12]` for single-product statistics ({@see \App\UI\Admin\Eshop\Components\ProductStatisticsComponent\ProductStatisticsControl::createComponentChart()}).
$hasGranularity  : bool
Time series have a date range plus granularity; `topProducts` has a date range only.
$isMonetary  : bool
Whether dataset values are monetary (2 decimals, revenue axis) instead of counts.
$key  : string
Unique instance key within the presenter (scopes the component's persistent parameters).
$showFilter  : bool
Whether to render the chart's own date-range filter. `false` means the chart is driven from outside (the range arrives in {@see $extraParams}) and the page owns the filter.
$titleKey  : string
Translation key of the chart title (`eshop.presenters.statistics.charts.<key>`).

Methods

__construct()  : mixed

Properties

$apiAction read-only

Kebab-case Api bridge action (`api/eshop/statistics/<apiAction>`).

public string $apiAction

$apiPath read-only

Bridge path prefix before `/<apiAction>` ({@see StatisticsChartControl::fetchData()}).

public string|null $apiPath = null

null means api/eshop/statistics; another presenter can reuse the component by passing a different prefix.

$chartType read-only

`line` (time series) or `bar` (ranking without granularity or status).

public string $chartType = 'line'

$extraParams read-only

Fixed bridge call parameters in addition to `from`/`to`/`granularity`: the chart scope that is not part of the component filter (held by the page URL), such as `['productId' => 12]` for single-product statistics ({@see \App\UI\Admin\Eshop\Components\ProductStatisticsComponent\ProductStatisticsControl::createComponentChart()}).

public array<string, scalar> $extraParams = []

IMPORTANT: keys are passed to the Api method as named arguments (ApiBridge::internalCall() invokes with ...$params), so they must match the internalAction<Action>() parameter names exactly, otherwise PHP fails the call with an unknown named argument error.

$hasGranularity read-only

Time series have a date range plus granularity; `topProducts` has a date range only.

public bool $hasGranularity = true

$isMonetary read-only

Whether dataset values are monetary (2 decimals, revenue axis) instead of counts.

public bool $isMonetary = false

$key read-only

Unique instance key within the presenter (scopes the component's persistent parameters).

public string $key

$showFilter read-only

Whether to render the chart's own date-range filter. `false` means the chart is driven from outside (the range arrives in {@see $extraParams}) and the page owns the filter.

public bool $showFilter = true

IMPORTANT: extraParams override the component's persistent state in StatisticsChartControl::fetchData() (the + union keeps the left operand), so a hidden filter really means the data comes from the outer range.

$titleKey read-only

Translation key of the chart title (`eshop.presenters.statistics.charts.<key>`).

public string $titleKey

Methods

__construct()

public __construct(string $key, string $apiAction, string $titleKey[, string $chartType = 'line' ][, bool $hasGranularity = true ][, bool $isMonetary = false ][, string|null $apiPath = null ][, array<string|int, mixed> $extraParams = [] ][, bool $showFilter = true ]) : mixed
Parameters
$key : string
$apiAction : string
$titleKey : string
$chartType : string = 'line'
$hasGranularity : bool = true
$isMonetary : bool = false
$apiPath : string|null = null
$extraParams : array<string|int, mixed> = []
$showFilter : bool = true
On this page

Search results