JSFiddle - React, Tailwind, and code Playground

by aybalasubramanian

HTML

<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/3/jquery.drawDoughnutChart_1.js"></script>
<div id="doughnutChart1" class="chart"></div>
<div id="doughnutChart2" class="chart"></div>
<div id="doughnutChart3" class="chart"></div>

CSS

@import url(//fonts.googleapis.com/css?family=Oswald:400);

body {
  /*background: #222428;*/
  font-family: "Oswald", sans-serif;
}
h1 {
  color: #eee;
  text-align: center;
  margin: 20px 0;
  text-transform: uppercase;
}
.chart {
  float:left
  width: 200px;
  height: 200px;
  position: relative;
}
.doughnutTip {
  position: absolute;
  float: left;
  min-width: 30px;
  max-width: 300px;
  padding: 5px 15px;
  border-radius: 1px;
  background: rgba(0,0,0,.8);
  color: #ddd;
  font-size: 12px;
  text-shadow: 0 1px 0 #000;
  text-transform: uppercase;
  text-align: center;
  line-height: 1.3;
  letter-spacing: .06em;
  box-shadow: 0 1px 3px rgba(0,0,0,0.5);
  transform: all .3s;
  pointer-events: none;
}
.doughnutTip:after {
  position: absolute;
  left: 50%;
  bottom: -6px;
  content: "";
  height: 0;
  margin: 0 0 0 -6px;
  border-right: 5px solid transparent;
  border-left: 5px solid transparent;
  border-top: 6px solid rgba(0,0,0,.7);
  line-height: 0;
}
.doughnutSummary {
  position: absolute;
  top: 50%;
  left: 50%;
  color: #111;
  text-align: center;
  text-shadow: 0 -1px 0 #111;
  cursor: default;
}
.doughnutSummaryTitle {
  position: absolute;
  top: 50%;
  width: 50%;
  margin-top: -27%;
  font-size: 12px;
  letter-spacing: .06em;
}
.doughnutSummaryNumber {
  position: absolute;
  top: 50%;
  width: 100%;
  margin-top: -15%;
  font-size: 30px;
}
.chart path:hover { 
  opacity: .85; 
}

JavaScript

$("#doughnutChart1").drawDoughnutChart([
  { 
    title: "Nope, It's all just the web",
    value : 6,  
    color: "#f3e32b" 
  },
  { 
    title: "Yep. They are different things with different concerns",
    value:  21,   
    color: "#35a8ff" 
  },
  { 
    title: "Yep. They are different things with different concerns",
    value:  9,   
    color: "#ff2211" 
  }
]);

$("#doughnutChart2").drawDoughnutChart([
  { 
    title: "Nope, It's all just the web",
    value : 6,  
    color: "#f3e32b" 
  },
  { 
    title: "Yep. They are different things with different concerns",
    value:  21,   
    color: "#35a8ff" 
  },
  { 
    title: "Yep. They are different things with different concerns",
    value:  9,   
    color: "#ff2211" 
  }
]);

$("#doughnutChart3").drawDoughnutChart([
  { 
    title: "Nope, It's all just the web",
    value : 6,  
    color: "#f3e32b" 
  },
  { 
    title: "Yep. They are different things with different concerns",
    value:  21,   
    color: "#35a8ff" 
  },
  { 
    title: "Yep. They are different things with different concerns",
    value:  9,   
    color: "#ff2211" 
  }
]);