— Forest and the Trees

Rotating Text without Embedding Fonts

I needed this for creating an axis label for a chart. The Flex Charting label was flashing. Basically it creates a bitmap of the text and then rotates that. Obviously, you can’t select text, but, might be useful for someone. Here it is. Click the “add a text field” button. Then change text in the text input component. Rotate using the slider. Right click, view source.

  1. JC Gueco says: July 31, 200910:47 pm

    This is amazing! Thank you for sharing this. :-)

  2. Ramesh J Kumar says: March 23, 20101:44 am
  3. Doug says: March 23, 20106:42 am

    It should work the same. Just replace Label w/ Text in the code. It’s all based on Bitmap.

  4. Siva says: May 11, 201010:09 am

    Hi Doug,
    Adding my doubt here too so that it might help others. This method http://blog.flexexamples.com/2007/10/15/rotating-labels-in-a-flex-chart-axis-using-the-labelrotation-style/ says how I can rotate my labels but this mehod uses embedded fonts. Could you tell me how I could do the same without embedding fonts? I tried using RotatableLabel with labelRenderer but it didn’t work or maybe I didnt do it right. Here is the piece of code I tried out.

    The data provider is an XMLList like the one below:


    … and so on.

    Do tell me where I am going wrong.

    Thanks a ton.

  5. Siva says: May 11, 201010:13 am

    I have mailed you the code which I tried out. Kindly post it here with corrections.


  6. Doug says: May 11, 201010:32 am

    Hi Siva,
    I don’t think there’s anything wrong w/ your code. It’s just the way Flex Charting works. You have 3 options: 1. embed your font (blog.flexexamples has lots of help for that) 2. set your axis label to empty string and draw a label on top of your chart (although that will probably be a pain to keep lined up on resize) 3. extend the class that draws the axis label (not sure off hand what class that is) and use the rotating text w/o embedding fonts that I posted.
    Sorry I can’t be of more help. But, w/ Flex (and especially w/ Flex Charting) many things are easy, but, you can kind of hit a wall.

Submit comment