Bar Chart¶
Short Description¶
The Bar Chart Display Module uses vertical bars to show comparisons among categories. Several options are available to customize the appearance of the chart.
Example Code¶
<div class="plastic-js" style="height: 400px">
<script class="plastic-data" type="application/json" data-url="/docs/_static/data/countries.json" data-format="sparql-json"></script>
<script class="plastic-display" data-module="discrete-bar-chart" type="application/json">
{
"staggerLabels": false,
"tooltips": false,
"showValues": true
}
</script>
</div>
Live Example¶
Example Data¶
Link to the JSON file - click here.
Dependencies¶
Note
plastic.js manages the dependencies automatically. There is no need to include them manually, but you can do so if you want.
D3.js¶
- Website: http://d3js.org/
- Version: 3.4.6
- JavaScript: http://cdnjs.cloudflare.com/ajax/libs/d3/3.4.6/d3.min.js
NVD3¶
- Website: http://nvd3.org/
- Version: 1.1.15-beta
- JavaScript: http://cdnjs.cloudflare.com/ajax/libs/nvd3/1.1.15-beta/nv.d3.min.js
- CSS: http://cdnjs.cloudflare.com/ajax/libs/nvd3/1.1.15-beta/nv.d3.min.css
Possible Options¶
This example snippet contains all available options with their default values:
<script class="plastic-display" data-module="discrete-bar-chart" type="application/json>
{
"staggerLabels": false
"tooltips": true
"showValues": true
"transitionDuration": 350
}
</script>
Properties details:
Label Staggering
Description | Too many bars and not enough room? Try staggering labels. |
Keyword | staggerLabels |
Type | boolean |
"staggerLabels": false
Tooltips
Description | Show tooltips |
Keyword | tooltips |
Type | boolean |
Default | true |
"tooltips": true
Display Values
Description | Show the bar value right on top of each bar. |
Keyword | showValues |
Type | boolean |
Default | true |
"showValues": true
Transition Duration
Description | Duration of the animation in milliseconds. |
Keyword | transitionDuration |
Type | number |
Default | 350 |
"transitionDuration": 350