chartjs-plugin-responsive-downsample
TypeScript icon, indicating that this package has built-in type declarations

1.1.3 • Public • Published

chartjs-plugin-responsive-downsample

Build Status

A chart.js plugin to dynamically downsample line chart data depending on the chart resolution. The plugin creates a mipmap-like data structure from line chart data and dynamically choses a downsampled version of the data depending on the chart resolution and x axis scale.

Inspired by: AlbinoDrought/chartjs-plugin-downsample

Installation

$ npm install chartjs-plugin-responsive-downsample

Configuration

{
    options: {
        responsiveDownsample: {
            enabled: true,
            /**
             * Choose aggregation algorithm 'AVG'(Average values) or
             * 'LTTB' (Largest-Triangle-Three-Buckets). Default: 'LTTB'
             */
            aggregationAlgorithm: 'LTTB',
            /**
             * The desired minimal distance between data points in pixels.
             * The plugin downsamples the data and tries to match this threshold.
             * Default: 1 pixel
             */
            desiredDataPointDistance: 1,
            /**
             * The minimal number of data points. The chart data is not downsampled further than
             * this threshold. Default: 100
             */
            minNumPoints: 100,
             /**
              * Cull data to displayed range of x scale. Default: true
              */
            cullData: boolean;
        }
    }
}

Readme

Keywords

none

Package Sidebar

Install

npm i chartjs-plugin-responsive-downsample

Weekly Downloads

238

Version

1.1.3

License

MIT

Unpacked Size

84.9 kB

Total Files

27

Last publish

Collaborators

  • jklimke
  • marcel.pursche