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

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

Depending of the specified angle, the label will be positionned either on the right side of the arrow (1-179) or on the left side of the arrow (180-361).

Calling this function
Where :

X,Y are the coordinate of the arrow head.
Text the caption of the label.
Format is an array containing the drawing parameters of the arrow.

Customisation array - Tune up your label and its arrow!

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

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 (internal angle of the head) can be set with Ratio.
The angle can be set with Angle.
The font file name can be set with FontName.
The font size can be set with FontSize.
The length of the arrow line can be set with Length.
You can specify if the text will be placed on top or bellow the arrow with Position. Default is POSITION_TOP but you can also use POSITION_BOTTOM.
You can disable the antialiasing of the line located under the label caption by settin RoundPos to TRUE
You can draw dashed lines using the Ticks parameter.

Sample script

 /* Enable shadow support */

 /* Draw blue label */
 $ArrowSettings = array("FillR"=>37,"FillG"=>78,"FillB"=>117,"Length"=>40,"Angle"=>45);

 /* Draw red label */
 $ArrowSettings = array("FillR"=>188,"FillG"=>49,"FillB"=>42,"Length"=>40,"Angle"=>135,"Position"=>POSITION_BOTTOM, "Ticks"=>2);

 /* Draw green label */
 $ArrowSettings = array("FillR"=>51,"FillG"=>119,"FillB"=>35,"Length"=>40,"Angle"=>225,"Position"=>POSITION_BOTTOM, "Ticks"=>3);

 /* Draw yellow label */
 $ArrowSettings = array("FillR"=>239,"FillG"=>231,"FillB"=>97,"Length"=>40,"Angle"=>315,"Ticks"=>4);

This will draw 4 labels centered on (350,115). As the shadow support is enabled on line 2, the arrow will be surrounded by a small (+2,+2) shadow.
Last updated on 11/06/2009 
by Jean-Damien 
Linked resources
Community comments
Message from uma on 28/03/2010
where can i copy the PDraw.class and pImage.class files. on see the methods in these classes i was really amazed. please send me the link where i can copy these twwo classes. i am waiting for your repy. please please please.........send me the link where can i get pDraw .class and pImage.class.
it is my kind request.
Message from Jean-Damien on 01/04/2010
Hi Uma,
pChart 2.0 is still under development and is not yet released as a public version. I‘ll let you know when downloadable sources will be available.
© 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.