Language Reference » Linear Bubble chart » Bubble chart basics
Linear bubble charts basics
Require pChart 2.0.13
Linear bubble charts is a convenient way to draw data that got two parameters. In this approach, the 1st parameter is the Y axis value and the second one a value representing something link to this point. We can imagine the association "items in stock" / "items ordered" that would reflect the current status of your stock an it‘s forecast growth.
Let‘s assume that we got the data represented in the table bellow :
This will lead to the following declaration with the pData object structure :
/* Create the pData object */ $MyData = new pData(); /* Provide this year data */ $MyData->addPoints(array(34,55,15,62,38,42),"ThisYear"); $MyData->addPoints(array(5,10,8,9,15,10),"ThisYearNeeds"); $MyData->setSerieDescription("ThisYear","This year"); /* Provide last year data */ $MyData->addPoints(array(5,10,5,1,0,10),"LastYear"); $MyData->addPoints(array(6,10,14,10,14,6),"LastYearNeeds"); $MyData->setSerieDescription("LastYear","Last year"); /* Give a name to the X axis */ $MyData->setAxisName(0,"Current stock"); $MyData->addPoints(array("Apple","Banana","Orange","Lemon","Peach","Strawberry"),"Product"); $MyData->setAbscissa("Product");
You‘ll then have to update your scale before calling the drawScale() function :
/* Scale up for the bubble chart */ $bubbleDataSeries = array("thisYear","LastYear"); $bubbleWeightSeries = array("ThisYearNeeds","LastYearNeeds"); $myBubbleChart->bubbleScale($bubbleDataSeries,$bubbleWeightSeries);
Finally, when the scale is drawn, just call the drawBubbleChart() function with the same arrays :
Components used on this web site : Famfamfam icons has been made by Mark James, Rounded corners lite has been coded by Cameron Cooke and Tim Hutchison, SyntaxHighlighter has been written by Alex Gorbatchev. pChart and this web site have been created by Jean-Damien POGOLOTTI. This documentation contains 185 pages and 56 comments. 409 users have registered. This page has been rendered in 0,01 seconds. Wiki revision 1.37.