Contents
Login Register Wishes Forum About
Language Reference » Linear Bubble chart » Bubble chart basics
Help topics
Latest updates
2115d  replaceImageMapTitle
2115d  replaceImageMapValues
2115d  createFunctionSerie
2115d  setAbsicssaPosition
2115d  negateValues
Toolbox
  Download as PDF
  Print this page
  Share this page
  Create an account
  Feed the updates!
Google AdSense
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.

This two values have to be listed in dedicated datasets.


Exemple

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 :

 $myBubbleChart->drawBubbleChart($bubbleDataSeries,$bubbleWeightSeries);
Last updated on 01/08/2011 
by Jean-Damien 
Linked resources
Community comments
  No comments have been posted yet.
© Copyrights
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.