API

Yii Chartist API documentation

class BeastBytes\Yii\Chartist\Chartist
static Chartist::widget(Yiisoft\Assets\AssetManager $assetManager, Yiisoft\View\WebView $view)

Instantiate a Chartist instance

Parameters:
  • $assetManager (YiisoftAssetsAssetManager) – The asset manager that will publish the required JavaScript

  • $view (YiisoftViewWebView) – The view in which to render the chart

Returns:

A new Chartist instance

Return type:

Chartist

static jsExpression(string $value)

Marks the value as a JavaScript expression to ensure correct encoding

Returns:

The value marked as a JavaScript expression

Return type:

string

id(string $id)

Sets the widget id

If not called the widget generates a unique id that matches the regex chart_\d{15}

See Chartist::getId

Parameters:
  • $id (string) – The widget id

Returns:

A new Chartist instance with the id

Return type:

Chartist

data(array $data)

Defines the chart data and labels

Returns:

A new Chartist instance with the data

Return type:

Chartist

getId()

See Chartist::id

Returns:

The widget id

Return type:

string

options(array $options)

Set Chart options

Parameters:
  • $options (array) – Widget options

Returns:

A new Chartist instance with the options

Return type:

Chartist

responsiveOptions(array $responsiveOptions)

Set Chart responsive design options

Parameters:
  • $options (array) – Widget responsive design options

Returns:

A new Chartist instance with the responsive design options

type(ChartType $type)

Define the chart type to render

Parameters:
Returns:

A new Chartist instance with the chart type defined

Return type:

Chartist

enum BeastBytes\Yii\Chartist\ChartType

Defines supported chart types

case Bar
case Line
case Pie