107
rated 0 times
[
109]
[
2]
/ answers: 1 / hits: 27650
/ 6 Years ago, thu, march 22, 2018, 12:00:00
i am using chart js for developing my pie chart. i want to create the legend position just like this. anyone please help me to solve this...
here is my code... i actually want the result just like the picture. and i getting error when i use css zoom:70% in html and make the javascript didn't work..
<!DOCTYPE html>
<html>
<head>
<title></title>
<link rel=stylesheet href=https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css>
<script src=https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.4.0/Chart.min.js></script>
</head>
<style type=text/css>
body{ background-color: #1f1d1d; font-family: Roboto, Myriad Pro, Segoe UI;zoom:70%;}
.col-sm-1.content { border: 2px solid #1f1d1d}
</style>
<body>
<div class=col-sm-1 content style=background-color: #4f4f4f; height:377px;><br><br><br>
<canvas id=myChartBBC style=width:375px; height: 375px;></canvas>
<br>
<p style=text-align:center; color: #fff;font-size: 14px;><i>Browse by Channel</i></p>
</div>
</body>
<script>
var ctx = document.getElementById('myChartBBC').getContext('2d');
var chart = new Chart(ctx, {
// The type of chart we want to create
type: 'pie',
// The data for our dataset
data: {
labels: [USSD, URP, MyTsel App, Chatbot],
datasets: [{
backgroundColor: ['rgb(12, 146, 204)',
'rgb(255, 67, 0)',
'rgb(131, 0, 255)',
'rgb(250, 255, 0)'
],
borderColor: ['rgb(12, 146, 204)',
'rgb(255, 67, 0)',
'rgb(131, 0, 255)',
'rgb(250, 255, 0)'
],
data: [73, 17, 3, 7],
}]
},
// Configuration options go here
options: {
legend:{
position: 'bottom',
labels:{
fontColor: white
}
}
}
});
</script>
</html>
More From » charts