Skip to content

Instantly share code, notes, and snippets.

@jpllosa
Created December 16, 2021 10:49
Kendo Donut Chart With Borders Example
<!-- https://jpllosa.blogspot.com/ -->
<!DOCTYPE html>
<html>
<head>
<title>Kendo Donut Chart With Borders Example</title>
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2021.2.616/styles/kendo.default-v2.min.css" />
<script src="https://kendo.cdn.telerik.com/2021.2.616/js/jquery.min.js"></script>
<script src="https://kendo.cdn.telerik.com/2021.2.616/js/kendo.all.min.js"></script>
</head>
<body>
<div class="chart-border" style="background-color: #FFE6E6; border-radius: 50px;">
<div style="text-align: center">
Caption here
<div style="float: right; margin-right: 25px">
<span class="k-icon k-i-copy" title="Copy"></span>
<span class="k-icon k-i-delete" title="Delete"></span>
</div>
</div>
<div id="chart"></div>
</div>
<script>
$(document).ready(function() {
$("#chart").kendoChart({
theme: 'material',
transitions: false,
chartArea: {
//background: "transparent",
background: "#F5F5DC",
},
legend: {
visible: true
},
seriesDefaults: {
type: "donut",
startAngle: 150
},
series: [{
name: "2012",
data: [{
category: "Asia",
value: 53.8,
},{
category: "Europe",
value: 16.1,
},{
category: "Latin America",
value: 11.3,
},{
category: "Africa",
value: 9.6,
},{
category: "Middle East",
value: 5.2,
},{
category: "North America",
value: 4.0,
}],
labels: {
visible: true,
background: "transparent",
position: "outsideEnd",
template: "#= category #: \n #= kendo.toString(value, '0.0') + '%'#",
},
}],
tooltip: {
visible: true,
template: "#= value #",
},
render: function(e) {
let $svg = e.sender.element.find("svg").first();
let style = $svg.attr("style");
style = style
+ " border-bottom-left-radius: 50px;"
+ " border-bottom-right-radius: 50px;"
+ " border-top-left-radius: 15px;"
+ " border-top-right-radius: 15px;";
$svg.attr("style", style);
},
});
});
</script>
<style>
.chart-border {
border-style: solid;
border-color: #898788FF;
border-width: 5px;
padding: 2px;
margin: 2px;
}
.k-icon:hover {
cursor: pointer;
}
</style>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment