473,659 Members | 3,162 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

array error for pie graphic

1 New Member
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 1517
jhardman
3,406 Recognized Expert Specialist
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
2450
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() Elements = 0 dim frm for each frm in Request.Form Elements = Elements + 1
15
5336
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 path of the uploaded image, and resize it with the provided dimensions. My function is below. The current function is returning an error when run from the upload function: A generic error occurred in GDI+. Not sure what exactly that means. From what...
6
1878
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 program is not printing the same numbers that are in the file Here is my code: #include<windows.h> #include<iostream>
5
1894
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 do with those. So please dont jump on me for that. I am making this graphics library and my bitmap data is stored in an array. This library works some time and when I have to use the copy constructor it dosn't seem to work. I did my best to...
0
8337
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8748
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8628
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7359
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5650
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4175
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2754
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1978
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1739
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.