Contents
Login Register Wishes Forum About
Language Reference » Spring charts functions » setNodesColor
Help topics
Latest updates
2265d  replaceImageMapTitle
2265d  replaceImageMapValues
2265d  createFunctionSerie
2265d  setAbsicssaPosition
2265d  negateValues
Toolbox
  Download as PDF
  Print this page
  Share this page
  Create an account
  Feed the updates!
Google AdSense
setNodesColor - Bulk change the node colors

This function allows you to set the color of a list of given nodes. You‘ll have to call this function when the nodes are already created. Parameters are given trough a $Settings array. To learn more about this please read the Format array guide.

Calling this function
setNodesColor($Nodes,$Settings="");
Where :

Nodes is an array of nodes IDs or a single node ID.


Settings array - Tune up your node!

It is possible to customize the color, ticks and text of the link with this array.

Node(s) color can be set with R, G, B.
Node(s) border color can be set with BorderR, BorderG, BorderB.
Node(s) surrounding color can be set with Surrounding.


Sample script



 /* pChart library inclusions */
 include("class/pData.class.php");
 include("class/pDraw.class.php");
 include("class/pSpring.class.php");
 include("class/pImage.class.php");

 /* Create the pChart object */
 $myPicture = new pImage(300,300);
 $myPicture->drawGradientArea(0,0,300,300,DIRECTION_HORIZONTAL,array("StartR"=>217,"StartG"=>250,"StartB"=>116,"EndR"=>181,"EndG"=>209,"EndB"=>27,"Alpha"=>100));
 $myPicture->drawGradientArea(0,0,300,20,DIRECTION_VERTICAL,array("StartR"=>0,"StartG"=>0,"StartB"=>0,"EndR"=>50,"EndG"=>50,"EndB"=>50,"Alpha"=>100));
 $myPicture->drawRectangle(0,0,299,299,array("R"=>0,"G"=>0,"B"=>0));
 $myPicture->setFontProperties(array("FontName"=>"fonts/Silkscreen.ttf","FontSize"=>6));
 $myPicture->drawText(10,13,"pSpring - Draw spring charts",array("R"=>255,"G"=>255,"B"=>255));

 /* Draw the background */
 $myPicture->setGraphArea(20,20,280,280);
 $myPicture->setFontProperties(array("FontName"=>"fonts/Forgotte.ttf","FontSize"=>9,"R"=>80,"G"=>80,"B"=>80));
 $myPicture->setShadow(TRUE,array("X"=>2,"Y"=>2,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10));

 /* Create the pSpring object */
 $SpringChart = new pSpring();

 /* Create some nodes and relations */
 $SpringChart->addNode("0",array("Name"=>"","Shape"=>NODE_SHAPE_SQUARE,"FreeZone"=>60,"Size"=>20,"NodeType"=>NODE_TYPE_CENTRAL));
 $SpringChart->addNode("1",array("Name"=>"Johanna","Connections"=>array("0")));
 $SpringChart->addNode("2",array("Name"=>"Martin","Connections"=>array("0")));
 $SpringChart->addNode("3",array("Name"=>"Kevin","Connections"=>array("1")));
 $SpringChart->addNode("4",array("Name"=>"Alex","Connections"=>array("1")));
 $SpringChart->addNode("5",array("Name"=>"Julia","Connections"=>array("1")));
 $SpringChart->addNode("6",array("Name"=>"Lena","Connections"=>array("2")));
 $SpringChart->addNode("7",array("Name"=>"Elisa","Connections"=>array("2")));
 $SpringChart->addNode("8",array("Name"=>"Omar","Connections"=>array("2")));

 /* Define the nodes color */
 $SpringChart->setNodesColor(array(0),array("R"=>215,"G"=>163,"B"=>121,"BorderR"=>166,"BorderG"=>115,"BorderB"=>74));
 $SpringChart->setNodesColor(array(1,5,6,7),array("R"=>245,"G"=>183,"B"=>241,"Surrounding"=>-30));
 $SpringChart->setNodesColor(array(2,3,4,8),array("R"=>183,"G"=>224,"B"=>245,"Surrounding"=>-30));

 /* Draw the Sprint graph */
 $Result = $SpringChart->drawSpring($myPicture,array("DrawQuietZone"=>TRUE));
 
 /* Display the statistics */
 print_r($Result);
 
 /* Render the picture */
 $myPicture->Render("drawspring2.png");
Last updated on 07/22/2010 
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. 411 users have registered. This page has been rendered in 0,01 seconds. Wiki revision 1.37.