Giter Club home page Giter Club logo

chartjs-plugin-timeline's Introduction

chartjs-plugin-timeline

A timeline plugin for Chart.js Currently requires Chart.js >= 2.6.0

Support zoom and selection and change chart color brush

Examples

Out of the box examples are available here:https://heqingsong.github.io/chartjs-plugin-timeline/index.html

Configuration

To configure the timeline and brush and zoom plugin, you can simply add new config options to your chart config.

{
    title:{
        ...
    },
    scales: {
        ...
    },
    // Container for timeline options
    timeline: {

        // selected chart style
        selected: {
            style: [{
                _id: 'line',
                color: 'green'
            }, {
                _id: 'bar1',
                color: 'rgb(255, 99, 132)'
            }, {
                _id: 'bar2',
                color: 'rgb(200, 104, 204)'
            }, {
                _id: 'scatter',
                color: 'rgb(200, 104, 204)'
            }],
            // open toggle style
            toggleStyle: true
        },
        zoom: {
            enabled: true,
            sensitivity: 1
        },
        // brush default status
        brushDisplay: false,
        xAxesWidth: 60,
        onSelected: function(data) {
            console.log('selected data', data);
        },
        onClick: function(element) {
            console.log('click data', element);
        }
    }
}

Started

  • npm install http-server -g
  • http-server ./

To-do items

  • auto play brush

Building

  • npm install
  • npm run watch

License

chartjs-plugin-timeline is available under the MIT license.

chartjs-plugin-timeline's People

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

gintian

chartjs-plugin-timeline's Issues

Brush selected event keeps firing

Hello,
I have an issue with your plugin.

Every time I draw a brush and then I hove parts which are not brushed or even one which are. I see in the console that the selected event is fired.

I think this event should only be fire after I finished drawing the brush.

Also I facing some weird issues with the brush behavior of brush disappearing and jumping from place to place as you can see here in the gif
GIF

Is there any chance you can fix it?

Thanks!

can i use it with react

i ve tried using it with react same way as chartjs plugin zoom
but i couldnt make it work
any ideas

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.