1. Senior Member
Join Date
Dec 1969
Posts
1,407

bill......i&#039;m using your ASP bar graph on one of my pages.<BR><BR>it does a great job, but i would like it to do something a little differently, and i&#039;m not sure how to go about it.<BR><BR>currently, the bars&#039; lengths are representative of the percentage of the total number of units.<BR><BR>i would like the bars to be representative of the percentage of some given number.<BR><BR>so that instead of person A&#039;s units being represented by a bar that is A&#039;s units/total units, i would like it to be A&#039;s units/given number.<BR><BR>and the given number is going to be a sales goal. i might plug in 100,000. and then each time the graph is viewed, sales managers will be able to see how much each sales person has contributed to the goal.<BR><BR>any ideas?

2. Senior Member
Join Date
Dec 1969
Posts
96,118

## Oh, wow....

Do you know how many *YEARS* ago I wrote that crap????<BR><BR>Okay, I&#039;ll go take a peek. It should be trivial. But who knows what I wrote that long ago. &#060;grin style="sickly" /&#062;<BR><BR>

3. Senior Member
Join Date
Dec 1969
Posts
96,118

## Hey! I actually COMMENTED that stuff!

So it wasn&#039;t hard.<BR><BR>Looks to me like you can replace *ALL* of this entire section:<BR><BR> Dim colMaxes( ), allMax<BR> ReDim colMaxes( dataFldCnt )<BR> allMax = 0<BR> &#039; Simply loop through each data column...<BR> For df = 0 To dataFldCnt<BR> Dim dmax<BR> dmax = 0<BR> &#039; get column number from array of column numbers<BR> col = dataFlds(df)<BR> &#039; and then loop through each row for that column...<BR> For row = 0 To rowCnt<BR> &#039; recording the maximal value<BR> dcr = data( col, row )<BR> If dcr &#060; 0 Then<BR> Response.Write "&#060;P&#062;Sorry! We can&#039;t graph negative numbers yet.&#060;p&#062;"<BR> Response.End<BR> End If<BR> If dcr &#062; dmax Then dmax = dcr<BR> Next<BR> &#039; and record this max for this column<BR> colMaxes( df ) = dmax<BR> &#039; and alter overall max if needed<BR> If dmax &#062; allMax Then allMax = dmax<BR> Next<BR> &#039;<BR> &#039; For auto-scale, we have to get smarter<BR> &#039;<BR> If scaleFlag = SCALE_AUTO Then<BR> &#039; arbitrarily, we decide that if any single column max<BR> &#039; is less than 20% of the overall max, then we will use<BR> &#039; individual scales for each field:<BR> scaleFlag = SCALE_SAME &#039; assume this works<BR> For df = 0 To dataFldCnt<BR> If colMaxes(df) &#060; ( allMax / 5 ) Then scaleFlag = SCALE_EACH<BR> Next<BR> End If<BR><BR>With just this:<BR><BR> &#039; fixed maximum value for scale<BR> allMax = 100000<BR> &#039; and make all scales the same<BR> scaleFlag = SCALE_SAME<BR><BR>I&#039;m sure the code could be simplified much further if you only needed a fixed scale, but doing that is the minimal set of changes that *should* work. Untested.<BR><BR>

4. Senior Member
Join Date
Dec 1969
Posts
1,407

## great....thanks <nm>

nm

5. Senior Member
Join Date
Dec 1969
Posts
1,407

## RE: great....thanks <nm>

two tables.....<BR><BR>Sales<BR>********************** ***<BR>SalesID<BR>SalesmanID<BR>SalesAmount<BR><BR >Salesman<BR>*************************<BR>Salesman ID<BR>SalesmanName<BR><BR>how do i need to build the query so that it works with your sample? i want to list the salesman&#039;s name and then show bar graphs that show the total of SalesAmount.<BR><BR>thanks.

6. Senior Member
Join Date
Dec 1969
Posts
1,407

just worried that the previous post wouldn&#039;t be noticed since it has &#060;nm&#062; in the title........

7. Senior Member
Join Date
Dec 1969
Posts
96,118

## Total per salesman, right?

SELECT SalesmanName, Salesman.SalesmanID, SUM(SalesAmount) AS SalesmanTotal<BR>FROM Salesman LEFT JOIN Sales<BR>ON Salesman.SalesmanID = Sales.SalesmanID<BR>GROUP BY SalesmanName, Salesman.SalesmanID<BR>ORDER BY SalesmanName<BR><BR>That will get you zero totals, which you wouldn&#039;t get if you used an INNER JOIN.<BR><BR>

8. Senior Member
Join Date
Dec 1969
Posts
1,407

## RE: Total per salesman, right?

getting an error on this line:<BR><BR>Set objRS = objConn.Execute(strSQL)<BR><BR>Error Type:<BR>Microsoft JET Database Engine (0x80040E10)<BR>No value given for one or more required parameters.<BR>/CallTracker/scoreboard.asp, line 200

9. Senior Member
Join Date
Dec 1969
Posts
96,118

## And your debug ouput is???

What does the Response.Write of strSQL show? And what&#039;s the code look like?<BR><BR>

10. Senior Member
Join Date
Dec 1969
Posts
1,407

## Fixed That Error.......On To The Next One

Error Type:<BR>Microsoft VBScript runtime (0x800A000D)<BR>Type mismatch: &#039;colMaxes&#039;<BR>/CallTracker/scoreboard.asp, line 98<BR><BR><BR>line 98:<BR><BR>If scaleFlag = SCALE_SAME Then<BR> For df = 0 To dataFldCnt : colMaxes(df) = allMax : Next &#060;--------------------------98<BR> End If

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•