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

Message ListMessage List     Post MessagePost Message

  Dates on xAxis
Posted by Brian on Oct-31-2012 04:39
Hello -

I'm attempting to make an xy chart with a lot of datapoints. The dataset has daily data points from 01/01/2008 to present with a date column in format of mm/dd/yyyy. The date column should be the xAxis. I'm trying to display only major increments of dates because otherwise there are too many data points and I just end up with a black line for the labels. I have been trying to use various conotations of SetLinearScale, and SetDateScale with no luck. It appears the xAxis has the correct data labels, but the graphs is empty. If I don't set any lables for the X axis, the linear layer displays fine. Otheriwis I end up with correct xAxis labels and the Y-axis is properly scaled, but the chart is empty. Does anyone know what I'm doing wrong?

Thanks!

Brian

  Re: Dates on xAxis
Posted by Brian on Oct-31-2012 05:56
Nevermind.

I ended up solving the problem by using logic on the backend when retrieving the data.

Thanks though!

  Re: Dates on xAxis
Posted by Peter Kwan on Nov-01-2012 17:00
Hi Brian,

If you provide the x-axis labels (using Axis.setLabels or Axis.setLabels2), ChartDirector will use those labels on the x-axis. You may use Axis.setLabelStep to skip some labels. The labels are treated like names. They are for human reading, and does not have any particular meaning to ChartDirector.

Instead of using x-axis labels, you can provide the x-coordinates of the data points to ChartDirector using something like (in Java/C#):

Layer layer = c.addLineLayer(myYData, ....);
layer.setXData(myArrayOfXDates);

In this case, ChartDirector will auto-scale the x-axis based on the dates, just like it will auto-scale the y-axis based on the numbers. You can still control the label date format by using Axis.setLabelFormat. If you want to use a specific date scale (instead of ChartDirector choosing a suitable date scale automatically), you may use Axis.setDateScale.

In other words, if you use Axis.setDateScale, you must also inform ChartDirector what are the x-coordinates of the data points using setXData.

Note that the myArrayOfXDates must be an array of dates, as according to your programming language. For example, in Java, a date is a java.util.Date object. In .NET, a date is a System.DateTime object. Using an English or French or Japanese or any other human language dates probably will not work. (The programming language must be used, not the human language.) For details, you may look up "Date Representation" from the ChartDirector documentation index.

Hope this can help.

Regards
Peter Kwan