Jump to content
Software FX Community

getting constant lines to work properly


User (Legacy)
 Share

Recommended Posts

greetings..

using ChartFX 98 in Borland C++ Builder, constant lines are only drawn

on Y axis, no matter how I fiddle with this code. (changing AXIS_X to

AXIS_Y, etc)

any thoughts?

if possible, please email back at michael.archambault@thermobio.com, as

I've had some troubles using the newsgroup display/search

thanks,

michael

ChartFX1->OpenDataEx(COD_CONSTANTS,3 ,COD_UNCHANGE);

CLEPtr = (ICfxConstEnumPtr)ChartFX1->ConstantLine;

CLPtr = (ICfxConstPtr)CLEPtr->get_Item(0);

CLPtr->set_Value((int)2);

CLPtr->set_LineColor((unsigned long)RGB(0,255,0));

CLPtr->set_Axis(AXIS_X);

CLPtr->set_Label(StringToOleStr("my label"));

CLPtr->set_LineWidth((short)3);

CLPtr = (ICfxConstPtr)CLEPtr->get_Item(1);

CLPtr->set_Value((int)2);

CLPtr->set_LineColor((unsigned long)RGB(0,0,255));

CLPtr->set_Axis(AXIS_Y);

CLPtr->set_Label(StringToOleStr("my label2"));

CLPtr->set_LineWidth((short)3);

ChartFX1->CloseData(COD_CONSTANTS);

Link to comment
Share on other sites

Yes.

this is the code from the example:

ChartFX1.OpenDataEX COD_CONSTANTS,2,0

ChartFX1.ConstantLine(0).Value = 30

ChartFX1.ConstantLine(0).LineColor = RGB(255,0,0)

ChartFX1.ConstantLine(0).Axis = AXIS_Y

ChartFX1.ConstantLine(0).Label = "Alarm Limit 1"

ChartFX1.ConstantLine(0).LineWidth = 2

ChartFX1.CloseData COD_CONSTANTS

this is my code, using Borland C++ Builder:]

ChartFX1->OpenDataEx(COD_CONSTANTS,3 ,COD_UNCHANGE);

CLEPtr = (ICfxConstEnumPtr)ChartFX1->ConstantLine;

CLPtr = (ICfxConstPtr)CLEPtr->get_Item(0);

CLPtr->set_Value((int)2);

CLPtr->set_LineColor((unsigned long)RGB(0,255,0));

CLPtr->set_Axis(AXIS_X);

CLPtr->set_Label(StringToOleStr("my label"));

CLPtr->set_LineWidth((short)3);

CLPtr = (ICfxConstPtr)CLEPtr->get_Item(1);

CLPtr->set_Value((int)2);

CLPtr->set_LineColor((unsigned long)RGB(0,0,255));

CLPtr->set_Axis(AXIS_Y);

CLPtr->set_Label(StringToOleStr("my label2"));

CLPtr->set_LineWidth((short)3);

ChartFX1->CloseData(COD_CONSTANTS);

NOTE: only the AXIS_Y constant line appears.

I do not see any real differences between the two, other than syntax.

please help!

SoftwareFX Support wrote:

> Did you try the "Constant Lines and Stripes sample ? It creates a vertical

> and a horizontal constant line.

>

> --

> FP

> Software FX, Inc.

Attachments.zip

Link to comment
Share on other sites

Try changing the order, make the first one to go with Y and the second with

X ? any difference ?

I suspect that the second assignment:

CLPtr = (ICfxConstPtr)CLEPtr->get_Item(1);

May not be working properly and therefore the second set of statements is

overriding the first.

The strange thing is that I have a Borland C++ builder sample (the one

downloaded from our support site) that works perfectly.

--

FP

Software FX, Inc.

Link to comment
Share on other sites

I've tried using up to 5 constant lines, they will always work on the Y axis,

and

NEVER work on the X axis. I've tried using the label values as the Value prop.

for the constant line,

I've used index values (ie 1,2...), I've swapped the order around, (ie using

Item[0], then Item[1]... then

I tried the reverse. At no point does a constant line show up on the xaxis.

If I change the code to put a constant line on the Y instead of the X, they all

work.

what example are you refering to?

I got this far by translating the VB example that came in the help files.

as far as "CLPtr = (ICfxConstPtr)CLEPtr->get_Item(1);" statement overiding the

call to get_Item(0),

I've put them in opposite order, I've used only 1 constant line, I've tried all

the "normal" translations one would go through to test a problem like this out.

The only thing I could think of, was that the parameter to get_Item was wrong,

so I tried using the label values, as well as an index that was representative

of the number of points on the graph. Nothing worked.

any thoughts?

SoftwareFX Support wrote:

> Try changing the order, make the first one to go with Y and the second with

> X ? any difference ?

>

> I suspect that the second assignment:

>

> CLPtr = (ICfxConstPtr)CLEPtr->get_Item(1);

>

> May not be working properly and therefore the second set of statements is

> overriding the first.

>

> The strange thing is that I have a Borland C++ builder sample (the one

> downloaded from our support site) that works perfectly.

> --

> FP

> Software FX, Inc.

Link to comment
Share on other sites

thanks.

I figured out the problem, it had to do with the scale of the x axis. By

setting the min and max to the # of points,

I can now just use the point # as an index, and all works ok..

however, how do I get rid of the constant lines? I tried by setting the # of

constant lines to 0, with a call to OpenDataEx/CloseData pair, but that doesn't

seem to work.

any ideas?

SoftwareFX Support wrote:

> Go to our support site and under Samples (on the left), select "Borland C++

> Builder Samples"

>

> --

> 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...