Re: Positioning datalabels
- From: "Phil Stanton" <phil@xxxxxxxxxxxxxxxxxx>
- Date: Fri, 4 Jul 2008 17:00:50 +0100
Thanks for replying
Now even more confused
As far as I know, points atre 1/72 of an inch and pixels are all to do with
screen resolution
This routine, nicked from Stephen Lebans, returns 96 for my screen
resolution (Pixels per inch??????)
Phil
Option Explicit
Private Declare Function apiCreateIC Lib "gdi32" Alias "CreateICA" _
(ByVal lpDriverName As String, ByVal lpDeviceName As String, _
ByVal lpOutput As String, lpInitData As Any) As Long
Private Declare Function apiGetDeviceCaps Lib "gdi32" _
Alias "GetDeviceCaps" (ByVal hDC As Long, ByVal nIndex As Long) As Long
Private Declare Function apiDeleteDC Lib "gdi32" _
Alias "DeleteDC" (ByVal hDC As Long) As Long
Private Const LOGPIXELSX = 88
Global Const TwipsPerMM = 56.7
Global Const PointsPerMM = 2.83
Dim lngXdpi As Long
Function GetScreenResolution() As Long
Dim lngIC As Long
'Get Screen resolution
lngIC = apiCreateIC("DISPLAY", vbNullString, vbNullString, vbNullString)
'If the call to CreateIC didn't fail, then get the Screen X resolution.
If lngIC <> 0 Then
lngXdpi = apiGetDeviceCaps(lngIC, LOGPIXELSX)
GetScreenResolution = lngXdpi
'Release the information context.
apiDeleteDC (lngIC)
Else
' Something has gone wrong. Assume an average value.
lngXdpi = 120
GetScreenResolution = lngXdpi
End If
End Function
"Joel" <Joel@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:077CB7A1-45AD-4F1A-A862-3CB93BA33A09@xxxxxxxxxxxxxxxx
Points and pixels are the same. Sorry for the confusion.
"Phil Stanton" wrote:
Sound what I need, thanks
How do I get the pixle values as I thought chart dimensions were in
points
Phil
"Joel" <Joel@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:7BB34AEB-E320-4997-915F-4A24BC28A77C@xxxxxxxxxxxxxxxx
This problem is similar to a macro I run at work all the time. I
needed
to
drop a line on a chart at a particular X value. I used simple ratios
as
expalined below
Suppose your x axis goes from 10 to 100 and you need to find the value
of
50
then
X_Ratio = (50 - 10)/(100 - 10)
Then if the pixel values of the chart goes from 1000 to 2000. You can
get
thiese numbers from the .left parameter and the .width parameter of the
chart.
X_Pixel = (X_Ratio * (2000 - 1000)) + 1000
"Phil Stanton" wrote:
I have a scatter chart and I want to be able to position the labels
differently for each point ( depending on the space available on the
chart)
I know the X & Y co-ordinates of the points in the series.
The chart is 622 point wide and the interior width of the plot area is
422
point wide. I know the height and width of the label
If for example I want to place a particular label exactly over a
point,
what
is the calculation using the X co-ordinate, widths to give me the
DataLabel.Left value
Thanks for any help
Phil
.
- References:
- Positioning datalabels
- From: Phil Stanton
- RE: Positioning datalabels
- From: Joel
- Re: Positioning datalabels
- From: Phil Stanton
- Re: Positioning datalabels
- From: Joel
- Positioning datalabels
- Prev by Date: Re: Positioning datalabels
- Next by Date: Re: BIFF / Office 2007 Question
- Previous by thread: Re: Positioning datalabels
- Next by thread: Re: Positioning datalabels
- Index(es):
Relevant Pages
|