Jump to content
Software FX Community

Calculating Stripe .From and .To values


User (Legacy)

Recommended Posts

What is the best way to calculate the correct X-path ordinal for a Stripe.

My XAxis values are dates and can be dynamic:

For example, in one chart, XAxis values are from November 2004 to October

2005.

I need to place a Stripe on the chart

The From is at 03 May 2005

The To is at 30 July 2005

Given that the From and To properties accept a double value, what is the

best way to calculate these dates to the correct value (as a double) that

will map to the correct position on the XAxis?

Many Thanks

Link to comment
Share on other sites

You should use the DateTime's ToOADate method.

--

JC

Software FX Support

"Codex Twin" <codex@more.com> wrote in message

news:SThFm%23s6FHA.1668@webserver3.softwarefx.com...

> What is the best way to calculate the correct X-path ordinal for a Stripe.

>

> My XAxis values are dates and can be dynamic:

>

> For example, in one chart, XAxis values are from November 2004 to October

> 2005.

>

> I need to place a Stripe on the chart

> The From is at 03 May 2005

> The To is at 30 July 2005

>

> Given that the From and To properties accept a double value, what is the

> best way to calculate these dates to the correct value (as a double) that

> will map to the correct position on the XAxis?

>

>

> Many Thanks

>

>

Link to comment
Share on other sites

OK, ToOADate() gives me a floating point value from the number of days from

30 Deecember 1899.

But that does not bring me any closer to mapping that value to the X-Axis of

a chart which represents dates.

Another example:

My XAxis is from Feb 2005 to Oct 2005.

There are 9 points on the XAxis.

How do I convert an arbitrary date, say 15 March 2005, and pass it as a

double value to the From property of a stripe?

(Note that it will be somewhere between point 4 to point 7 on the XAxis.)

Thanks

"Software FX Support" <none@noreply.com> wrote in message

news:DXBsOfw6FHA.2548@webserver3.softwarefx.com...

> You should use the DateTime's ToOADate method.

>

> --

> JC

> Software FX Support

> "Codex Twin" <codex@more.com> wrote in message

> news:SThFm%23s6FHA.1668@webserver3.softwarefx.com...

> > What is the best way to calculate the correct X-path ordinal for a

Stripe.

> >

> > My XAxis values are dates and can be dynamic:

> >

> > For example, in one chart, XAxis values are from November 2004 to

October

> > 2005.

> >

> > I need to place a Stripe on the chart

> > The From is at 03 May 2005

> > The To is at 30 July 2005

> >

> > Given that the From and To properties accept a double value, what is the

> > best way to calculate these dates to the correct value (as a double)

that

> > will map to the correct position on the XAxis?

> >

> >

> > Many Thanks

> >

> >

>

>

Link to comment
Share on other sites

Sorry, but the line of code:

stripe.From= DateTime.TOADate(new DateTime(2005,1,1));

is not syntactically correct.

"SoftwareFX Support" <noreply@softwarefx.com> wrote in message

news:EuWMdir7FHA.468@webserver3.softwarefx.com...

> If you are passing X-Values to their chart, the X-Axis is a true Date

Axis,

> so you can assign:

>

> stripe.From= DateTime.TOADate(new DateTime(2005,1,1));

>

> --

> Francisco Padron

> www.chartfx.com

>

>

Link to comment
Share on other sites

What if the date is not a true date, but are just points created on the

XAxis from the data intervals?

Is there some kind of method I can use to calculate a point on the axis by

extrapolating the date to the XAxis?

"SoftwareFX Support" <noreply@softwarefx.com> wrote in message

news:43IGYGs7FHA.1668@webserver3.softwarefx.com...

> My mistake:

>

> chart1.Stripes[0].From= new DateTime(2005,1,1).ToOADate();

>

>

>

> --

> Francisco Padron

> www.chartfx.com

>

>

Link to comment
Share on other sites

If the X-Axis is labels, then they loose their meaning, Chart FX will not 

see them as dates but rather as mere strings, they have no intrinsic value,

in other words, "1/1/2005" can be before or after "1/2/2005", and is no

different than "label".

In this case you will need to search through your data to match the date you

want with the point index, then use the point index for the From and To

values of the stripe.

--

Francisco Padron

www.chartfx.com

Link to comment
Share on other sites

OK. Many thanks for your help. :)

"SoftwareFX Support" <noreply@softwarefx.com> wrote in message

news:6ZT9Fst7FHA.468@webserver3.softwarefx.com...

> If the X-Axis is labels, then they loose their meaning, Chart FX will not

> see them as dates but rather as mere strings, they have no intrinsic

value,

> in other words, "1/1/2005" can be before or after "1/2/2005", and is no

> different than "label".

>

> In this case you will need to search through your data to match the date

you

> want with the point index, then use the point index for the From and To

> values of the stripe.

>

> --

> Francisco Padron

> www.chartfx.com

>

>

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...