Jump to content
Software FX Community

Date as X value - what am I missing?


User (Legacy)

Recommended Posts

I'm missing a step to use date as a X value.  I have set both LabelFormat

and DataFormat to type Date. I created a date object (for testing) but can

not figure out how to get the value into the X Value. Every time it

complains that value needs type double. Below is releveant code....help...

DateTime dt = new DateTime(03,12,12);

dt.ToShortDateString();

chart.AxisX.LabelsFormat.Format = AxisFormat.Date;

chart.AxisX.DataFormat.Format = AxisFormat.Date;

//chart.AxisX.LabelsFormat.CustomFormat = "MMM-dd-yy";

chart.Value[0,0] = 4.605;

chart.XValue = dt.ToString();

chart.Value[0,1] = 5.004;

chart.XValue[0,1]= dt.ToString();

Link to comment
Share on other sites

Hello,

You will only want to convert your date to a string if you are passing the

date as a label and not as an x-value as this sample shows.

http://support.softwarefx.com/Samples/CfxNET6//Samples/AxisHandling/XAxis/LabelsFont.aspx

If you are wanting to use it as an x-value then pass your date needs to

remain a double. Please see this sample on how to directly pass a date from

a dataset to ChartFX.Net.

http://support.softwarefx.com/Samples/CfxNET6//Samples/AxisHandling/XAxis/DateValues.aspx

JT

Tech. Support

When you want to pass an x-value that is a date then you need to pass a

double that represents that date.

"Matt McBride" <matthew.mcbride@tfn.com> wrote in message

news:EgwYr5pWDHA.228@WEBSERVER1...

> I'm missing a step to use date as a X value. I have set both LabelFormat

> and DataFormat to type Date. I created a date object (for testing) but

can

> not figure out how to get the value into the X Value. Every time it

> complains that value needs type double. Below is releveant

code....help...

>

> DateTime dt = new DateTime(03,12,12);

>

> dt.ToShortDateString();

>

> chart.AxisX.LabelsFormat.Format = AxisFormat.Date;

>

> chart.AxisX.DataFormat.Format = AxisFormat.Date;

>

> //chart.AxisX.LabelsFormat.CustomFormat = "MMM-dd-yy";

>

> chart.Value[0,0] = 4.605;

>

> chart.XValue = dt.ToString();

>

> chart.Value[0,1] = 5.004;

>

> chart.XValue[0,1]= dt.ToString();

>

>

>

>

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...