Skip to content

Charts 8.0.0

Latest

Choose a tag to compare

@ConsoleTVs ConsoleTVs released this 29 Nov 01:48
· 12 commits to main since this release
8.0.0
687095f

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, the c3 views and make:chart ... c3, which now fails with the usual
    "Unknown library" message.
  • The Balping\JsonRaw\Raw and Balping\JsonRaw\Encoder class aliases (Support\compat.php, Support\LegacyEncoder,
    the composer autoload.files entry) and the special handling of the Balping class in Json::encode(). Use
    rawObject() or ConsoleTVs\Charts\Support\Raw.
  • The PHPStan baseline file.

Added

  • Three libraries, each with Classes, Features and Views, a make:chart name (billboard, apexcharts,
    lightweightcharts, case insensitive), real-library tests and docs:
    • Billboard (Billboard.js 4, MIT): the replacement for the removed C3. Helpers title(), displayLegend(),
      legendPosition(), tooltip(), displayAxes(), label(), colors(), donut(); dataset color() and axis().
      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(); dataset color(). 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. Helpers displayAxes(), displayGrid(),
      timeVisible(), layoutColors(); dataset color(), candleColors(), pane(). TradingView requires attribution
      with a link to tradingview.com: layout.attributionLogo is on by default and no helper turns it off.
  • <x-charts::chart :chart="$chart" />, a Blade component (Components\Chart, registered under the charts component
    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 defines function <id>_update(payload) (shared with <id>_refresh()) and
    listens for the charts:update event on window, so $this->dispatch('charts:update', ...$chart->updatePayload())
    updates the chart without a re-render. livewire/livewire is a dev dependency only.
  • Inertia 3 support: BaseChart implements Arrayable and JsonSerializable; toArray() returns the library, id, type,
    labels, datasets, resolved options, size and a CDN hint, and refuses Raw JavaScript with a LogicException.
    docs-snippets/ has renderChart() (tested against the real Chart.js 4 and ECharts 6 in tests/js) and React 19,
    Vue 3 and Svelte 5 components. No npm or composer package is published.
  • Chartjs\Chart::horizontal() (indexAxis: 'y'), replacing the horizontalBar type 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 from tests/js/node_modules. For all eight
    libraries: first render, API mode and <id>_refresh(), the charts:update event, a script executed twice, cross
    document view transitions, and Livewire 4 (a dispatched update, a morphing re-render, wire:navigate back and
    forth, a chart inserted by a later response). CI job e2e runs 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 Livewire morph.added hook 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, a RequestHandled
    listener), so even a page that starts without a chart works. Config: charts.livewire.inject (default true).
  • tests/Feature/RealLibraryTest.php and tests/js: the rendered scripts run in jsdom against the real libraries
    (npm ci --prefix tests/js; set CHARTS_REQUIRE_JS=1 to fail instead of skip when Node is missing). CI runs it and
    Dependabot watches tests/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() writes tension, whose default is straight lines; <id>_create() destroys a chart that is
    already on the canvas. The horizontalBar type no longer exists in Chart.js.
  • ECharts: the default theme is the ECharts 6 one; theme('v5') with echarts@6/theme/v5.js restores the old look.
    <id>_create() disposes an existing instance.
  • Frappe Charts: the script uses window['frappe-charts'].Chart; hideDots() writes the inverted lineOptions.showDots.
  • Highcharts and FusionCharts: the previous chart is destroyed or disposed before a new one is created.
  • ChartsServiceProvider::boot() no longer takes the unused Router $router parameter.
  • PHP 8.3 features where they help: typed class constants (public const array CIRCULAR_TYPES, ...) and #[\Override]
    on every method that overrides format(), resolveOptions(), exportLabels() or register().
  • Every PHP file in src/ uses declare(strict_types=1), and every property, parameter and return type is native:
    typed properties (public array $labels, public int|string|null $height, ...), fluent methods return static,
    container()/script() return View|static, formatX() methods return string, dataset() returns
    DatasetClass. Constructors no longer return anything.
  • height() and width() accept int|string (for example '100%'); strings are escaped as before.
  • DatasetClass::format(array $labels = []): array now exists on the base dataset; library datasets all accept the
    $labels argument.
  • minimalist() has one signature, minimalist(bool $display = true), in every library that has it (Chart.js, ECharts,
    Highcharts): true hides the legend and the axes.
  • formatDatasets(), and formatOptions() 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 of formatOptions() overrides.
  • Json::encode() relies on Raw registering itself while encoding; it no longer walks the value first.
  • PHPStan runs at level 9 without a baseline.
  • json_encode($chart) returns toArray() instead of the public properties (BaseChart is JsonSerializable).
  • The <id>_refresh() update code of every library moved into <id>_update(payload), which refresh now calls; the
    init partial registers the charts:update listener. Fusioncharts overrides the new protected exportLabels() instead
    of formatLabels(); the output is the same.
  • The chart.stub used by make:chart has strict_types and a full class docblock with a usage example.
  • CI also runs on pushes to the 6.x maintenance branch; composer.json aliases dev-main to 8.x-dev.

Fixed

  • A chart inside a Livewire 4 component never drew: Livewire put its <!--[if BLOCK]><![endif]--> morph markers into
    the JavaScript of charts::init, and in JavaScript <!-- starts a line comment. init.blade.php now declares itself
    script content to Livewire (two PHP comments that print nothing).
  • Going back with wire:navigate or Turbo to a page with a chart of a stable id drew nothing (the rendered flag of the
    first visit was still set). <id>_load now tracks the element it drew into (<id>_element).
  • A chart that a later Livewire response inserts (@if turning true) stayed empty because browsers do not run scripts
    that a DOM morph inserts; see charts::livewire above.
  • Lightweight Charts: running the script twice reset <id>_series; it keeps the list now.
  • Echarts\Chart::title() wrote textStyle.fontWeight as 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() wrote lineOptions.hideDots; it now writes lineOptions.hideLine.
  • Echarts\Chart::export($export) ignored its argument; export(false) now hides the toolbox.
  • Chartjs\Dataset::label() had no effect because format() 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
    null there, as in the other libraries.
  • BaseChart::script($view) threw "no datasets" when used as a setter; it only validates when rendering.
  • container('') and script('') rendered instead of setting the view; only null renders.
  • formatType() crashed with no chart type and no datasets; it throws a LogicException with a clear message.
  • options() crashed on a non string plugins value and looked at plugins before converting a Collection.