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

@byu-oit/bar-chart

Package Overview
Dependencies
Maintainers
13
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@byu-oit/bar-chart

Generate a bar chart in svg format. Intended to be used to generate an API response.

  • 1.4.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
13
Created
Source

bar-chart

Generate a bar chart in svg format to be used as an API response.

example output

Single Value

svg output svg output

Muliple Values

svg output svg output

Stacked

svg output svg output

usage

import barChart from '@byu-oit/bar-chart'

const myData = [10, 12, 14, 24, 38]
const myDataLabels = ['A', 'B', 'C', 'D', 'E']
const chartSvg = barChart({data: myData, labels: myDataLabels})

parameter definition

The bar chart function takes a single configuration parameter.

keytyperequired?description
dataArray of Numbers, or 2 Dimensional Array of NumbersrequiredAn array of values to chart. For example, if you want to chart visits per day, your data could be [104, 78, 120, 88] with labels of ['May 13', 'May 14', 'May 15', 'May 16']. The values may themselves be arrays, but must all have the same length.
labelsArray of StringsrequiredAn array of string labels corresponding by index to the associated data element.
legendLabels[string labels]optionalAn array of labels for the bar colors. For example, you could chart visits per day, with each browser in a different color.
stackedbooleanoptional, default is falseIf true, the bars will be stacked instead of side-by-side.
colorsArray of StringsoptionalSupply custom colors for the bars.
showValuesbooleanoptional, default is falseIf true, the value will be shown near the top of each bar.

Keywords

FAQs

Package last updated on 08 Aug 2023

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