Download the PHP package clesson-de/silverstripe-graphing without Composer

On this page you can find all versions of the php package clesson-de/silverstripe-graphing. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package silverstripe-graphing

silverstripe-graphing

Chart form fields for Silverstripe CMS 6, rendered with Chart.js. Display-only — no data storage.

Features


Requirements

Dependency Version
PHP ^8.1
silverstripe/framework ^6
silverstripe/admin ^3

Installation

Expose the frontend assets:

Then run a database build:


Usage

LineChartField

Add a line chart to any getCMSFields() method:

BarChartField

Add a bar chart:

Stacked bars

Enable stacking to show individual items as coloured blocks on top of each other. Each dataset becomes one block within the bar for its respective label:

This renders:

Hover over a block to see its label and amount in the tooltip.

Multi-series (time period switcher)

Provide multiple data series as string-keyed top-level entries. Buttons are rendered above the chart so the user can switch between series.

The module automatically detects multi-series data (string keys that are not labels or datasets) and renders a row of toggle buttons. Each series can have its own labels and datasets — the chart is completely replaced when switching.

You can set the initially active series:

Multi-series works with all chart types (LineChartField, BarChartField, PieChartField, etc.).

PieChartField

Add a pie chart:

Use setCutout('50%') to create a doughnut-style appearance with a hole in the centre.


Configuration options

Base options (all chart types)

Method Description Default
setData(array $data) Set chart data — single series or multi-series []
setOptions(array $options) Set additional Chart.js options []
setChartWidth(string $width) CSS width of the container '100%'
setChartHeight(string $height) CSS height of the container '300px'
setChartTitle(?string $title) Optional chart title null
setActiveSeries(?string $key) Initially active series key (multi-series only) null (first)

LineChartField options

Method Description Default
setFill(bool $fill) Fill area below the line false
setTension(float $tension) Line curve tension (0 = straight, 0.4 = smooth) 0.0
setPointStyle(?string $style) Point style (e.g. 'circle', 'triangle', 'rect') null

BarChartField options

Method Description Default
setStacked(bool $stacked) Stack bars on top of each other false
setHorizontal(bool $horizontal) Render bars horizontally false
setBorderRadius(?int $radius) Rounded bar corners in pixels null
setBarThickness(?int $thickness) Fixed bar thickness in pixels null (auto)

PieChartField options

Method Description Default
setCutout(?string $cutout) Cutout percentage ('0%' = full pie, '50%' = doughnut-style) null
setBorderWidth(?int $width) Border width between segments in pixels null
setHoverOffset(?int $offset) Offset distance for the hovered segment in pixels null

Available chart types

Class Chart.js type Description
LineChartField line Line chart with optional area fill
BarChartField bar Bar chart with stacking, horizontal mode and rounded corners
PieChartField pie Pie chart with optional cutout (doughnut-style)

More chart types (radar, doughnut, polar area) can be added by extending the ChartField base class.


Frontend assets

The module ships with compiled admin CSS and JS in client/admin/dist/. If you want to modify the styles or scripts, you need to recompile them.

Prerequisites

The required Node.js version is defined in .nvmrc. Switch to it with:

Install dependencies

Build

This compiles:

Watch mode (during development)

Output files

The compiled files in client/admin/dist/ are exposed via composer vendor-expose and referenced in PHP via Requirements::css() / Requirements::javascript(). Their filenames are static — they must not be renamed.


Developer documentation

Creating custom chart types

To add a new chart type, extend the abstract ChartField class and implement getChartType():

Override getChartConfig() to add type-specific dataset defaults:

Architecture


License

BSD-3-Clause — see LICENSE.


All versions of silverstripe-graphing with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
silverstripe/framework Version ^6
silverstripe/admin Version ^3
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package clesson-de/silverstripe-graphing contains the following files

Loading the files please wait ...