ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  xAxis Period labels inconsistent
Posted by icm63 on Dec-23-2022 01:36
Attachments:
I just load the data, and the xAxis period labels are not evenly spaced with the DEFAULT settings

Any ideas how to ensure constancy.

see image attached (black pointer lines)
SH_0001.png

  Re: xAxis Period labels inconsistent
Posted by Peter Kwan on Dec-24-2022 01:27
Hi icm63,

Without seeing your actual code and your data, I will try to guess some possible cause of the issue.

From the legend box at the top of the plot area, its style looks like the chart being a FinanceChart object. This type of chart accepts a single timeStamps array for the x-coordinates and it will automatically generate the x-axis labels. For your case, the FinanceChart may have chosen to generate a label at the start of the each year. However, if the labels are so long that they overlaps, ChartDirector will remove any label that overlaps with the previous label.

In your case, it seems to have sufficient width so that the labels does not overlap even if there is one label per year.

Some possibilities of the irregular labels I can think of are:

- The labels are actually much longer because their formatting includes some invisible characters, such as space characters.

- The chart may be smaller when setting the labels, at that time the labels do overlap. It is resized to a wider size later but by that time the overlapping labels have already been remove.

Because labels can have different sizes (as they contain different characters), and the spacing between labels can have +/- 1 pixel difference due to rounding, in marginal case, it is possible that adjacent labels sometimes overlap, and sometimes do not. This causes the irregular spacing.

Another possibility involves the definition of "start of each year". By default, it means it is the first label with a year different from the previous label, and also the label is within 60 days from the start of a year. If there is no timeStamp in the year 2003 that is within 60 days from the start of the year, then there will be no label for 2003. If for some reasons, the timeStamps are not sorted, it can also generate unexpected labels.


To trouble-shoot the problem, please try to create a FinanceChart with just the timeStamps, like:


Dim c As FinanceChart = New FinanceChart(640)
c.setData(timeStamps, Nothing, Nothing, Nothing, Nothing, Nothing, 0)
c.addMainChart(240)

Check if it still produces the same issue. If it produces the same issue, please try to save the timeStamps array to an ASCII text file, preferrably with the timestamps in the format yyyymmddhhnnss, and also inform me the actual code you use to reproduce the problem. I will try to reproduce the issue.

Regards
Peter Kwan