Jump to content
Software FX Community

Help: Annotation Objects in Gantt chart


User (Legacy)

Recommended Posts

Hi!

Maybe I was in the wrong place yesterday when I posted this question in cfxie.server.

Anyway, my problem is to programatically insert an annotation object in a Gantt chart.

No matter how I try I can't get the correct x and y coordinates.

My ChartFx is Chart FX Internet 5.5.5.0 .

I've tried 4 different alternatives to get the coodinates but none of them work.

Can anyone please tell me what I'm doing wrong.

I've attached the ASP-code below.

The attached picture shows the chart. My objective is to print an explanatory text inside or near each bar.

Of course I only use one alternative at a time, but which one, and how do I get it to work?

oChart.IniValueEx(0, i) below displays a start date in the chart, but without CDate() it contains a Long.

Grateful for any help!

Thanks in advance,

/ Peter

...

'Create Annotation List

Set AnnotX = Server.CreateObject("AnnotationX.AnnList")

'Add Annotation List to ChartFX

Call oChart.AddExtension(AnnotX)

'Loop over all bars in the Gantt chart.

For i = 0 To (oChart.NValues - 1)

'Create a Text object

Set ObjText = AnnotX.Add(6) '6 is a Text object

'Get the position for the annotation object

'Alternative 1 (ValueToPixel):

Call oChart.ValueToPixel(CDbl(i), CDbl(oChart.IniValueEx(0, i)), CLng(x), CLng(y), 1)

'Alternative 2 (PaintInfo: 4 = CPI_VALUETOPIXEL):

nMarkerPosition = oChart.PaintInfo(4, CDbl(oChart.IniValueEx(0, i)))

x = CHART_LOWORD(nMarkerPosition)

y = CHART_HIWORD(nMarkerPosition)

'Alternative 3 (HitTest):

Call oChart.HitTest(x, y, 0, CLng(oChart.IniValueEx(0, i)))

'Alternative 4 (Attach method):

Call ObjText.Attach(1, "0, " & oChart.IniValueEx(0, i))

'Set position for annotation object (only applicable for alternatives 1, 2 and 3).

ObjText.Top = x

ObjText.Left = y

'Enter text

ObjText.Text = arrProgramName(i)

'Set annotation object properties

ObjText.Width = 200

ObjText.Height = 30

ObjText.BkColor = CHART_TRANSPARENT

ObjText.Color = RGB(0,255,0)

ObjText.AllowMove = False

ObjText.AllowModify = False

ObjText.Refresh False

Set ObjText = Nothing

Next

Attachments.zip

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...