r.2 - AssetTitle_PieChart
by Steve Thompson
HTML
<script src="https://code.highcharts.com/highcharts.js"></script>
<div class="container">
<div class="cont-box-shadow">
<div class="info">
<div class="var-icon">
<div class="var-structure var-blue">
(
</div>
<div class="var-type var-blue">
A
</div>
<div class="var-structure var-blue">
)
</div>
</div>
<div class="var-name">Team Color</div>
<a href="#">
<div class="info-icon"></div>
</a>
<a href="#">
<div class="alert-icon"></div>
</a>
</div>
<div class="chart-container">
<div id="chart1"></div>
</div>
<div class="menu-tools">
<a href="#">
<div class="nD-edit sm-icons" title="Edit"></div>
</a>
<a href="#">
<div class="nD-trash sm-icons" title="Delete"></div>
</a>
</div>
</div>
</div>
CSS
.container {
width: 196px;
height: 196px;
background-color: #eceded;
position: relative;
padding: 2px;
overflow: hidden;
}
.cont-box-shadow {
width: 100%;
height: 100%;
background-color: white;
-webkit-box-shadow: 0px 1px 1px 1px rgba(171, 172, 172, 1);
-moz-box-shadow: 0px 1px 1px 1px rgba(171, 172, 172, 1);
box-shadow: 0px 1px 1px 1px rgba(171, 172, 172, 1);
}
.info {
width: 100%;
height: 25px;
background-color: #555555;
margin: 0 auto;
}
.var-icon {
position: relative;
float: left;
margin: 5px;
width: 19px;
height: 14px;
font-size: 12px;
}
.var-blue {
color: #42a5f5;
}
.var-structure {
position: relative;
float: left;
}
.var-type {
position: relative;
float: left;
}
.var-name {
font-size: 12px;
color: white;
position: relative;
float: left;
margin-top: 4px;
}
.alert-icon {
display: none;
// background: url(http://i.imgur.com/TcAIU77.png) no-repeat;
// position: relative;
// float: right;
// margin: 5px 3px;
// width: 16px;
// height: 14px;
}
.info-icon {
background: url(http://i.imgur.com/NhumKdn.png) no-repeat;
position: relative;
float: right;
margin: 5px 5px 5px 0;
width: 14px;
height: 14px;
}
.info-icon:hover {
background: url(http://i.imgur.com/Y4NJcU5.png) no-repeat;
}
.chart-container {
width: 100%;
height: 77%;
}
#chart1 {
cursor: pointer;
width: 100%;
height: 100%;
margin: 0 auto;
position: relative;
}
.menu-tools {
display: none;
position: relative;
float: right;
margin-right: 5px;
}
.container:hover .menu-tools {
display: block;
}
.sm-icons {
width: 15px;
height: 15px;
position: relative;
float: left;
margin-right: 5px;
}
.nD-edit {
background: url(http://i.imgur.com/2JA9xGB.png) no-repeat;
}
.nD-edit:hover {
background: url(http://i.imgur.com/wl0o0oZ.png) no-repeat;
}
.nD-trash {
background: url(http://i.imgur.com/5V6UKIT.png) no-repeat;
}
.nD-trash:hover {
background:...
JavaScript
$(function() {
Highcharts.setOptions({
lang: {
thousandsSep: ','
}
});
$('#chart1').highcharts({
chart: {
type: 'pie'
},
colors: ['#4c4c4c', '#6c6c6c', '#8c8c8c', '#acacac', '#cccccc'],
credits: {
enabled: false
},
exporting: {
enabled: false
},
legend: {
enabled: false
},
title: {
text: ''
},
tooltip: {
borderWidth: 0,
backgroundColor: "#3c3f42",
borderRadius: 5,
hideDelay: 1000,
shadow: false,
headerFormat: '',
followPointer: true,
useHTML: true,
pointFormat: '<span style="font-size: 10px; color: white;">{point.name}</span><br/><span style="color: white; font-weight: bold;">{point.y:,.0f} ({point.percentage:,.0f}%)</span><br/>'
},
plotOptions: {
series: {
states: {
hover: {
enabled: false
}
},
point: {
events: {
mouseOver: function() {
this.options.oldColor = this.color;
this.graphic.attr("fill", "#f37021");
},
mouseOut: function() {
this.graphic.attr("fill", this.options.oldColor);
}
}
},
},
pie: {
cursor: 'pointer',
dataLabels: {
enabled: false
},
center: ['50%', '65%'],
size: '125%'
}
},
series: [{
data: [2477, 564, 214, 799, 1000]
}]
});
});