Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Chart legend

Status
Not open for further replies.

tinoco

IS-IT--Management
Feb 16, 2005
49
ES
Hi!
i'm making charts that shows the amount of money per group of ages; For example 10-20years --500euros etc..
I can get the data and make the chart, but how can i define that my legend is 10-20. Is it possible to have in the legend the column name instead the field data?
thanks
 
you can put into your query a calculated field:

Range: iif(Age between 10 and 20, "10-20",iif(Age between 21 and 30,"21-30", iif(Age between 31 and 50,"31-50","Over 50")))

etc.

or you can make a table with

MinAge MaxAge GraphLabel
10 20 10-20
21 30 21-30
31 50 31-50

then bring that table into your chart's query, and change your query so that the GraphLabel is the thing you're making your x-axis out of. OR better yet--create a function, called say

Function GetAgeLabel(Age)
.
.
.Use a Select statement, or use the table above to calculate your graph label...
.
.

GetAgeLabel = "whatever"
End Function

then in your query, just call it by adding a calculated field:

=GetAgeLabel(Age)

Using the table is better in that you can easily change the ranges and even use the same logic in other parts of your db. Same with the function.

So hope those ideas help you out!

g

Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top