How to use the react-chartjs-2.Chart.pluginService function in react-chartjs-2

To help you get started, we’ve selected a few react-chartjs-2 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github AdExNetwork / adex-platform / src / components / dashboard / charts / simplified.js View on Github external
useEffect(() => {
		Chart.pluginService.register({
			afterDraw: function(chart) {
				if (chart.tooltip._active && chart.tooltip._active.length) {
					const activePoint = chart.controller.tooltip._active[0]
					const ctx = chart.ctx
					const x = activePoint.tooltipPosition().x
					const topY = chart.scales['y-axis-1'].top
					const bottomY = chart.scales['y-axis-1'].bottom
					ctx.save()
					ctx.beginPath()
					ctx.moveTo(x, topY)
					ctx.lineTo(x, bottomY)
					ctx.lineWidth = 1 // line width
					ctx.setLineDash([1, 5])
					ctx.strokeStyle = '#C0C0C0' // color of the vertical line
					ctx.stroke()
					ctx.restore()
github FrontSpot-Community / code-battle / src / client / components / Profile / shared / TaskStatChart.js View on Github external
componentWillMount() {
    Chart.pluginService.register({
      beforeDraw: plugin
    });
  }
github joelmora / macos-activity-monitor / src / components / LineRealtimeChart.js View on Github external
componentDidMount() {
    Chart.pluginService.register({
      realtime: RealTimePlugin
    })
  }
  render() {
github LiskHQ / lisk-desktop / src / components / dashboard / currencyGraph.js View on Github external
componentDidMount() {
    Chart.pluginService.register({
      id: 'hideAxisX',
      afterDraw(chartInstance) {
        drawGradientRectangle(chartInstance, {
          bottomPosition: bottomPadding + 32,
          height: 10,
        });
      },
    });
  }
github cozy / cozy.github.io / en / cozy-banks / src / ducks / categories / Chart.jsx View on Github external
UNSAFE_componentWillMount() {
    ReactChart.pluginService.register(pieceLabel)
  }