Thursday, December 18, 2014

C3: Create a Pie Chart with specific width and height

Below is the code snippet to create a pie chart with specific with and height, using C3 data visualization library:

<div id="pieChart"></div>

<script>
var chart = c3.generate({
bindto : '#pieChart',
size: {
width: 300,
height: 300
},
   data: {
       columns: [
['data1' : 45],
['data2' : 56],
['data3' : 20]
],
       type : 'pie'
   }
});
</script>

No comments:

Post a Comment