Repository navigation
Upgrading from 6.x? Read UPGRADE.md. There is no version 7: the number is skipped on purpose (see the upgrade guide). 6.x stays maintained on the 6.x branch.
8.0.0 is a major release. Every breaking change below, with the migration, is in UPGRADE.md. The number 7
is skipped on purpose (an old, pulled "Chartisan" 7 release still has ^7 constraints in the wild).
Requirements
- PHP
^8.3(8.2 gets security fixes only until 31 December 2026) and Laravel^12.0|^13.0(Laravel 11 is out of
security support). Development dependencies: Orchestra Testbench 10 or 11, Pest 3 or 4, Larastan 3, Livewire 4. - CI tests PHP 8.3, 8.4 and 8.5 against Laravel 12 and 13, plus one lowest-dependencies run, and runs the new
end-to-end job (below).
Removed
- The C3 library:
Classes\C3,Features\C3, thec3views andmake:chart ... c3, which now fails with the usual
"Unknown library" message. - The
Balping\JsonRaw\RawandBalping\JsonRaw\Encoderclass aliases (Support\compat.php,Support\LegacyEncoder,
the composerautoload.filesentry) and the special handling of the Balping class inJson::encode(). Use
rawObject()orConsoleTVs\Charts\Support\Raw. - The PHPStan baseline file.
Added
- Three libraries, each with
Classes,FeaturesandViews, amake:chartname (billboard,apexcharts,
lightweightcharts, case insensitive), real-library tests and docs:Billboard(Billboard.js 4, MIT): the replacement for the removed C3. Helperstitle(),displayLegend(),
legendPosition(),tooltip(),displayAxes(),label(),colors(),donut(); datasetcolor()andaxis().
UPGRADE.md has a "Migrating from C3" guide.Apexcharts(ApexCharts 8): mixed series types, circular types (pie,donut,radialBar,polarArea). Helpers
title(),displayLegend(),legendPosition(),displayAxes(),label(),stacked(),horizontal(),
toolbar(),curve(),colors(); datasetcolor(). ApexCharts is dual licensed: free for individuals,
non-profits, educators and organizations under USD 2M annual revenue, a paid commercial license otherwise.Lightweightcharts(TradingView Lightweight Charts 5, Apache-2.0): line, area, bar, candlestick, histogram and
baseline series with the labels as the time axis, OHLC values, and panes. HelpersdisplayAxes(),displayGrid(),
timeVisible(),layoutColors(); datasetcolor(),candleColors(),pane(). TradingView requires attribution
with a link to tradingview.com:layout.attributionLogois on by default and no helper turns it off.
<x-charts::chart :chart="$chart" />, a Blade component (Components\Chart, registered under thechartscomponent
namespace) that prints the container and the script inside a<div wire:ignore>wrapper and merges extra attributes.- Livewire 4 support:
BaseChart::id(string $id)sets a stable, validated id;BaseChart::updatePayload()returns
{id, labels, datasets}; every script definesfunction <id>_update(payload)(shared with<id>_refresh()) and
listens for thecharts:updateevent onwindow, so$this->dispatch('charts:update', ...$chart->updatePayload())
updates the chart without a re-render.livewire/livewireis a dev dependency only. - Inertia 3 support:
BaseChartimplementsArrayableandJsonSerializable;toArray()returns the library, id, type,
labels, datasets, resolved options, size and a CDN hint, and refuses Raw JavaScript with aLogicException.
docs-snippets/hasrenderChart()(tested against the real Chart.js 4 and ECharts 6 intests/js) and React 19,
Vue 3 and Svelte 5 components. No npm or composer package is published. Chartjs\Chart::horizontal()(indexAxis: 'y'), replacing thehorizontalBartype that Chart.js 3 removed.- End-to-end tests in real Chromium, Firefox and WebKit: Playwright (
tests/js/e2e,npm run e2e --prefix tests/js) drives a Testbench
workbench app (testbench.yaml,workbench/) that loads the libraries fromtests/js/node_modules. For all eight
libraries: first render, API mode and<id>_refresh(), thecharts:updateevent, a script executed twice, cross
document view transitions, and Livewire 4 (a dispatched update, a morphing re-render,wire:navigateback and
forth, a chart inserted by a later response). CI jobe2eruns once per browser, with the Playwright report uploaded on failure. Cross document view transitions are
skipped in Firefox, which does not support them. charts::livewire, a view with a Livewiremorph.addedhook that runs the scripts of charts inserted by a later
Livewire response.<x-charts::chart>includes it (when Livewire is installed) and marks its wrapper with
data-charts. The service provider also injects it before</body>of every full-page HTML response that contains a
Livewire component, the way Livewire injects its assets (Support\LivewireHookInjector, aRequestHandled
listener), so even a page that starts without a chart works. Config:charts.livewire.inject(defaulttrue).tests/Feature/RealLibraryTest.phpandtests/js: the rendered scripts run in jsdom against the real libraries
(npm ci --prefix tests/js; setCHARTS_REQUIRE_JS=1to fail instead of skip when Node is missing). CI runs it and
Dependabot watchestests/js.
Changed
- Every JavaScript integration targets the latest major of its library: Chart.js 4, ECharts 6, Highcharts 13, Frappe
Charts 2 and FusionCharts 4. The class docblocks state the supported major and the CDN script; Highcharts and
FusionCharts are commercial and need your own license. Details and before/after code are in UPGRADE.md. - Chart.js: the default options and every helper write the Chart.js 3/4 layout (
scales.y.beginAtZero,
plugins.legend,plugins.title,scales.x/scales.y/scales.r,datasets.bar.barPercentage);
Dataset::lineTension()writestension, whose default is straight lines;<id>_create()destroys a chart that is
already on the canvas. ThehorizontalBartype no longer exists in Chart.js. - ECharts: the default theme is the ECharts 6 one;
theme('v5')withecharts@6/theme/v5.jsrestores the old look.
<id>_create()disposes an existing instance. - Frappe Charts: the script uses
window['frappe-charts'].Chart;hideDots()writes the invertedlineOptions.showDots. - Highcharts and FusionCharts: the previous chart is destroyed or disposed before a new one is created.
ChartsServiceProvider::boot()no longer takes the unusedRouter $routerparameter.- PHP 8.3 features where they help: typed class constants (
public const array CIRCULAR_TYPES, ...) and#[\Override]
on every method that overridesformat(),resolveOptions(),exportLabels()orregister(). - Every PHP file in
src/usesdeclare(strict_types=1), and every property, parameter and return type is native:
typed properties (public array $labels,public int|string|null $height, ...), fluent methods returnstatic,
container()/script()returnView|static,formatX()methods returnstring,dataset()returns
DatasetClass. Constructors no longerreturnanything. height()andwidth()acceptint|string(for example'100%'); strings are escaped as before.DatasetClass::format(array $labels = []): arraynow exists on the base dataset; library datasets all accept the
$labelsargument.minimalist()has one signature,minimalist(bool $display = true), in every library that has it (Chart.js, ECharts,
Highcharts):truehides the legend and the axes.formatDatasets(), andformatOptions()of Echarts, Frappe and Highcharts, no longer modify the chart or the datasets:
they format copies, so repeated calls give identical output. Echarts and Highcharts no longer store the labels in
$options, and datasets are no longer padded in place.- Computed options are produced by the new protected
BaseChart::resolveOptions()instead offormatOptions()overrides. Json::encode()relies onRawregistering itself while encoding; it no longer walks the value first.- PHPStan runs at level 9 without a baseline.
json_encode($chart)returnstoArray()instead of the public properties (BaseChartisJsonSerializable).- The
<id>_refresh()update code of every library moved into<id>_update(payload), which refresh now calls; the
init partial registers thecharts:updatelistener. Fusioncharts overrides the new protectedexportLabels()instead
offormatLabels(); the output is the same. - The
chart.stubused bymake:charthasstrict_typesand a full class docblock with a usage example. - CI also runs on pushes to the
6.xmaintenance branch;composer.jsonaliasesdev-mainto8.x-dev.
Fixed
- A chart inside a Livewire 4 component never drew: Livewire put its
<!--[if BLOCK]><![endif]-->morph markers into
the JavaScript ofcharts::init, and in JavaScript<!--starts a line comment.init.blade.phpnow declares itself
script content to Livewire (two PHP comments that print nothing). - Going back with
wire:navigateor Turbo to a page with a chart of a stable id drew nothing (the rendered flag of the
first visit was still set).<id>_loadnow tracks the element it drew into (<id>_element). - A chart that a later Livewire response inserts (
@ifturning true) stayed empty because browsers do not run scripts
that a DOM morph inserts; seecharts::livewireabove. - Lightweight Charts: running the script twice reset
<id>_series; it keeps the list now. Echarts\Chart::title()wrotetextStyle.fontWeightas a boolean; it writes'bold'or'normal'.- ECharts and Highcharts
<id>_refresh()kept the series that were missing from the new payload. Frappe\Chart::hideLine()wrotelineOptions.hideDots; it now writeslineOptions.hideLine.Echarts\Chart::export($export)ignored its argument;export(false)now hides the toolbox.Chartjs\Dataset::label()had no effect becauseformat()overwrote it with the dataset name; an explicit label now wins.Fusioncharts\Chart::formatLabels()did not use the script safe JSON flags; it now escapes<,>,&and quotes.Fusioncharts\Dataset::formatValues()raised an undefined key error when pie values outnumbered the labels; the label is
nullthere, as in the other libraries.BaseChart::script($view)threw "no datasets" when used as a setter; it only validates when rendering.container('')andscript('')rendered instead of setting the view; onlynullrenders.formatType()crashed with no chart type and no datasets; it throws aLogicExceptionwith a clear message.options()crashed on a non stringpluginsvalue and looked atpluginsbefore converting a Collection.