Blame view

app/js/charts/pie.js 1.22 KB
feacde5ff   Rishav   setup acuefuel in...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
  $(function () {
  		var data = [];
  		var series = Math.floor(Math.random()*10)+1;
  		var series = 4;
  		for( var i = 0; i<series; i++)
  		{
  			data[i] = { label: "Series"+(i+1), data: Math.floor(Math.random()*100)+1 }
  		}
  	
  	$.plot($("#pie-chart"), data, 
  	{
  			colors: ["#F90", "#222", "#666", "#BBB"],
  			series: {
  				pie: { 
  					show: true,
  					label: {
  						show: false,
  						formatter: function(label, series){
  							return '<div style="font-size:11px;text-align:center;padding:4px;color:white;">'+label+'<br/>'+Math.round(series.percent)+'%</div>';
  						},
  						threshold: 0.1
  					}
  				}
  			},
  			legend: {
  				show: true,
  				noColumns: 1, // number of colums in legend table
  				labelFormatter: null, // fn: string -> string
  				labelBoxBorderColor: "#888", // border color for the little label boxes
  				container: null, // container (as jQuery object) to put legend in, null means default on top of graph
  				position: "ne", // position of default legend container within plot
  				margin: [5, 10], // distance from grid edge to default legend container within plot
  				backgroundOpacity: 0 // set to 0 to avoid background
  			},
  			grid: {
  				hoverable: false,
  				clickable: false
  			},
  	});
  	
  	});