| Reply | « Previous Thread | Next Thread » |
|
Hi everyone, I am Sergio from Argentina, I and writing a Business Intelligence module in J2ME, that I call BI Mobile, I am planning to do alerts list, pie chart, lines and bars charts horizontal and vertical.
I have finished Pie Chart it works fine, alerts list fine too, but while writing line charts I found that I need to draw 90 degrees rotates text for the X axis labels. Does eny one know how to g.drawString rotated? Thanks so much for any help you can give me Sergio Sergio Mabres Prominente S.A. Argentina |
|
Join Date: Oct 2007
Posts: 2,841
Location: Deva, Romania
Offline
Forum Nokia Champion
|
|
Hi Sergio,
What you could do is this: -Create a blank image -Create an instance of that image's Graphics class (using getGraphics() method) and write the text on it using the drawString(...) method -Show that image using the drawRegion(...) method, specifying the rotation parameter as, for example, Sprite.TRANS_ROT90 Here's the code I used for the canvas. You can adapt it to suit your needs. Code:
import javax.microedition.lcdui.*;
import javax.microedition.lcdui.game.Sprite;
public class MyCanvas extends Canvas {
public void paint(Graphics g) {
String s="java";
Image img=Image.createImage(50,50);
Graphics gr=img.getGraphics();
gr.drawString(s, 0, 0, Graphics.TOP|Graphics.LEFT);
g.drawRegion(img, 0, 0, 50, 50, Sprite.TRANS_ROT90, 0, 0, Graphics.TOP|Graphics.LEFT);
}
}
|
|
Dear Bogdan thanks so much it is just what I needed; I have been programming for enterprise apps. for more than 20 year I never thought I was going to use a Sprite, your idea is great, I wish I could show you the Line Graph final image.
Thanks so mucho for your help Sergio Sergio Mabres Prominente S.A. Argentina |
| Reply | « Previous Thread | Next Thread » |
| Thread Tools | Search this Thread |
|---|---|
| Thread | Thread Starter | Forum | Replies | Last Post |
|---|---|---|---|---|
| Draw text on sprites/bitmaps... | erst | Symbian Media (Graphics & Sounds) | 2 | 2007-05-16 16:05 |
| How to draw text on the bitmap? | Joney.Zhang | Symbian Media (Graphics & Sounds) | 1 | 2006-09-12 08:45 |
| Persist text value of user defined option in Enumerated Text Settings List | leethomso | Symbian User Interface | 0 | 2004-11-24 19:49 |
| How to draw right align text? | yingchuan | Symbian | 1 | 2004-10-23 03:05 |
| How to draw a long text into multiline text?? | titoliu | General Symbian C++ | 1 | 2002-08-09 12:15 |