A Pen by Jon Wilkinson on CodePen.
Created
May 24, 2016 17:59
-
-
Save jonwilkinson/42e5332e65472f4f25f4e0b7191c02f6 to your computer and use it in GitHub Desktop.
Chartist Sparkline Examples
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="container"> | |
<h1>Chartist Sparkline Examples</h1> | |
<p>Example of an inline <span class="ct-chart line"></span> sparkline chart. </p> | |
<p>Or even a bar <span class="ct-chart bar"></span> chart.<p> | |
<p>And some pie too <span class="ct-chart pie"></span> with no labels.<p> | |
<footer style="margin-top:3em;padding-top:1em;border-top:1px solid #ccc;"> | |
<p class="small">Chartist is here: <a target="_blank" href="https://gionkunz.github.io/chartist-js/index.html">https://gionkunz.github.io/chartist-js/index.html</a></p> | |
</footer> | |
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var data = {series: [[5,8,12,14,10,19,13,10,9,5,11,5,3]]} | |
var piedata = {series:[25,45,30]} | |
var sparkOptions = { | |
height:'1em', | |
width:'4ex', | |
showPoint: false, | |
fullWidth:true, | |
chartPadding: {top: 0,right: 0,bottom: 0,left: 0}, | |
axisX: {showGrid: false, showLabel: false, offset: 0}, | |
axisY: {showGrid: false, showLabel: false, offset: 0} | |
} | |
new Chartist.Line('.ct-chart.line', data, sparkOptions); | |
new Chartist.Bar('.ct-chart.bar', data, sparkOptions); | |
new Chartist.Pie('.ct-chart.pie', piedata, sparkOptions); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="https://cdnjs.cloudflare.com/ajax/libs/chartist/0.9.7/chartist.min.js"></script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.ct-chart svg { | |
margin:1px; | |
vertical-align:text-bottom; | |
} | |
.ct-series-a .ct-line, | |
.ct-series-a .ct-bar { | |
stroke: red; | |
stroke-width: 1px; | |
} | |
.ct-chart-pie .ct-label { | |
display:none; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" /> | |
<link href="https://cdnjs.cloudflare.com/ajax/libs/chartist/0.9.7/chartist.min.css" rel="stylesheet" /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment