You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Chart.js module for charting funnel plots. This plugin extends with a new char type funnel.
A Funnel chart is a variant of a bar chart where the bar shrinks on one side to the size of the next bar. In addition, they are usually centered giving the visual impression of a funnel.
Trapezoid Elements are Bar elements and provide the same coloring options. In addition, see TrapezoidElementOptions custom option with respect to shrinking behavior.
In addition, the FunnelController has the following options FunnelController to customize the alignment of the chart.
ESM and Tree Shaking
The ESM build of the library supports tree shaking thus having no side effects. As a consequence the chart.js library won't be automatically manipulated nor new controllers automatically registered. One has to manually import and register them.
Variant A:
importChart,{LinearScale,CategoryScale}from'chart.js';import{FunnelController,TrapezoidElement}from'chartjs-chart-funnel';// register controller in chart.js and ensure the defaults are setChart.register(FunnelController,TrapezoidElement,LinearScale,CategoryScale);constchart=newChart(document.getElementById('canvas').getContext('2d'),{type: 'funnel',data: {labels: ['Step 1','Step 2','Step 3','Step 4'],datasets: [{data: [0.7,0.66,0.61,0.01],},],},});