1.0.5 • Published 2 years ago

m2m-chartjs-plugin-crosshair v1.0.5

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Chart.js plugin to draw vertical crosshair, zoom, interpolate values and sync chart interactions.

Requires Chart.js 3.9.0 or later.

Documentation

Example

new Chart(ctx, {
  // ... data ...
  options: {
    // ... other options ...
    plugins: {
      tooltip: {
        mode: 'interpolate',
        intersect: false
      },
      crosshair: {
        line: {
          color: '#F66',  // crosshair line color
          width: 1        // crosshair line width
        },
        sync: {
          enabled: true,            // enable trace line syncing with other charts
          group: 1,                 // chart group
          suppressTooltips: false   // suppress tooltips when showing a synced tracer
        },
        zoom: {
          enabled: true,                                      // enable zooming
          zoomboxBackgroundColor: 'rgba(66,133,244,0.2)',     // background color of zoom box 
          zoomboxBorderColor: '#48F',                         // border color of zoom box
          zoomButtonText: 'Reset Zoom',                       // reset zoom button text
          zoomButtonClass: 'reset-zoom',                      // reset zoom button class
        },
        callbacks: {
          beforeZoom: () => function(start, end) {                  // called before zoom, return false to prevent zoom
            return true;
          },
          afterZoom: () => function(start, end) {                   // called after zoom
          }
        }
      }
    }
  }
});

Development

You first need to install node dependencies (requires Node.js):

> npm install

The following commands will then be available from the repository root:

> gulp build            // build dist files
> gulp build --watch    // build and watch for changes
> gulp lint             // perform code linting
> gulp docs             // generate GitBook documentation (`dist/docs`)
> gulp samples          // prepare samples for release (`dist/samples`)
> gulp package          // create an archive with dist files and samples
> gulp netlify          // prepare Netlify artifacts (`dist/www`)

License

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

abbrevacornacceptsacorn-jsxajvagentkeepaliveajv-errorsajv-keywordsalgoliasearchalphanum-sortansi-alignansi-colorsansi-grayansi-escapesansi-htmlansi-stylesansi-regexansi-wrapanymatchappend-bufferarchyaprobaarr-diffargparsearr-filterarr-flattenarr-unionarr-maparray-flattenarray-eacharray-initialarray-lastarray-slicearray-sortarray-unionarray-uniquearray-uniqasn1asn1.jsassertassert-plusassign-symbolsastral-regexasyncasync-doneasync-eachasync-limiterasync-settleasynckitatobautocomplete.jsautoprefixeraws-sign2aws4babel-loaderbabel-plugin-dynamic-import-nodebabel-plugin-polyfill-corejs2babel-plugin-polyfill-corejs3bachbabel-plugin-polyfill-regeneratorbalanced-matchbasebase64-jsbatchbcrypt-pbkdfbinaryextensionsbinary-extensionsbig.jsbindingsbn.jsbluebirdbody-parserboolbasebonjourbrace-expansionboxenbracesbrorandbrowserify-cipherbrowserify-aesbrowserify-desbrowserify-rsabrowserify-signbrowserify-zlibbrowserslistbufferbuffer-crc32buffer-equalbuffer-frombuffer-jsonbuffer-indexofbuffer-xorbuiltin-status-codesbuiltin-modulescacbytescache-basecacachecache-loadercacheable-requestcall-me-maybecaller-callsitecaller-pathcallsitescamel-casecamelcasecaniuse-apicaniuse-litecaselesschalkcall-bindchokidarchardetchownrchart.jschrome-trace-eventci-infocipher-baseclass-utilsclean-csscli-cursorcli-boxescli-widthcliuicloneclone-bufferclone-statsclone-responsecloneable-readablecoacode-point-atcollection-visitcollection-mapcolor-convertcolor-stringcolor-namecombined-streamcolorcolorettecolor-supportcommandercommondircompressioncompressibleconcat-mapconcat-streamconfigstorecomponent-emitterconsolaconnect-history-api-fallbackconsole-browserifyconsolidatecontent-dispositionconstants-browserifycontent-typeconvert-source-mapcopy-concurrentlycookiecookie-signaturecopy-descriptorcopy-propscore-js-compatcore-util-iscosmiconfigcopy-webpack-plugincreate-ecdhcreate-hashcreate-hmaccross-spawncrypto-browserifycrypto-random-stringcsscss-color-namescss-declaration-sortercss-loadercss-parsecss-select-base-adaptercss-selectcss-treecss-whatcssesccssnanocssnano-preset-defaultcssnano-util-get-argumentscssnano-util-get-matchcssnano-util-raw-cachecssocssnano-util-same-parentcyclistdashdashde-indentddebugdecode-uri-componentdecamelizedeep-equaldecompress-responsedeep-extenddeep-isdeepmergedefault-comparedefault-gatewaydefault-resolutiondefine-propertiesdefer-to-connectdefine-propertydeldepddelayed-streamdes.jsdestroydetect-filediffie-hellmandir-globdetect-nodedns-equaldns-packetdoctrinedns-txtdocsearch.jsdom-converterdom-serializerdom-walkdomain-browserdomelementtypedot-propdomhandlerdomutilsduplexifyduplexer3each-propsecc-jsbnee-firstellipticelectron-to-chromiumemoji-regexend-of-streamemojis-listenhanced-resolveencodeurlentitiesenvifyenvinfoerrnoerror-exes-to-primitivees6-iteratores-abstractes5-extes6-promisees6-symboles6-weak-mapescaladeescape-string-regexpescape-htmlescape-goateslint-scopeeslinteslint-utilseslint-visitor-keysespreeesprimaesqueryesrecurseestraverseestree-walkeresutilsetageventemitter3eventsevp_bytestokeyeventsourceexecaexpand-tildeexpand-bracketsexpressextend-shallowextextendexternal-editorextglobfast-deep-equalextsprintffancy-logfast-json-stable-stringifyfast-globfast-levenshteinfaye-websocketfiggy-puddingfiguresfile-entry-cachefile-loaderfile-uri-to-pathfill-rangefinalhandlerfind-upfind-cache-dirfindup-syncfinedflagged-respawnflat-cacheflush-write-streamflattedfollow-redirectsfor-ownfor-inforeachforever-agentform-dataforwardedfragment-cachefreshfrom2fs-mkdirp-streamfs-write-stream-atomicfs.realpathfunction-bindfunctional-red-black-treegensyncget-caller-fileget-intrinsicget-streamget-valuegetpassglobglob-parentglob-streamglob-to-regexpglob-watcherglobalglobal-modulesglobal-dirsglobal-prefixglobalsglobbyglogggotgraceful-fsgray-mattergulploghandle-thinghar-schemahashar-validatorhas-ansihas-flaghas-bigintshas-symbolshas-valuehas-valueshas-yarnhash-basehash-sumhash.jshehex-color-regexhomedir-polyfillhogan.jshmac-drbghosted-git-infohpack.jshsl-regexhsla-regexhtml-comment-regexhtml-entitieshtml-minifierhtml-tagshtmlparser2http-cache-semanticshttp-deceiverhttp-errorshttp-proxyhttp-parser-jshttp-proxy-middlewarehttp-signaturehttps-browserifyiconv-liteicss-replace-symbolsicss-utilsieee754ignoreiferrimmediateimport-freshimport-cwdimport-fromimport-lazyimport-localimurmurhashindexes-ofinflightinfer-ownerinheritsiniinquirerinternal-ipinterpretinvert-kvipip-regexis-absoluteipaddr.jsis-absolute-urlis-accessor-descriptoris-argumentsis-bigintis-arrayishis-binary-pathis-bufferis-boolean-objectis-ciis-callableis-core-moduleis-data-descriptoris-color-stopis-date-objectis-descriptoris-extendableis-directoryis-extglobis-globis-fullwidth-code-pointis-installed-globallyis-negative-zerois-negated-globis-moduleis-npmis-numberis-number-objectis-objis-path-cwdis-path-in-cwdis-path-insideis-plain-objis-plain-objectis-relativeis-regexis-referenceis-resolvableis-stringis-streamis-svgis-unc-pathis-symbolis-typedarrayis-valid-globis-utf8is-windowsis-wslisarrayisexeis-yarn-globalisobjectistanbul-lib-coverageisstreamistanbul-lib-instrumentistextorbinaryjest-workerjavascript-stringifyjs-tokensjs-yamljsbnjson-bufferjson-parse-better-errorsjson-schemajson-schema-traversejson-stable-stringify-without-jsonifyjson-stringify-safejson3json5jsprimjust-debouncekeyvkillablekind-oflast-call-webpack-pluginlast-runlatest-versionlazystreamlcidleadlevnliftofflinkify-itload-json-fileload-scriptloader-runnerloader-utilslocate-pathlodashlodash.clonedeeplodash._reinterpolatelodash.debouncelodash.kebabcaselodash.memoizelodash.templatelodash.templatesettingslodash.uniqloglevellower-caselowercase-keyslru-cachemagic-stringmake-dirmake-iteratormap-cachemap-visitmarkdown-itmarkdown-it-anchormarkdown-it-chainmarkdown-it-containermarkdown-it-emojimarkdown-it-table-of-contentsmatchdepmd5.jsmdn-datamdurlmedia-typermemory-fsmerge-descriptorsmerge-source-mapmerge-streammethodsmicromatchmiller-rabinmimemime-dbmime-typesmimic-fnmimic-responsemin-documentmini-css-extract-pluginminimalistic-assertminimalistic-crypto-utilsminimatchmississippimixin-deepmkdirpmove-concurrentlymsmulticast-dnsmulticast-dns-service-typesmute-stdoutmute-streamnannanomatchnatural-comparenegotiatorneo-asyncnext-ticknice-tryno-casenode-forgenode-libs-browsernode-releasesnoptnormalize-package-datanormalize-pathnormalize-rangenormalize-urlnow-and-laternpm-run-pathnprogressnth-checknum2fractionnumber-is-nanoauth-signobject-copyobject-assignobject-inspectobject-isobject-keysobject-visitobject.assignobject.defaultsobject.mapobject.getownpropertydescriptorsobject.pickobject.reduceobject.valuesobufon-finishedon-headersonceonetimeopencollective-postinstallopnoptimize-css-assets-webpack-pluginoptionatorordered-read-streamsos-localeoriginalos-browserifyos-tmpdirp-finallyp-cancelablep-limitp-locatep-mapp-retryp-trypackage-jsonpakoparallel-transformparent-moduleparam-caseparse-asn1parse-jsonparse-filepathparse-node-versionparse-passwdparseurlpascalcasepath-browserifypath-dirnamepath-is-absolutepath-existspath-is-insidepath-keypath-parsepath-root-regexpath-rootpath-typepath-to-regexppbkdf2picomatchperformance-nowpifypinkie-promisepinkiepkg-dirplexerplugin-errorpngjsposix-character-classesportfinderpostcsspostcss-calcpostcss-colorminpostcss-convert-valuespostcss-discard-commentspostcss-discard-overriddenpostcss-discard-emptypostcss-discard-duplicatespostcss-load-configpostcss-loaderpostcss-merge-rulespostcss-minify-font-valuespostcss-merge-longhandpostcss-minify-gradientspostcss-minify-paramspostcss-minify-selectorspostcss-modules-extract-importspostcss-modules-local-by-defaultpostcss-modules-scopepostcss-modules-valuespostcss-normalize-charsetpostcss-normalize-display-valuespostcss-normalize-positionspostcss-normalize-repeat-stylepostcss-normalize-stringpostcss-normalize-timing-functionspostcss-normalize-unicodepostcss-normalize-urlpostcss-ordered-valuespostcss-normalize-whitespacepostcss-reduce-initialpostcss-reduce-transformspostcss-safe-parserpostcss-selector-parserpostcss-svgopostcss-unique-selectorspostcss-value-parserprelude-lsprepend-httpprettierpretty-errorpretty-hrtimepretty-timeprismjsprocess-nextick-argsprogressprocessproxy-addrprrpromise-inflightpseudomappslpublic-encryptpumppumpifypunycodepupaqqsquery-stringquerystringquerystring-es3randombytesquerystringifyrandomfillrange-parserraw-bodyread-pkgreadable-streamrcread-pkg-upreaddirprechoirreduceregenerateregenerate-unicode-propertiesregenerator-transformregexppregex-notregexp.prototype.flagsregexpu-coreregistry-auth-tokenregistry-urlregjsgenrelateurlregjsparserremove-bom-bufferremove-bom-streamremove-trailing-separatorrenderkidrepeat-elementrepeat-stringreplace-extreplace-homedirreplacestreamrequire-directoryrequestrequire-main-filenameresolverequires-portresolve-dirresolve-fromresolve-cwdresolve-optionsresolve-urlresponselikerestore-cursorretretryrgb-regexrgba-regexrimrafripemd160rollup-pluginutilsrun-queuerun-asyncsafe-regexrxjssafer-buffersafe-buffersaxschema-utilssection-matterselect-hoseselfsignedsemversemver-diffsemver-greatest-satisfied-rangesendserialize-javascriptserve-indexset-blockingserve-staticset-valuesetimmediatesetprototypeofsha.jsshebang-commandshebang-regexsignal-exitsimple-swizzleslashslice-ansismoothscroll-polyfillsnapdragon-nodesnapdragonsnapdragon-utilsockjssockjs-clientsort-keyssource-list-mapsource-mapsource-map-resolvesource-map-supportsource-map-urlsourcemap-codecsparklesspdx-correctspdx-exceptionsspdx-expression-parsespdyspdx-license-idsspdy-transportsplit-stringsprintf-jssshpkssristablestack-utilsstatusesstack-tracestd-envstatic-extendstream-browserifystream-eachstream-exhauststream-httpstream-shiftstring-widthstrict-uri-encodestring.prototype.trimendstring.prototype.trimstartstring_decoderstrip-ansistrip-bomstrip-json-commentsstrip-bom-stringstrip-eofstylehacksstylussver-compatsupports-colorsvg-tagssvgostylus-loadertabletapableterm-sizetersertext-tableterser-webpack-plugintextextensionsthroughthrough2-filterthrough2thunkytime-stamptimers-browserifyto-absolute-globto-factorytimsortto-arraybufferto-object-pathto-readable-streamto-regex-rangeto-throughto-regextomltoposorttoidentifiertslibtough-cookietty-browserifytunnel-agenttweetnacltype-checktypetype-festtype-istypedarraytypedarray-to-bufferuc.microuglify-jsunbox-primitiveundertakerunc-path-regexunicode-canonical-property-names-ecmascriptunicode-match-property-ecmascriptundertaker-registryunicode-match-property-value-ecmascriptunicode-property-aliases-ecmascriptuniqunion-valueuniqsunique-filenameunique-slugunique-streamunique-stringuniversalifyunquoteunpipeunset-valueupathupper-caseupdate-notifieruri-jsurixurlurl-loaderurl-parseurl-parse-laxuseutil-deprecateutilautil.promisifyutils-mergeuuidv8-compile-cachev8flagsvalidate-npm-package-licensevalue-or-functionvaryvendorsverrorvinylvinyl-fsvinyl-sourcemapvm-browserifyvuevue-hot-reload-apivue-loadervue-routervue-server-renderervue-style-loadervue-template-compilervue-template-es2015-compilervuepress-html-webpack-pluginvuepress-plugin-smooth-scrollwatchpackvuepress-plugin-containerwatchpack-chokidar2wbufwebpackwebpack-chainwebpack-dev-middlewarewebpack-dev-serverwebpack-logwebpack-mergewebpack-sourceswebpackbarwebsocket-driverwebsocket-extensionswhenwhichwhich-boxed-primitivewhich-modulewidest-lineword-wrapworker-farmwrap-ansiwrappywritewrite-file-atomicwsxdg-basedirxtendy18nyallistyargs-parseryazlzeptofsevents
1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago