Skip to content

mcaule/h2d3.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

h2d3.js

Bar chart library based on d3.js

Features

  • Horizontal and vertical bar charts
  • Multiple series
  • Long labels (auto-adjusting margin)
  • Stacked mode
  • Percent stacked mode
  • Hide/Show series
  • Tooltips (use d3.tip)

Examples

Example page

Installation

  • Include d3.min.js
  • For tooltips include d3.tip.js
  • Include h2d3.min.js and add a link to h2d3.min.css

Usage

Create a chart function

var chart = h2d3.chart()
          .width(800).height(400)
          .vertical()//horizontal by default       
          .percentMode(false)//disable percent mode

Assign a element and some data to the chart

chart('#myDiv',data)

Data format

h2d3.js read its data as a list of series

[
  {
    key: "Serie1",
    values: [
      {label:"Group A","value":87},
      {label:"Group B","value":9}
    ]},
  {
    key: "Serie2",
    values: [
      {label:"Group A","value":30},
      {label:"Group B","value":75}
    ]}]

Todolist

  • Sort bars based on a serie value

About

Bar chart library based on d3.js

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published