zxo102

Members
  • Content count

    5
  • Joined

  • Last visited

About zxo102

  • Rank
    Forum Newbie
  1. Hi there, I downloaded the FusionChartsSave.py provided by the fusioncharts team in this forum. I would like to run it with python2.4 and PIL-1.1.6. I tested it against fusioncharts3.0.7. It does return an image for me to save but the image has nothing to do with curves and messed up with different junk colors. I also tested the script with the trial version of fusioncharts3.1. Everything is fine but there is nothing to be returned for me to save except web page displaying error. I did not get any error when I run this script: FusionChartsSave.py under python2.4 and PIL-1.1.6. Anybody knows what is wrong with it? Thanks for your help in advance. ouyang #!c:/python24/python.exe import cgi import Image,ImageDraw import cStringIO # Please find the attached FusionCharts Image saving code for Python CGI. # All developers are welcome to review, modify and comment on the code to embed Python best practices. # The code is developed and tested in Windows Platform- Python 2.5 and is using PIL-1.1.6 Module. # Decoded data from charts form = cgi.FieldStorage() # Width and height of chart. width = form["width"].value height = form["height"].value # Default background color of the chart bgcolor = form["bgcolor"].value # Rows of color values. data = form["data"].value # Reference to graphics object img = Image.new("RGB", (int(width),int(height)), "#"+bgcolor) # Image to store the chart draw = ImageDraw.Draw(img) # Decompress the data rows = data.split(";") i=0 for eachRow in rows: # Split individual pixels. pixels = eachRow.split(",") # Horizontal pixel count imgr = 0 # Iterate through the pixels for eachPixel in pixels: # Split the pixel into color and repeat value thispix = eachPixel.split("_") # Reference to color c = thispix[0] # Reference to repeat factor r = int(thispix[1]) # If color is not empty (i.e., not background pixel) if c!="": c=c.strip() if len(c)<6: # If the hexadecimal code is less than 6 characters, pad with 0 c = ((6-len(c))*"0") + c # Now, set the pixels k=1 while (k <= r): # Add # to hex coded color color="#"+c; # Draw the pixel draw.point((imgr, i), fill=color) # Increment horizontal row count imgr +=1 k +=1 else: # Just increment horizontal index imgr += r i +=1 # Set Download File Name print "Content-Disposition: attachment; filename='FusionCharts.jpg'" ## You can try setting PNG ## print "Content-Disposition: attachment; filename='FusionCharts.png'" ## print "Content-type: image/png" # Set Content Type print "Content-type: image/jpeg" f = cStringIO.StringIO() ## IF you want to save as PNG ## img.save(f, "PNG") img.save(f, "JPEG") f.seek(0) # Write Image print f.read()
  2. Hi there, Sorry for posting many time. Is that possible to add a link as follow into dataset in DragNode.swf? in html, the link is: href="test.py?a=2&b=c&password='xxx' Thanks a lot. ouyang
  3. Hi there, Is that possible to add a link as follow into dataset in DragNode.swf? in html, the link is: For a static html page, say 'a.html', the solution is Any suggestions? ouyang
  4. How to add a link: "

    Hi there, Is that possible to add a link as follow into dataset in DragNode.swf? in html, the link is: &system.mUsers.dboUsers.searchString="]Update Your Information For a static html page, say 'a.html', the solution is Any suggestions? ouyang
  5. Hi there, Is that possible to add a link as follow into dataset in DragNode.swf? in html, the link is: &system.mUsers.dboUsers.searchString="]Update Your Information For a static html page, say 'a.html', the solution is Any suggestions? ouyang