Jump to content
Software FX Community

Annotation Arrows, Pt. 2 - Bug with Height?


User (Legacy)
 Share

Recommended Posts

Symptom:

AnnArrow::Height seems to shift the position of the arrow, not just the

size.

Code sample is at bottom. Please reply to group and cc: erwilleke@sep.com

Thank you for any assistance.

Investigation Details:

I'm implementing a method to draw an arbitrary line on the chart using an

AnnArrow. When I pass values indicating a horizontal line, the method works

correctly.

ex: drawLine( 0.0, 0.0, 8.0, 0.0 );

When I pass values for a non-horizontal line, the line displays at an

incorrect location.

ex: drawLine( 1.0, 0.0, 1.0, 7.0 );

I played around with the settings and discovered that whenever I passed a

non-zero value to thisLine->Height, the entire line was being offset rather

than just changing the position. When I played around with the code and did

the following:

thisLine->Height = 0;

thisLine->Width = 100;

the chart displayed as expected with a horizontal line at the start

location. However, when I wrote:

thisLine->Height = 100;

thisLine->Width = 100;

I expected a diagonal line dropping from the place I pointed with (Left,

Top), but the line did not display. Switching to

thisLine->Height = -100;

thisLine->Width = 100;

I found the diagonal line shifted to the top of my chart, displaying with

the proper height and width, but moved to the wrong location.

Advise please. Joel had my heart up with his question of a few days ago,

but not quite what I need. ;)

void MyObj::drawLine( float x1, float y1, float x2, float y2 )

{

IAnnArrowPtr thisLine = m_pAnnList->Add((short) OBJECT_TYPE_ARROW );

long px1, py1, px2, py2; // pixel points

thisLine->HeadStyle = ARROW_NONE;

thisLine->TailStyle = ARROW_NONE;

// locate the screen coordinates

m_pFX->ValueToPixel( x1, y1, &px1, &py1, AXIS_Y );

m_pFX->ValueToPixel( x2, y2, &px2, &py2, AXIS_Y );

// move it to the proper place

thisLine->Height = py2 - py1;

thisLine->Width = px2 - px1;

thisLine->Left = px1;

thisLine->Top = py1;

// make it red

thisLine->Color = RGB( 0xFF, 0, 0 );

thisLine->Refresh( VARIANT_FALSE );

}

Link to comment
Share on other sites

I'm having problems reproducing your situation,

I've created an arrow and set Width and Height to 100 and I get a diagonal

line (as expected).

I think maybe you are working with attached objects (default) and then

changing the chart scale from the time you set the Width and Height to the

time you see the object.

If you want your objects to be in absolute pixel position regardless of

chart scale, you must set the objects to ATTACH_NONE using the Attach

method.

--

FP

Software FX, Inc.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...