Jump to content
Software FX Community

how labels and datapoints match up


User (Legacy)

Recommended Posts

Hi guys

I need your advice please.

I have a chart which plots the price of crude oil over 5 years. Its a

straight forward linechart with about 1440 data point.

The series has a date and a value and I have set the datatypes

Chart1.DataType(0) = SoftwareFX.ChartFX.DataType.XValue

Chart1.DataType(1) = SoftwareFX.ChartFX.DataType.Value

and

Chart1.AxisX.LabelsFormat.Format = SoftwareFX.ChartFX.AxisFormat.Date

Chart1.DataSourceSettings.DataStyle = Chart1.DataSourceSettings.DataStyle Or

SoftwareFX.ChartFX.DataStyle.DatesAsLabels

Depending on an option I choose, I would like to have only lables for the

first day in each year, or add a lable for a specific date.

I am using stripes already, and I know about constant lines etc etc, but I

specificly need to use lables.

Also, I cannot use a step because it is inacurate since you have leap years,

holidays etc and the amount of items per year varies.(see top left counters)

BTW, step for AxisX is set to 1

In the attached image I have the chart with constant lines on the first day

of each year.

I have taken the same data and looped through the lables and added a lable

on the days I needed, but the two dont line up.

In the following example:

If I have a datapoint on the chart, let say the 255th one has a date of

02/01/2003 and a value of 31 and I set the following:

Chart1.AxisX.Label(255) = "somtthing"

Dim DateX as date = new date(2003,1,2)

Chart1.ConstantLines(0).Value = CDate(DateX ).ToOADate

.. the constantline works fine but the lable dont line up.

Can you please suggest a way to do this?

Thx

Link to comment
Share on other sites

Hi guys

I need your advice please.

I have a chart which plots the price of crude oil over 5 years. Its a

straight forward linechart with about 1440 data point.

The series has a date and a value and I have set the datatypes

Chart1.DataType(0) = SoftwareFX.ChartFX.DataType.XValue

Chart1.DataType(1) = SoftwareFX.ChartFX.DataType.Value

and

Chart1.AxisX.LabelsFormat.Format = SoftwareFX.ChartFX.AxisFormat.Date

Chart1.DataSourceSettings.DataStyle = Chart1.DataSourceSettings.DataStyle Or

SoftwareFX.ChartFX.DataStyle.DatesAsLabels

Depending on an option I choose, I would like to have only lables for the

first day in each year, or add a lable for a specific date.

I am using stripes already, and I know about constant lines etc etc, but I

specificly need to use lables.

Also, I cannot use a step because it is inacurate since you have leap years,

holidays etc and the amount of items per year varies.(see top left counters)

BTW, step for AxisX is set to 1

In the attached image I have the chart with constant lines on the first day

of each year.

I have taken the same data and looped through the lables and added a lable

on the days I needed, but the two dont line up.

In the following example:

If I have a datapoint on the chart, let say the 255th one has a date of

02/01/2003 and a value of 31 and I set the following:

Chart1.AxisX.Label(255) = "somtthing"

Dim DateX as date = new date(2003,1,2)

Chart1.ConstantLines(0).Value = CDate(DateX ).ToOADate

.. the constantline works fine but the lable dont line up.

Can you please suggest a way to do this?

Thx

Link to comment
Share on other sites

You don't want to use dates as labels, you want to use then as X-Values. 

Labels are just strings, by using dates as label you are loosing the

intrinsic value of those dates preventing Chart FX from understanding them

and chose smart steps and labels in the X-Axis.

You need to DELETE the line:

Chart1.DataSourceSettings.DataStyle = Chart1.DataSourceSettings.DataStyle Or

SoftwareFX.ChartFX.DataStyle.DatesAsLabels

And LEAVE the line:

Chart1.DataType(0) = SoftwareFX.ChartFX.DataType.XValue

Then the Chart will contain dates in the X-Axis. Setting a Step of 30 will

be interpreted as showing a label every MONTH, setting a step of 365 will be

interpreted as showing one label every year. Leaving the Step in Auto (0)

will chose Year, Quarter, Month, Weeks, Days depending on the available

space. This is the default.

--

Francisco Padron

www.chartfx.com

post-2107-1392238237714_thumb.jpg

post-2107-13922386074322_thumb.jpg

Link to comment
Share on other sites

You don't want to use dates as labels, you want to use then as X-Values. 

Labels are just strings, by using dates as label you are loosing the

intrinsic value of those dates preventing Chart FX from understanding them

and chose smart steps and labels in the X-Axis.

You need to DELETE the line:

Chart1.DataSourceSettings.DataStyle = Chart1.DataSourceSettings.DataStyle Or

SoftwareFX.ChartFX.DataStyle.DatesAsLabels

And LEAVE the line:

Chart1.DataType(0) = SoftwareFX.ChartFX.DataType.XValue

Then the Chart will contain dates in the X-Axis. Setting a Step of 30 will

be interpreted as showing a label every MONTH, setting a step of 365 will be

interpreted as showing one label every year. Leaving the Step in Auto (0)

will chose Year, Quarter, Month, Weeks, Days depending on the available

space. This is the default.

--

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