Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

Revision as of 01:10, 31 May 2013 by hamishwillee (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Archived:Using graphs in PySymbian

From Wiki
Jump to: navigation, search

Archived.pngAquivado: Este artigo foi arquivado, pois o conteúdo não é mais considerado relevante para se criar soluções comerciais atuais. Se você achar que este artigo ainda é importante, inclua o template {{ForArchiveReview|escreva a sua justificativa}}.

All PySymbian articles have been archived. PySymbian is no longer maintained by Nokia and is not guaranteed to work on more recent Symbian devices. It is not possible to submit apps to Nokia Store.

This PySymbian code snippet shows how can to plot graphs for user given inputs.

Article Metadata
Tested with
Devices(s): Nokia N96
Platform(s): S60 2nd Edition, S60 3rd Edition
Keywords: graphics
Created: ck.umraliya (19 Jul 2008)
Last edited: hamishwillee (31 May 2013)


# import modules
import e32, appuifw,graphics
# Define quit function
def quit():
def draw():
# Get number of graphs
t = appuifw.query(u"Enter Number Of Graphs: (Max 9)","number")
#title of the application = u"Graphs"
# Get range
rrng = appuifw.query(u"Maximum Range Of Graph:","number")
# Graph colors
colors = [0x0000ff,0x00ff00,0xff0000,0xffff00,0xc0c0c0,0x808040,0xff00ff,0xf0cb75,0xbe6a0e]
# Get graph prameters
y = []
n = []
for j in range(t):
(n1,y1) = appuifw.multi_query(u"Title Of Graph %d:"%(j+1),u"Height Of Graph %d:"%(j+1))
y11 = int(y1)
# Define canvas
xx,yy = canvas.size
# Scaling Graphs according to screen size
arrg = float(yy-50)
mf = arrg/rrng
# Draw x,y axis
canvas.line((20,yy-20,xx-32,yy-20), 0)
# Put indicator points
# Draw graphs
h = 30
for i in range(t):
w=(xx-57)/t - 10
s = yy-20-mf*y[i]
canvas.rectangle((h,s,h+w,yy-20), outline=0x000000, fill=colors[i])
x11 = str(y[i])
canvas.text((h,(s-5)),u" %s"%(x11), fill=colors[i])
canvas.text((h,yy), u"%s"%(n[i]), fill=0x4b2192)
#the code will allow the user to exit the application when he presses the exit key


Once the graph is drawn a screenshot function can be used to save the image if user wants. Following images are the outcome of above code.

Number of Graphs
Maximum Range
Graph Parameters
Plotted Graphs

Related Links

Plotting Graphs in Python

This page was last modified on 31 May 2013, at 01:10.
68 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.


Thank you!

We appreciate your feedback.