Giter Club home page Giter Club logo

chartjs-plugin-zoom's Introduction

chartjs-plugin-zoom

GitHub Workflow Status Coverage Status release npm (latest) npm (next) documentation Awesome

A zoom and pan plugin for Chart.js >= 3.0.0

For Chart.js 2.6.0 to 2.9.x support, use version 0.7.7 of this plugin.

Panning can be done via the mouse or with a finger. Zooming is done via the mouse wheel or via a pinch gesture. Hammer.js is used for gesture recognition.

Documentation

You can find documentation for chartjs-plugin-zoom at www.chartjs.org/chartjs-plugin-zoom.

Prior to v0.4.0, this plugin was known as 'Chart.Zoom.js'. Old versions are still available on npm under that name.

Contributing

Before submitting an issue or a pull request to the project, please take a moment to look over the contributing guidelines first.

License

chartjs-plugin-zoom.js is available under the MIT license.

Change log

  • Supports range selection with "range" options
// sample options
const zoomPluginOptions = {
 pan: {...},
 zoom: {...},
 range: {
   enabled: true,
   mode: "xy",
   mirroring: true, // if false, "normal" mode
   drawTime: "beforeDatasetsDraw",
   modifierKey: "alt",
   backgroundColor: "rgba(255, 99, 132, 0.2)",
   borderColor: "rgb(255, 99, 132)",
   borderWidth: 1,
   onRangeSelected: (chart, rangeDataIndex) => {
    // rangeDataIndex: {x: {left, right}, y:{top, bottom}}
   },
   label: {
     enabled: false,
     font: {
       size: 10,
       weight: "normal",
       color: "rgb(255, 99, 132)",
     },
     xFormatter: (dataIndex) => { return "x-value" },
     yFormatter: (dataIndex) => { return "y-value" },
   },
 }
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.