Jump to content
Software FX Community

XAxis Date Formats


Recommended Posts

I'm using SQL to drive a chart with a date for the x axis using intelligent labelling but I need to have some control over the format using CustomFormat. If I set this eg to dd-MMM;MMM and produce rows with dates of 1st of each month the labels are incorrect when the chart is resized. At small widths the labels are correct but at larger widths the first label is duplicated and the last is missing. This can be improved by passing dates of eg 15th of each month but the labels are often incorrect.  How can this be solved?

Link to post
Share on other sites

At larger sizes is the step over one month? If so, you need to provide a format for that, your CustomFormat only gives a guidance for days and months. You need to complete it with the quarter and year. For example:

 chart.AxisX.LabelsFormat.CustomFormat = "MM/dd/yyy;MMM;`yy;Q{q};yyyy"

Check the following KB article for more details:

Q7001073. Setting custom formats for Date axes

URL: http://support.softwarefx.com/ShowArticleSep.aspx?Type=KB&Product=CfxNet70&Source=http://support.softwarefx.com/kb/700/1/073.htm?_r=1

Link to post
Share on other sites

It depends what you mean by step size. Each point is marked  as eg the first day on consecutive months. For example 1 Jul 2006, 1 Aug 2006 etc. The problem occurs even with 3 consecutive months. I added the other formats as suggested but it made no difference. I thought the custom format had defaults - in any case it surely shouldn't duplicate or skip labels. Perhaps you are counting the days between points rather than the month from the calendar?

Link to post
Share on other sites

No that's not what we do.

Please attach a binary file for this chart so that we can test it and determine what the problem is. A binary file of the chart can be obtained by calling the Export method.

Alternatively you can attach a sample program that is self contained (no external data) and attach it to your post.

Link to post
Share on other sites
  • 2 weeks later...

I got it this time.

The problem is the following:

You are setting the custom format to:

MMM;MMM;Q;yy

That's telling Chart FX to use MMM (first part) as the "by-day" labeling format. When the space becomes big, Chart FX chooses a step lower than one month but because your labels are formatted like MMM then you get repetitions.

If you want your X-Axis step to be fixed to one month, then set AxisX.Step = 30 this way Chart FX will not try to go any lower.

Link to post
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.

Loading...
×
×
  • Create New...