Adminix Documentation Help

Chart Line

Description

Chart-line is a chart which displays dynamic of creation records of some entity, users, orders, comments etc. Chart can display daily or monthly results.

  1. Configuration

  2. ChartLineModule configuration

  3. Appearance examples

Configuration

This page adds two independently named line charts. The first chart counts recent registrations; the second uses the first route-tail value as a role criterion.

namespace App\Adminix\Pages; use AlexKudrya\Adminix\AdminixPage; use AlexKudrya\Adminix\AdminixPageProvider; use AlexKudrya\Adminix\Enums\ColorsEnum; use AlexKudrya\Adminix\Modules\ChartLine\ChartLineModule; use AlexKudrya\Adminix\Modules\ChartLine\ChartLineValueTypeEnum; use App\Models\User; final class UserRegistrationChartsPage implements AdminixPageProvider { public static function get(): AdminixPage { return AdminixPage::uri('user-registrations') ->name('user-registration-charts') ->title('User registrations') ->addModules( ChartLineModule::name('user-registrations-daily') ->title('User registrations daily') ->color(ColorsEnum::DEEP_PINK) ->valueType(ChartLineValueTypeEnum::COUNT_DAILY) ->limit(30) ->yAxisStep(1) ->dataSource(User::class) ->criteria([ ['role_id', '=', [2, 3, 4]], ]), ChartLineModule::name('user-registrations-monthly') ->title('User registrations monthly') ->color(ColorsEnum::ORANGE) ->valueType(ChartLineValueTypeEnum::COUNT_MONTHLY) ->limit(6) ->dataSource(User::class) ->criteria([ ['role_id', '=', 'param:0'], ]) ); } }

Open /adminix/user-registrations/2 to scope the monthly chart to role 2. To add to the page Chart Line module you need paste AlexKudrya\Adminix\Modules\ChartLine\ChartLineModule class instance as an argument to addModule or addModules method of AdminixPage object.

ChartLineModule Configuration

Method

Description

title

Title of the chart on top of this module

title('USER REGISTRATIONS DAILY')

Optional

name

Name of module, must be unique in current page.

name('user_registrations')

Required

color

Color of lines in chart, can be provided only by AlexKudrya\Adminix\Enums\ColorsEnum Enum class

color(ColorsEnum::DEEP_PINK)

Required

valueType

Type of interval for records counting. Can be provided only by AlexKudrya\Adminix\Modules\ChartLine\ChartLineValueTypeEnum Enum class. Has only two options: COUNT_DAILY and COUNT_MONTHLY

valueType(ChartLineValueTypeEnum::COUNT_DAILY)

Required

baseField

Field with date / datetime (usually it is a record creation timestamp). By default, it is created_at

baseField('created_at')

Optional

dataSource

Source of data for chart, can be an Eloquent Model - \App\Models\User::class or name of table in database users or public.users

dataSource(\App\Models\User::class)

Required

criteria

Database Builder criteria to render records. For example to not show administrator you need paste this:

criteria([ ['role_id', '!=', 1], ])

Or you can paste parameter from route:

criteria([ ['role_id', '=', 'param:0'], ])

For example, for https://site.com/adminix/users_by_role/2 it wiil be mean that you need dynamics for role_id == 2.

Optional

yAxisStep

Optional Y-axis tick step. When it is omitted, Adminix leaves the Chart.js axis scale automatic. Set it when the metric has a natural minimum step, for example count charts that should show whole numbers only.

yAxisStep(1) // or, for fractional metrics: yAxisStep(0.5)

Optional

limit

limit of days / months for displaying in the chart

limit(30)

Required

Appearance examples

Here is an example of Users daily registrations (value_type = count_daily, limit = 30)

Rendered example:

Adminix line chart

The rendered canvas has an accessible name and an equivalent visually hidden label/value table, so the series remains available when a browser cannot expose canvas pixels.

Last modified: 23 July 2026