[AccessD] A2003: Plot a Vertical Line on a fuel gauge

Rocky Smolin - Beach Access Software bchacc at san.rr.com
Sun Oct 23 11:02:15 CDT 2005


Darren:

I had to make a rather complicated bar graph for an app years ago and what I 
decided to do, instead of drawing the lines was to start with the maximum 
length line and adjust the length in the Detail_Format event.  You could do 
the same by making all the lines in the report, set them to Visible No, and 
visiblizing the ones you want. That's the easy way.

You can also draw stuff like this using .Line:

    ' Draw up-pointing triangle for txt box
    rptBigOne.DrawWidth = 10
    rptBigOne.Line (txtParticipantAverage.Left - 30, 
txtParticipantAverage.Top + 40)- _
        (txtParticipantAverage.Left, txtParticipantAverage.Top + 100), 
QBColor(0)
    rptBigOne.Line (txtParticipantAverage.Left, txtParticipantAverage.Top + 
100)- _
        (txtParticipantAverage.Left + 30, txtParticipantAverage.Top + 40), 
QBColor(0)
    rptBigOne.Line (txtParticipantAverage.Left - 30, 
txtParticipantAverage.Top + 40)- _
        (txtParticipantAverage.Left + 30, txtParticipantAverage.Top + 40), 
QBColor(0)
    rptBigOne.DrawWidth = 1

    ' Draw down-pointing triangle for txt box
    rptBigOne.DrawWidth = 10
    rptBigOne.Line (txtOrganizationAverage.Left, txtOrganizationAverage.Top 
+ 120)- _
        (txtOrganizationAverage.Left + 30, txtOrganizationAverage.Top + 60), 
QBColor(0)
    rptBigOne.Line (txtOrganizationAverage.Left + 60, 
txtOrganizationAverage.Top + 120)- _
        (txtOrganizationAverage.Left + 30, txtOrganizationAverage.Top + 60), 
QBColor(0)
    rptBigOne.Line (txtOrganizationAverage.Left, txtOrganizationAverage.Top 
+ 120)- _
        (txtOrganizationAverage.Left + 60, txtOrganizationAverage.Top + 
120), QBColor(0)
    rptBigOne.DrawWidth = 1
End If

where rptBigOne is set to the name of the report.

You can use CurrentX and CurrentY properties of the report which is a lot of 
fun and print something at the current location:

    rptBigOne.CurrentY = Text109.Top + (intJ - 1) * 142
    rptBigOne.CurrentX = intLeft - 75 + intK * 1.5 / intPointMax * 1440
If Nz(gintGraph2(ItemNumber, intJ, intK)) <> 0 Then
    rptBigOne.Print Str(gintGraph2(ItemNumber, intJ, intK))
Else
    rptBigOne.CurrentX = rptBigOne.CurrentX + 60
    rptBigOne.CurrentY = rptBigOne.CurrentY - 60
    rptBigOne.Print "."
'     MsgBox "X=" & rptBigOne.CurrentX & " " & "Y=" & rptBigOne.CurrentY & " 
" & "gintgraph2=" & gintgraph2(ItemNumber, intJ, intK)
End If

But I think making the lines you want to show visible in the Format event is 
probably the easiest way I know of.

HTH

Rocky

----- Original Message ----- 
From: "Darren DICK" <d.dick at tripledee.com.au>
To: "'Access Developers discussion and problem solving'" 
<accessd at databaseadvisors.com>
Sent: Sunday, October 23, 2005 6:39 AM
Subject: [AccessD] A2003: Plot a Vertical Line on a fuel gauge


> Hi Team
> I am trying to get the syntax right to plot a vertical line on a 
> horizontal
> "fuel gauge"
> Fuel gauge looks something like |___|___|___|___|
>
> Fuel gauge is made up of 5 vertical lines representing (from L to R)
> Empty(Minimum), 1/4, 1/2, 3/4, and Full (Maximum)
> With a long line underneath the 5 vertical lines representing the plane
>
> User enters 3 values into controls on a form
> 1 = MIN
> 2 = MAX
> 3 = Desired (Is always going to fall somewhere between min and max - 
> handled
> by data entry rules)
>
> The 1st and 2nd values entered indicate what the max and min are to be IE
> Empty and Full
> EG Min = 100,000
> Eg Max = 300,000
> EG "Desired" = 200,000
>
> So I should see (Using the above example) the vertical line indicating
> "Desired" sit above the Half Full vertical line
> But so far I am doing something wrong - 'cause when I enter 1 as a min 3 
> as
> a max and 2 as desired the vertical line plots perfectly
>
> But when I use 100 as min 300 as max and 200 as "desired" I get a slight
> shift of the "Desired" vertical line to the right
> And it increases (I think exponetially) as I increase the Min and Max by
> increments of say...thousands
>
> So...Any tips on the logic I should use?
>
> Anyone wanna see the demo - lemme know
>
> Many thanks in advance
>
> Darren
>
>
> -- 
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
> 




More information about the AccessD mailing list