Login Register Wishes Forum About
Language Reference » Drawing functions » drawArrow
Help topics
Latest updates
4699d  replaceImageMapTitle
4699d  replaceImageMapValues
4699d  createFunctionSerie
4699d  setAbsicssaPosition
4699d  negateValues
  Download as PDF
  Print this page
  Share this page
  Create an account
  Feed the updates!
Google AdSense
drawArrow - Drawing arrows

This function has been introduced in the 2.0 trunk of the pChart library. It allows you to draw an arrow with some possible customisation like the size, angle and color. All the drawing parameters are given trough a $Format array. To learn more about this please read the Format array guide.

This function is also used internally while drawing the chart axis and the floating labels.

Calling this function
Where :

X1,Y1 are the start coordinate of the arrow line.
X2,Y2 are the end coordinate of the arrow line. (arrow head)
Format is an array containing the drawing parameters of the arrow.

Customisation array - Tune up your arrow!

It is possible to customize the arrow rendering by playing with this array. Providing a detailled configuration is not mandatory, by default the arrow will be drawn black with a size of 10 and a ratio of 1/2, filled with black.

The fill color can be set with FillR, FillG, FillB.
The border color can be set with BorderR, BorderG, BorderB.
The alpha transparency factor can be set with Alpha.
The size of the arrow can be set with Size.
The ratio (angle of the head) can be set with Ratio.
If you want to draw one head on both sides, set TwoHeads to TRUE
You can draw dashed lines using the Ticks parameter.

Sample script

 /* Enable shadow support */

 /* We‘ll draw 25 arrow with different angles and transparency */
   /* Settings of the arrow, we‘ll play with shades of grey */
   $arrowSettings = array("FillR"=>$i*2.5,"FillG"=>$i*2.5,"FillB"=>$i*2.5,"Ticks"=>$i % 5);

   /* Draw the arrow */

This will draw 25 arrows filled with progrssive grey shades and different Ticks length. This sample show that the head angle is internally computed. As the shadow support is enabled on line 2, the arrow will be surrounded by a small (+2,+2) shadow.
Last updated on 11/05/2009 
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. 415 users have registered. This page has been rendered in 0,01 seconds. Wiki revision 1.37.