Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@ node_modules/*
custom/*

docs/index.md

components/
build/
23 changes: 23 additions & 0 deletions component.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "stacked-bar",
"repo": "fredsterss/Chart.StackedBar.js",
"description": "Stacked bar for component/chart",
"version": "0.0.1",
"keywords": [
"bar chart"
],
"dependencies": {},
"development": {
"component/chart": "*"
},
"license": "MIT",
"main": "src/Chart.StackedBar.js",
"scripts": [
"src/Chart.StackedBar.js"
],
"remotes": [
"https://raw.githubusercontent.com",
"https://cdn.rawgit.com",
"https://rawgit.com"
]
}
53 changes: 53 additions & 0 deletions samples/stacked-bar-using-component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<!doctype html>
<html>
<head>
<title>Stacked Bar Chart</title>
<script src="http://www.chartjs.org/assets/Chart.js"></script>
<script src="../build/build.js"></script>
</head>
<body>
<div style="width: 50%">
<canvas id="canvas" height="450" width="600"></canvas>
</div>


<script>
var randomScalingFactor = function(){ return Math.round(Math.random()*100)};

var barChartData = {
labels : ["January","February","March","April","May","June","July"],
datasets : [
{
fillColor : "rgba(220,220,220,0.5)",
strokeColor : "rgba(220,220,220,0.8)",
highlightFill: "rgba(220,220,220,0.75)",
highlightStroke: "rgba(220,220,220,1)",
data : [randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor()]
},
{
fillColor : "rgba(151,187,205,0.5)",
strokeColor : "rgba(151,187,205,0.8)",
highlightFill : "rgba(151,187,205,0.75)",
highlightStroke : "rgba(151,187,205,1)",
data : [randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor()]
},
{
fillColor : "rgba(240,73,73,0.5)",
strokeColor : "rgba(240,73,73,0.8)",
highlightFill : "rgba(240,73,73,0.75)",
highlightStroke : "rgba(240,73,73,1)",
data : [randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor()]
}
]
};
window.onload = function(){
require('stacked-bar')
var ctx = document.getElementById("canvas").getContext("2d");
window.myBar = new Chart(ctx);
window.myBar.StackedBar(barChartData, {
responsive : true
});
};
</script>
</body>
</html>