Download the PHP package asharif88/filament-plotly without Composer

On this page you can find all versions of the php package asharif88/filament-plotly. 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 filament-plotly

Filament Plotly.js Widget

Inspired by Leandro Ferreira’s Apex Charts plugin & Elemind's Echarts plugin this plugin delivers plotly.js integration for Filament.

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

Table of Contents

Installation

You can install the package via composer:

Register the plugin for the Filament Panels you want to use:

Usage

Start by creating a widget with the command:

The plugin uses the Plotly.react function to render charts. This function takes in the chart data, layout and config as parameters.

You need to implement the getChartData() method to return an array with data, layout and config keys:

Alternatively, you can set the data, layout and config separately by implementing the following methods:

Setting a widget title

You may set a widget title:

Optionally, you can use the getHeading() method.

Setting a widget subheading

You may set a widget subheading:

Optionally, you can use the getSubheading() method.

Adding custom content

You can add custom content before chart within the widget container using the getbeforeContent() method.

Setting a chart id

You may set a chart id:

Making a widget collapsible

You may set a widget to be collapsible:

You can also use the isCollapsible() method:

Setting a widget height

By default, the widget height is set to 300px. You may set a custom height:

Optionally, you can use the getContentHeight() method.

Setting a widget footer

You may set a widget footer:

You can also use the getFooter() method:

Custom view:

Html string:

Header & Footer Actions

You can register Filament actions to appear in the widget header or footer. Override getHeaderActions() / getFooterActions() on your widget to return an array of Filament\Actions\Action (or ActionGroup) instances. These actions are rendered by Filament's actions component and respect alignment settings.

Example — simple header actions:

Example — footer actions:

Notes:

Hiding header content

You can hide header content by NOT providing these

Filtering chart data

You can set up chart filters to change the data shown on chart. Commonly, this is used to change the time period that chart data is rendered for.

Filter schema

You may use components from the Schemas to create custom filters. You need to use HasFiltersSchema trait and implement the filtersSchema() method to define the filter form schema:

The data from the custom filter is available in the $this->filters array. You can use the active filter values within your getChartData() method:

Single select

To set a default filter value, set the $filter property:

Then, define the getFilters() method to return an array of values and labels for your filter:

You can use the active filter value within your getOptions() method:

Live updating (polling)

By default, chart widgets refresh their data every 5 seconds.

To customize this, you may override the $pollingInterval property on the class to a new interval:

Alternatively, you may disable polling altogether:

Defer loading

This can be helpful when you have slow queries and you don't want to hold up the entire page load:

Loading indicator

You can change the loading indicator:

You can also use the getLoadingIndicator() method:

Chart overlay

Use getChartOverlay() to render HTML inside the chart container — directly on top of the Plotly canvas. This is the right place for progress bars, custom annotation panels, and loader overlays, because the content sits naturally inside the chart div without requiring document.getElementById or absolute-positioning tricks.

The overlay is rendered inside a wire:ignore container, so it is set once on mount and then controlled by JavaScript. It will not be re-rendered by Livewire on subsequent updates.

Post-init JS hook

Override getOnChartReadyScript() to run plain JavaScript the moment the Plotly chart is fully initialised. Inside the script, el refers to the chart DOM element.

Dark / light theme sync

Use the HasChartTheme concern to keep Plotly's visual theme in sync with Filament's dark/light mode automatically. The Alpine component watches the dark class on <html> via a MutationObserver and calls Plotly.relayout() whenever the mode changes — no getFooter() workaround needed.

The layout properties returned by each method are merged into the live chart layout via Plotly.relayout(). Return any valid Plotly layout keys.

Plotly event listeners

Override getPlotlyEventListeners() to map Plotly JS events to public methods on your widget. When a mapped event fires, two things happen:

  1. The mapped method is called on this widget with a serialised payload.
  2. A window-level Alpine event plotly:{event} is dispatched so that sibling Livewire components (a table, a slide-over) can also react without coupling to the chart widget.

Store the record's primary key in customdata when building trace data — that's the standard Plotly mechanism for carrying arbitrary metadata per point:

To react from a separate Livewire component (e.g. a ListOrders resource page), listen for the broadcasted window event:

Supported events and payload shapes

Event Payload fields
plotly_click, plotly_hover, plotly_unhover, plotly_doubleclick points[]{curveNumber, pointIndex, x, y, z, text, customdata, traceName}
plotly_selected, plotly_deselect points[] + range, lassoPoints
plotly_legendclick, plotly_legenddoubleclick {curveNumber, traceName}
plotly_relayout, plotly_restyle, plotly_autosize raw layout/style change object

DOM nodes, full trace objects, and axis definitions are stripped before serialisation — only safe, JSON-friendly values reach Livewire.

Streaming support

The HasStreamingSupport concern replaces the traditional getFooter() SSE boilerplate with a small set of override methods. The library owns the EventSource lifecycle, the progress overlay, and component cleanup — your widget only declares what is domain-specific.

SSE message protocol

Your server-side stream must emit JSON messages in this format:

Message Meaning
{"init": true, "total": N} Stream is starting; N is the total number of data messages expected (used for the progress bar).
{"done": true} Stream finished. The library closes the EventSource and removes the progress overlay.
{ ...data } A data point. Forwarded to getOnStreamMessageScript().

Basic example

Returning null from getStreamUrl() disables streaming entirely — useful when required state (e.g. a selected source) has not been set yet.

Full example with theme and click events

The following shows HasStreamingSupport, HasChartTheme, and getPlotlyEventListeners() working together, which is the recommended pattern for a production streaming widget:

Streaming layout patch

Override getStreamingLayoutPatch() to declare layout properties that must be force-merged into the layout on every stream reset, regardless of what el.layout currently holds.

When to use this vs HasChartTheme: If you use HasChartTheme, theme properties are tracked in el.layout and are automatically preserved across stream resets — you do not need getStreamingLayoutPatch() for theme sync. Use getStreamingLayoutPatch() when you need to inject layout properties that are not managed by HasChartTheme, or when you cannot use that trait.

Dark mode

The dark mode is supported and enabled by default for the container.

Publishing views

Optionally, you can publish the views using

Publishing translations

Optionally, you can publish the translations using:

Testing

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of filament-plotly with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
filament/filament Version ^4.0|^5.0
spatie/laravel-package-tools Version ^1.15.0
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 asharif88/filament-plotly contains the following files

Loading the files please wait ...