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

@byu-oit/pie-chart

Package Overview
Dependencies
Maintainers
14
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@byu-oit/pie-chart - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

CHANGELOG.md

4

index.js

@@ -5,7 +5,7 @@ import {scaleOrdinal} from 'd3-scale'

export default function ({data = [1], labels = [1]}) {
export default function ({data = [1], labels = [1], colors = schemeSet1}) {
const segments = () => {
const radius = 50
const color = scaleOrdinal(schemeSet1)
const color = scaleOrdinal(colors)

@@ -12,0 +12,0 @@ const shapeArc = arc()

{
"name": "@byu-oit/pie-chart",
"version": "1.0.0",
"version": "1.1.0",
"description": "Generate a pie chart in svg format. Intended to be used to generate an API response.",

@@ -5,0 +5,0 @@ "main": "dist/pie-chart.js",

const test = require('tape')
const pie = require('../dist/pie-chart')
const fs = require('fs')
const path = require('path')

@@ -12,3 +13,3 @@ test('pie', (assert) => {

fs.writeFileSync('/tmp/pie-chart.svg', chart)
fs.writeFileSync(path.resolve(__dirname, '../example/pie-chart.svg'), chart)

@@ -18,1 +19,21 @@ assert.deepEqual(actual, expected, 'chart')

})
test('custom colors', (assert) => {
const colors = [
'#c6dbef',
'#9ecae1',
'#6baed6',
'#3182bd',
'#08519c'
]
const data = [20, 20, 20, 20, 20]
const labels = ['One', 'Two', 'Three', 'Four', 'Five']
const expected = 5
const chart = pie({data, labels, colors})
const actual = (chart.match(/<path/g) || []).length
fs.writeFileSync(path.resolve(__dirname, '../example/custom-colors.svg'), chart)
assert.deepEqual(actual, expected, 'chart')
assert.end()
})

Sorry, the diff of this file is too big to display

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