Jump to content
Software FX Community

Annotating the Chart


User (Legacy)

Recommended Posts

Hi

I'm using the following chunk of code to try to annotate a point (not a data

point) :

With FX1

Set AnnotX = New AnnotationX

Set annT = AnnotX.Add(OBJECT_TYPE_TEXT)

.ValueToPixel pdblX, pdblY, lngX, lngY, AXIS_Y

annT.Text = pstrLabel

annT.Top = lngY 'the pixel position of the point of interest

annT.Left = lngX 'ditto

annT.Refresh False

End With

The chart is a line chart and pdblX is the canonical position of a point,

pdblY is the y value (within the Y axis range), but it is not the Y value of

a point (it's about 5% higher). Some of the code is from your reference

guide.

When I run this, I don't see any annotation. For example if pdblX is 3

(point 3) and pdblY is 5.2 and the Y axis range of the chart is 0 to 10, I

still don't see any annotation, even if I use annT.Refresh = true. Is it to

do with my misunderstanding of annT.top and Left and the ValueToPixel

method?

Thanks

Paul

Link to comment
Share on other sites

Client/Server 5.2

"Paul Fell" <paul@max-geoservices.com.au> wrote in message

news:if7nNw$gDHA.3296@WEBSERVER1...

> Hi

>

> I'm using the following chunk of code to try to annotate a point (not a

data

> point) :

>

> With FX1

>

> Set AnnotX = New AnnotationX

>

> Set annT = AnnotX.Add(OBJECT_TYPE_TEXT)

> .ValueToPixel pdblX, pdblY, lngX, lngY, AXIS_Y

> annT.Text = pstrLabel

> annT.Top = lngY 'the pixel position of the point of interest

> annT.Left = lngX 'ditto

> annT.Refresh False

>

> End With

>

> The chart is a line chart and pdblX is the canonical position of a point,

> pdblY is the y value (within the Y axis range), but it is not the Y value

of

> a point (it's about 5% higher). Some of the code is from your reference

> guide.

>

> When I run this, I don't see any annotation. For example if pdblX is 3

> (point 3) and pdblY is 5.2 and the Y axis range of the chart is 0 to 10, I

> still don't see any annotation, even if I use annT.Refresh = true. Is it

to

> do with my misunderstanding of annT.top and Left and the ValueToPixel

> method?

>

> Thanks

>

> Paul

>

>

Link to comment
Share on other sites

One important thing here is WHEN you are making this call:

.ValueToPixel pdblX, pdblY, lngX, lngY, AXIS_Y

This call will return you the pixel position at that moment in time. If the

chart scaling changes later, these values will change. Did you check the

values being returned here with the debugger ?

You may want to use the Attach method to be independent on the timing. The

Attach method allows you to attach an annotation object to a LOGICAL

position so that when the scale changes the position of the object is

re-calculated automatically.

--

FP

Software FX, Inc.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...