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

Message ListMessage List     Post MessagePost Message

  Some records at X axis
Posted by ?tila Castro Alves on May-07-2012 23:32
Attachments:
Well I'm using CD .net to show a graph of value (y axis) date (x axis). I have a lot of
records (dates) to be showed at x axis, but I don't have plenty room! So I would like to
know how I can show just a few records at X axis, to avoid one date override other date.
In picture you can see my issue better!
cd.JPG

  Re: Some records at X axis
Posted by Peter Kwan on May-08-2012 01:32
Hi Atila,

There are many methods. For example:

(a) If you have less than 50 bars, you can rotate the x-axis labels by 90 degrees. In this way, each label only takes a few pixels of width, and you can put much more labels on the x-axis. The code is like (in C#):

//Arial 8pt black rotate by 90 degrees
c.xAxis().setLabelStyle("Arial", 8, 0x000000, 90);

(b) You may consider to use a shorter label format. I see that in your labels, you have both date and time. If it is a daily chart, you may format the label at dd/mm. You may not even need to show the year, as the year are likely the same for all labels in the chart. You can show the full date range in the x-axis title (like "From dd/mm/yyyy to dd/mm/yyyy"). In this way, the year should be obvious to the user.

(c) If you are using setLabels or setLabels2 to configure the x-axis labels, you may use Axis.setLabelStep to skip some labels. For example:

//display one out of 3 labels
c.xAxis().setLabelStep(3);

or

//skip some labels so that there are at least 75 pixels between labels
c.xAxis().setLabelStep(labels.Length * 75 / c.getPlotArea().getWidth() + 1);

(You may use all of the above methods at the same time if you like.)

Hope this can help.

Regards
Peter Kwan