Jump to content
Software FX Community

remove AutoFirsLabel not works for date Axis


laros79
 Share

Recommended Posts

forums - I need your help ... 2 days i try to solve but no result ...I have chart with date format in AxisX, and i also have customstep that will assign to that axisX. and the step start not from first X label then i take out style auto first label. but why the first label still show up even i use custome step & also already take out the autoFristlabel style?

DateTime minAxisX = Convert.ToDateTime(chartDataTable.Rows[0][0]);DateTime maxAxisX = Convert.ToDateTime(chartDataTable.Rows[chartDataTable.Rows.Count - 1][0]);chartFX.AxisX.Min = minAxisX.ToOADate();chartFX.AxisX.Max = maxAxisX.AddDays(1).ToOADate();

 

int

stepDate = maxAxisX.Subtract(minAxisX).Days / 4;double step = (minAxisX.AddDays(stepDate).ToOADate() - activeChart.AxisX.Min);chartFX.AxisX.CustomSteps = new double[] { step - (stepOneDay / 2), step, step, step, step, step, step };chartFX.AxisX.Style &= ~ChartFX.WebForms.AxisStyles.AutoFirstLabel;

please take a look on the attachement

DataPathBugSample.zip

Link to comment
Share on other sites

I think you are misinterpreting the meaning of AxisStyles.AutoFirstLabel.

When AxisStyles.AutoFirstLabel is ON, it will adjust the first label so that it is a "round" number.

In the case of Dates, this means to adjust to the nearest "beginning of interval". For example, if there is one label per month, the first label will show at the last day of the first month of data.

In your case, labels are being displayed per week, so leaving AxisStyles.AutoFirstLabel ON (default) should display the first label on the first Sunday. Turning it OFF will display the fist label for the first point in the data.

For this specific data, what would you like to be displayed as the first label?

Link to comment
Share on other sites

thanks for the response. I was thinking to remove the label on first point at X Axis is using property AutoFirstLabel=OFF. but anyway what i want here is I just want to make the step on Axis X (Date) is based on what i set it up on CustemStep properties which start from after the first label.

let say for example: the axisX data start from 01 Jan 2008 to 30 Jan 2008. but the label that i want to show up is: start from 7 Jan and then 14 Jan, 21 Jan, 28 Jan. And there will be no first label show, in this case 01 Jan 08. then the code should be:

chartFX.AxisX.CustomSteps = new double[] { 7.5, 14.5, 21.5, 28.5};

with the above code, currently the axis X still show label 01 Jan 2008 that i 'm no expect for it to show up as first label. and what i expect is like the custom step that the first label should be 7 jan 08.

and one more question: why do the step always require 0.5 more to make it the axis point in the middle of bar?Thanks.

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