Skip to content

Instantly share code, notes, and snippets.

@doc22940
Created April 5, 2020 06:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save doc22940/149156db31ccbdb587928b679f52dfdf to your computer and use it in GitHub Desktop.
Save doc22940/149156db31ccbdb587928b679f52dfdf to your computer and use it in GitHub Desktop.
roughViz StackedBar Demo
license: mit
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<script src="https://unpkg.com/rough-viz@1.0.5"></script>
<style>
.wrapper {
display: flex;
flex: wrap;
order: row;
}
</style>
</head>
<body>
<br><br>
<div class="wrapper">
<div id="vis0"></div>
</div>
<script>
new roughViz.StackedBar({
element: '#vis0',
data: [
{month:'Jan', A:20, B: 5, C: 10},
{month:'Feb', A:25, B: 10, C: 20},
{month:'March', A:30, B:50, C:10}
],
labels: 'month',
title: 'Monthly Revenue',
height: window.innerHeight * 0.7,
width: window.innerWidth * 0.8,
roughness: 2,
colors: [
'blue',
'#f996ae',
'skyblue',
'#9ff4df',
],
fillWeight: 0.35,
strokeWidth: 0.5,
fillStyle: 'cross-hatch',
stroke: 'black',
});
</script>
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment