oecd-simple-charts
Version:
D3 charting library for creating pearl charts, stacked bar charts and box plots
803 lines (273 loc) • 12.8 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<title>StackedChart - Documentation</title>
<script src="scripts/prettify/prettify.js"></script>
<script src="scripts/prettify/lang-css.js"></script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc.css">
</head>
<body>
<input type="checkbox" id="nav-trigger" class="nav-trigger" />
<label for="nav-trigger" class="navicon-button x">
<div class="navicon"></div>
</label>
<label for="nav-trigger" class="overlay"></label>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="BoxPlot.html">BoxPlot</a><ul class='methods'><li data-type='method'><a href="BoxPlot.html#update">update</a></li></ul></li><li><a href="PearlChart.html">PearlChart</a><ul class='methods'><li data-type='method'><a href="PearlChart.html#update">update</a></li></ul></li><li><a href="StackedChart.html">StackedChart</a><ul class='methods'><li data-type='method'><a href="StackedChart.html#update">update</a></li></ul></li></ul>
</nav>
<div id="main">
<h1 class="page-title">StackedChart</h1>
<section>
<header>
<h2>
StackedChart
</h2>
<div class="class-description"><p>A stacked chart component</p></div>
</header>
<article>
<div class="container-overview">
<h2>Constructor</h2>
<h4 class="name" id="StackedChart"><span class="type-signature"></span>new StackedChart<span class="signature">(options)</span><span class="type-signature"></span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="StackedChart.js.html">StackedChart.js</a>, <a href="StackedChart.js.html#line43">line 43</a>
</li></ul></dd>
</dl>
<h5>Example</h5>
<pre class="prettyprint"><code>var StackedChartExample = new OECDCharts.StackedChart({
container: '#StackedChartExample',
title: 'Stacked Bar Chart',
renderInfoButton: true,
data: [
{
values: [1,2,3,4,5],
barLabels: ['0%', '100%'],
colors: ['#fddd5d', '#900c3f'],
stackLabels: ['I', 'II', 'III', 'IV', 'V']
},
{
values: [2,4,6,8,20],
barLabels: ['0%', '100%'],
colors: ['#fddd5d', '#189aa8']
}
]
});</code></pre>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>options</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last"><p>The options object for the stacked chart</p>
<h6>Properties</h6>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>container</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>The DOM element to use as container</p></td>
</tr>
<tr>
<td class="name"><code>title</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>The title to display</p></td>
</tr>
<tr>
<td class="name"><code>renderInfoButton</code></td>
<td class="type">
<span class="param-type">bool</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="default">
<code>false</code>
</td>
<td class="description last"><p>The info-Icon for the tooltip, renders after the title</p></td>
</tr>
<tr>
<td class="name"><code>fontSize</code></td>
<td class="type">
<span class="param-type">int</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="default">
<code>14</code>
</td>
<td class="description last"><p>The font-size for the labels in px</p></td>
</tr>
<tr>
<td class="name"><code>marginTop</code></td>
<td class="type">
<span class="param-type">int</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="default">
<code>15</code>
</td>
<td class="description last"><p>The space between the bars in px</p></td>
</tr>
<tr>
<td class="name"><code>barHeight</code></td>
<td class="type">
<span class="param-type">int</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="default">
<code>30</code>
</td>
<td class="description last"><p>The height of a bar in px</p></td>
</tr>
<tr>
<td class="name"><code>data</code></td>
<td class="type">
<span class="param-type">array</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>The data as array</p>
<h6>Properties</h6>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>values</code></td>
<td class="type">
<span class="param-type">array</span>
</td>
<td class="description last"><p>The values to display as stacked bar chart</p></td>
</tr>
<tr>
<td class="name"><code>barLabels</code></td>
<td class="type">
<span class="param-type">array</span>
</td>
<td class="description last"><p>The labels to display left and right to the chart</p></td>
</tr>
<tr>
<td class="name"><code>colors</code></td>
<td class="type">
<span class="param-type">array</span>
</td>
<td class="description last"><p>Colors for the min and max value of the stacked bar chart</p></td>
</tr>
<tr>
<td class="name"><code>stackLabels</code></td>
<td class="type">
<span class="param-type">array</span>
</td>
<td class="description last"><p>Labels for the stacked elements</p></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
<h3 class="subsection-title">Methods</h3>
<h4 class="name" id="update"><span class="type-signature"></span>update<span class="signature">(data)</span><span class="type-signature"></span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="StackedChart.js.html">StackedChart.js</a>, <a href="StackedChart.js.html#line117">line 117</a>
</li></ul></dd>
</dl>
<h5>Example</h5>
<pre class="prettyprint"><code>StackedChartExample.update([
{
values: [1,10,3,4,5],
barLabels: ['0%', '100%'],
colors: ['#fddd5d', '#900c3f'],
stackLabels: ['1', '2', '3', '4', '5']
},
{
values: [2,4,10,15,20],
barLabels: ['0%', '100%'],
colors: ['#fddd5d', '#189aa8']
}
]);</code></pre>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>data</code></td>
<td class="type">
<span class="param-type">array</span>
</td>
<td class="description last"><p>an array containing objects with the new data</p></td>
</tr>
</tbody>
</table>
</article>
</section>
</div>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer>
<script>prettyPrint();</script>
<script src="scripts/linenumber.js"></script>
</body>
</html>