Results 1 to 3 of 3
Thread: A loop that doesn't loop
- 07-29-2007, 10:26 AM #1
Member
- Join Date
- Jul 2007
- Posts
- 6
- Rep Power
- 0
A loop that doesn't loop
Hi,
I need another pair of eyes to glance at the following code.I am trying to create a bar chart and this code section is supposed to draw the bars in the chart. It draws the first dataset only.
The inner loop works fine but the outer one does the first loop and then doesn't continue. Where is my error?
Thanks
Mich
Java Code:if (chartType == 2) { int width = (barwidth/nSeries)/2; int jump = 0; for (int j=0;j<xTags;j++) { curx = startx+jump; for(int i=0;i<=nSeries;i++) { cury = cHeight-((barheight*seriesIdata[i][j]/yJumps)); s2d.setColor(new Color(Integer.parseInt(seriesA[i] [1]),Integer.parseInt(seriesA[i][2]),Integer.parseInt(seriesA[i][3]))); s2d.fillRect(curx,cury,width,(barheight*seriesIdata[i] [j])/yJumps); curx +=width*2; } s2d.drawString(Integer.toString(curx),30,j*10); jump += barwidth; } }
- 07-29-2007, 11:27 PM #2
Try to find out what's going on inside the outer loop:
Java Code:for (int j = 0; j < xTags; j++) { System.out.printf("j = %d xTags = %d%n", j, xTags); curx = startx + jump;
- 07-30-2007, 09:44 AM #3
Member
- Join Date
- Jul 2007
- Posts
- 6
- Rep Power
- 0
Similar Threads
-
Loop Help
By HeavyD in forum New To JavaReplies: 7Last Post: 09-22-2010, 10:55 PM -
do...while loop
By eva in forum New To JavaReplies: 16Last Post: 01-31-2008, 07:44 AM -
while loop
By michcio in forum New To JavaReplies: 5Last Post: 01-27-2008, 01:56 AM -
can you help me with this for loop?
By java_fun2007 in forum New To JavaReplies: 6Last Post: 12-22-2007, 11:20 AM -
While loop
By leebee in forum New To JavaReplies: 1Last Post: 07-18-2007, 04:11 PM
Bookmarks