npm.io
1.0.0 • Published 6 years ago

@mikeyeah29/chord-diagram

Licence
ISC
Version
1.0.0
Deps
0
Size
17 kB
Vulns
0
Weekly
0

SVG Chord Diagram

Draw an SVG guitar chord diagram in javascript.

Installation

Include the file dist/chord-diagram.min.js in a script tag

   <script src="dist/chord-diagram.min.js" />

Usage

Create a new chord diagram and put the name of the chord and the fret positions of each string as an array in the constructor parameters

   var am = new ChordDiagram('Am', [-1, 0, 2, 2, 1, 0]);   

Append the svg to an element in the DOM

   var div = document.getElementById('chords');
   div.appendChild(am.getSvg())

Development

The source code is in the js folder, to work on the project these files can be edited directly then when ready to publish run the following command from the root directory

   npm run build

This will run build.js which concatenates and minifies all the js files to dist/chord-diagram.min.js