cancel
Showing results for 
Search instead for 
Did you mean: 

Pie Chart by using flot

Former Member
0 Kudos

Hi All,

I had posted the below thread:

Now I am getting the Pie chart.

My query is returning output like this:



<output>
    [  { "label": 2011, "data":10}, { "label": 2010, "data":50}, { "label": 2009, "data":30}, { "label": 2008, "data":20}, { "label": 2007, "data":10}, { "label": 2006, "data":70}]
</output>

But in Pie chart I am getting values in %.e.g 2011, 5%...2006, 37%..

this is the code:

onDataReceived($(data).find("output").text()); // navigating to output element of what is returned from AJAX call

 function onDataReceived(series) {

           // var    obj = JSON.parse(series);

var    obj = eval('(' series ')');

//data =parse( series );

           $.plot($("#placeholder"), obj, options); // specifying the data for the chart

            }

  }

I want the values as it is coming from query not in %.Any idea how to get this.

Thanks in advance.

Regards

Manisha

Edited by: Michael Appleby on Aug 16, 2011 1:46 PM Put in blocks for better presentation.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Manisha

try options as


options = 	{
		series: {
			pie: { 
				show: true,
				radius: 1,
				label: {
					show: true,
					radius: 1,
					formatter: function(label, series){
						return '<div style="font-size:8pt;text-align:center;padding:2px;color:white;">'+label+'<br/>'+series.data[0][1]+'</div>';
					},
					background: { opacity: 0.8 }
				}
			}
		},
		legend: {
			show: false
		}
	}

Thanks

Anshul

Edited by: Anshul Sahu on Aug 16, 2011 10:10 AM

Former Member
0 Kudos

Thanks Anshul,

I dont want like this.My concern is I want data as it is coming from Query template ,not with %.

e.g Query is returning for 2010 data is 50

<output>

[ { "label": 2011, "data":10}, { "label": 2010, "data":50}, { "label": 2009, "data":30}, { "label": 2008, "data":20}, { "label": 2007, "data":10}, { "label": 2006, "data":70}]

</output>

So in Pie chart I want 2010 50 instead of 2010 26%.

Regards

Manisha

Former Member
0 Kudos

Have you tried option as above.

I modified it, it is creating like 2010 50

I am using series.data[0][1] in place of Math.round(series.percent)+'%

Please check and let me know

Thanks

Anshul

Former Member
0 Kudos

Thanks Anshul,

Its working fine now.

Answers (0)