Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to add zoom and pan in charts and also how to filter chart with tha date #3

Open
shekhawat777 opened this issue May 7, 2021 · 1 comment

Comments

@shekhawat777
Copy link

how to add zoom and pan in charts and also how to filter chart with tha date

@miguel-martinr
Copy link

miguel-martinr commented Jun 19, 2022

For adding zoom and pan you have to:

  1. Install (Zoom)[] plugin:
$ npm install chartjs-plugin-zoom
  1. Add it to your chart wiht it's settings:
import zoomPlugin from 'chartjs-plugin-zoom';
      <CChartBar
        {...props}
        plugins={[zoomPlugin, annotationPlugin]}
        options={{
          plugins: {
            zoom: {
              pan: {
                enabled: true,
                mode: 'xy',
                threshold: 10,
                
              },
              zoom: {
                wheel: {
                  enabled: true,
                  speed: 0.1,
                  
                },
                drag: {
                 enabled: false,  
                 },
                pinch: {
                  enabled: false
                },
                mode: 'xy',
              }
            },
          }
        }}
      />

Currently I'm having some errors if I don't provide ALL setitings, so you should keep that in mind when using other plugins as well, it's explained here #7
:)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants