
bill w......a question about one of your samples
bill......i'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'm not sure how to go about it.<BR><BR>currently, the bars' 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's units being represented by a bar that is A's units/total units, i would like it to be A'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?

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

Hey! I actually COMMENTED that stuff!
So it wasn'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> ' Simply loop through each data column...<BR> For df = 0 To dataFldCnt<BR> Dim dmax<BR> dmax = 0<BR> ' get column number from array of column numbers<BR> col = dataFlds(df)<BR> ' and then loop through each row for that column...<BR> For row = 0 To rowCnt<BR> ' recording the maximal value<BR> dcr = data( col, row )<BR> If dcr < 0 Then<BR> Response.Write "<P>Sorry! We can't graph negative numbers yet.<p>"<BR> Response.End<BR> End If<BR> If dcr > dmax Then dmax = dcr<BR> Next<BR> ' and record this max for this column<BR> colMaxes( df ) = dmax<BR> ' and alter overall max if needed<BR> If dmax > allMax Then allMax = dmax<BR> Next<BR> '<BR> ' For autoscale, we have to get smarter<BR> '<BR> If scaleFlag = SCALE_AUTO Then<BR> ' arbitrarily, we decide that if any single column max<BR> ' is less than 20% of the overall max, then we will use<BR> ' individual scales for each field:<BR> scaleFlag = SCALE_SAME ' assume this works<BR> For df = 0 To dataFldCnt<BR> If colMaxes(df) < ( allMax / 5 ) Then scaleFlag = SCALE_EACH<BR> Next<BR> End If<BR><BR>With just this:<BR><BR> ' fixed maximum value for scale<BR> allMax = 100000<BR> ' and make all scales the same<BR> scaleFlag = SCALE_SAME<BR><BR>I'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>

great....thanks <nm>

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's name and then show bar graphs that show the total of SalesAmount.<BR><BR>thanks.

bill w......a question about one of your samples
just worried that the previous post wouldn't be noticed since it has <nm> in the title........

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't get if you used an INNER JOIN.<BR><BR>

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

And your debug ouput is???
What does the Response.Write of strSQL show? And what's the code look like?<BR><BR>

Fixed That Error.......On To The Next One
Error Type:<BR>Microsoft VBScript runtime (0x800A000D)<BR>Type mismatch: 'colMaxes'<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 <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

Forum Rules

