Announcement

Collapse
No announcement yet.

question on drawTextRelative and Wingdings

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • question on drawTextRelative and Wingdings

    Hi,

    I'm trying to draw multiple UPARROW (each has a text label associate with it) vertically aligned with each other below a bar.

    It seems, from the searches I have, that drawTextRelative with Wingdings are the best option. However, I can't find any documentation or example on its (Wingdings) parameters.

    Also, how do control the space of the multiple UPARROWS?

    Thank you in advance.

    William

  • #2
    wwong112,

    Check this thread.
    Excellent book on JavaScript for beginners

    Comment


    • #3
      The fonts one would typically use to draw symbols in charts would be the Wingdings font or the Symbol font. The problem with Wingdings is that not everyone has it so if you don't have it installed then your best bet is to use the Windows Symbol font. To select the actual symbol to use, I find it easiest to use the Windows Character Map utility. Click on "Start", select All Programs, click on Accessories, click on System Tools and then click on Character Map. From there you can view all of the fonts installed on your system (as well as what all of the symbols will look like) and you can quickly copy specific characters/symbols to the clipboard so you can paste them into a drawText function call.

      Chris

      Comment


      • #4
        I followed your instruction to see all the symbol map characters. I tried to use "Wingdings 3" and copy the right-triangle, then paste it within the "" in the drawTextRelative function:

        drawTextRelative(0,SMA1,"?",Color.lime,null,Text.C ENTER|Text.TOP,"Wingdings 3",10,"Up\n"+ getCurrentBarCount());

        However, I get a totally different symbol. Instead I get a right-angled arrow pointing south.

        Am I doing something wrong?

        W

        Comment


        • #5
          Everytime I draw multiple symbols below a bar, it overwrites the previous ones. Is there any easier way to align them vertically one above another?

          Comment


          • #6
            For the right arrow, try using the following:

            drawTextRelative(0,SMA1,"„",Color.lime,null,Text.C ENTER|Text.TOP,"Wingdings 3",10,"Up\n"+ getCurrentBarCount());

            To draw multiple symbols stacked on the same bar, use the Text.PRESET directive along the the BelowBar1, BelowBar2, etc. and AboveBar1, AboveBar2, etc. constants.

            So, using the prior example, to daw two stacked right arrows you would use:


            PHP Code:
            drawTextRelative(0,BelowBar1,"„",Color.lime,null,Text.PRESET|Text.CENTER|Text.TOP,"Wingdings 3",10,"Up1\n"getCurrentBarCount());
                
            drawTextRelative(0,BelowBar2,"„",Color.blue,null,Text.PRESET|Text.CENTER|Text.TOP,"Wingdings 3",10,"Up2\n"getCurrentBarCount()); 
            Chris

            Comment


            • #7
              One final note, when dealing with special symbols (like those in the Wingding font group), another approach that may be easier for you is to translate the Hex character code into a Unicode escape sequence which is easily done, as follows:

              1. pull up character map and click on the particular symbol that you want to print on an esignal chart.

              2. look at the bottom of the character map application and you will see the Character code. In your example of the right arrow, the character code is 0x84

              3. The Unicode escape sequence for 0x84 is simply '\u0084'. The Unicode sequence will always be '\u00' (those are two zeros) concatenated to the last 2 characters displayed in the Character Map character code.

              4. Put that in your drawTextRelative function and it will print the correct symbol.

              Chris

              Comment

              Working...
              X