473,401 Members | 2,068 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,401 software developers and data experts.

array error for pie graphic

Hi, I've the problem with data array generated for query. The graphic include only first record, not all records. Why? This is the code in the my asp page:

Expand|Select|Wrap|Line Numbers
  1. <%@ language="vbscript" %>
  2. <!--#include file="../Connections/dicomp.asp" -->
  3. <%
  4. Dim oConn, oRs
  5. set oConn= Server.CreateObject ("ADODB.Connection")
  6. Set oRs= Server.CreateObject("ADODB.Recordset")
  7.  
  8. oConn.Open "Driver={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("dicomp.mdb")
  9.  
  10. 'oRs.open "Select conteggio,catgramm From sommacat order by catgramm asc", oConn
  11. 'oRs.open "SELECT Sum(Conteggio) AS SommaDiConteggio, catgramm FROM conteggiocat GROUP BY catgramm ORDER BY catgramm", oConn
  12. oRs.open "SELECT catgramm,sum(conteggio) as sommaconteggio FROM conteggiocat GROUP BY catgramm ORDER BY catgramm", oConn
  13.  
  14. set cd = CreateObject("ChartDirector.API")
  15. '------------------------------------------
  16. if not oRs.EOF then
  17. do while not oRs.EOF
  18. data = data&","&oRs("sommaconteggio")
  19. labels = labels &","& oRs("catgramm")
  20. oRs.MoveNext
  21. loop
  22. end if
  23.  
  24. Arraydata = Split(right(data,len(data)-1), ",",-1,1)
  25. Arraylabels = Split(right(labels,len(labels)-1), ",",-1,1)
  26.  
  27. for i = 0 to ubound(Arraydata)
  28. data = Array(Arraydata(i))',Arraydata(1)',Arraydata(2),Arraydata(3),Arraydata(4))
  29. next
  30.  
  31. for i = 0 to Ubound(Arraylabels)
  32. labels = Array(Arraylabels(i))',Arraylabels(1),Arraylabels(2),Arraylabels(3),Arraylabels(4))
  33. next
  34.  
  35. ' Create a PieChart object of size 560 x 270 pixels, with a golden background and a 1
  36. ' pixel 3D border
  37. Set c = cd.PieChart(560, 270, cd.goldColor(), -1, 1)
  38.  
  39. ' Add a title box using 15 pts Times Bold Italic font and metallic pink background
  40. ' color
  41. Call c.addTitle("Grafico delle Categorie Grammaticali", "timesbi.ttf", 15).setBackground( _
  42.     cd.metalColor(&Hff9999))
  43.  
  44. ' Set the center of the pie at (280, 135) and the radius to 110 pixels
  45. Call c.setPieSize(280, 135, 110)
  46.  
  47. ' Draw the pie in 3D with 20 pixels 3D depth
  48. Call c.set3D(20)
  49.  
  50. ' Use the side label layout method
  51. Call c.setLabelLayout(cd.SideLayout)
  52.  
  53. ' Set the label box background color the same as the sector color, with glass effect,
  54. ' and with 5 pixels rounded corners
  55. Set t = c.setLabelStyle()
  56. Call t.setBackground(cd.SameAsMainColor, cd.Transparent, cd.glassEffect())
  57. Call t.setRoundedCorners(5)
  58.  
  59. ' Set the border color of the sector the same color as the fill color. Set the line
  60. ' color of the join line to black (0x0)
  61. Call c.setLineColor(cd.SameAsMainColor, &H000000)
  62.  
  63. ' Set the start angle to 135 degrees may improve layout when there are many small
  64. ' sectors at the end of the data array (that is, data sorted in descending order). It
  65. ' is because this makes the small sectors position near the horizontal axis, where
  66. ' the text label has the least tendency to overlap. For data sorted in ascending
  67. ' order, a start angle of 45 degrees can be used instead.
  68. Call c.setStartAngle(135)
  69.  
  70. ' Set the pie data and the pie labels
  71. Call c.setData(data, labels)
  72.  
  73. ' output the chart
  74. Response.ContentType = "image/png"
  75. Response.BinaryWrite c.makeChart2(cd.PNG)
  76. Response.End
  77.  
  78. Set c = nothing
  79.  
  80. Set cd = nothing
  81. %>
  82.  
tks very very much

F
Mar 8 '08 #1
1 1509
jhardman
3,406 Expert 2GB
The two "for...next" loops starting on lines 27 and 31 are looping and overwriting, rather than appending data.

Jared
Mar 18 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

19
by: MMMMM | last post by:
Hmmm, my array seems to be emptying itself for no reason. I just want to grab every form element posted to the page into an appropriately sized array... What is going on here? dim arrShort()...
15
by: David Lozzi | last post by:
Howdy, I have a function that uploads an image and that works great. I love ..Nets built in upload, so much easier than 3rd party uploaders! Now I am making a public function that will take the...
6
by: JoeC | last post by:
I am trying to write a graphic library. Yes, I know that it is byoined the scope of this group but I broke the file down to reading a text file of numbers. The problem I am having is that the...
5
by: JoeC | last post by:
I am still working in my maze game and I am making improvments. The main sticking problem that I have is passing my graphic library. This probram uses windows apis but my question has nothing to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.