Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

chartjs-plugin-annotation

Package Overview
Dependencies
Maintainers
3
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chartjs-plugin-annotation

Annotations for Chart.js

  • 1.0.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
212K
decreased by-19.75%
Maintainers
3
Weekly downloads
 
Created

What is chartjs-plugin-annotation?

The chartjs-plugin-annotation package is a plugin for Chart.js that allows you to add annotations to your charts. These annotations can be lines, boxes, or labels that highlight specific areas or points on the chart, making it easier to convey additional information or emphasize certain data points.

What are chartjs-plugin-annotation's main functionalities?

Line Annotation

This feature allows you to add a horizontal or vertical line to your chart. The line can be used to mark a specific value on the x or y axis. In this example, a horizontal line is added at the y-value of 25 with a label 'Threshold'.

{
  type: 'line',
  mode: 'horizontal',
  scaleID: 'y-axis-0',
  value: '25',
  borderColor: 'red',
  borderWidth: 2,
  label: {
    enabled: true,
    content: 'Threshold'
  }
}

Box Annotation

This feature allows you to add a rectangular box to your chart. The box can highlight a specific area on the chart. In this example, a box is drawn from January to March on the x-axis and from 10 to 50 on the y-axis.

{
  type: 'box',
  xScaleID: 'x-axis-0',
  yScaleID: 'y-axis-0',
  xMin: 'January',
  xMax: 'March',
  yMin: 10,
  yMax: 50,
  backgroundColor: 'rgba(101, 33, 171, 0.5)',
  borderColor: 'rgb(101, 33, 171)',
  borderWidth: 1
}

Label Annotation

This feature allows you to add a label at a specific point on the chart. The label can contain text and can be styled with various options. In this example, a label is added at the point (February, 30) with the text 'This is a label'.

{
  type: 'label',
  xValue: 'February',
  yValue: 30,
  backgroundColor: 'rgba(0,0,0,0.8)',
  content: ['This is a label'],
  font: {
    size: 12
  },
  color: 'white',
  position: 'center'
}

Other packages similar to chartjs-plugin-annotation

FAQs

Package last updated on 01 Jun 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc