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

Message ListMessage List     Post MessagePost Message

  Reg: Changing the xaxis data points
Posted by Sakthivel on Feb-27-2013 20:13
Hi,

I am using stacked bar chart.In this, when xaxis data comes like array(1,2,3,4), the data points in xaxis starting in 0,0.5. I have to change this as 1,2,3 etc as not in points .

  Re: Reg: Changing the xaxis data points
Posted by Peter Kwan on Feb-28-2013 00:24
Hi Sakthivel,

In a bar chart, usually the bars are equally spaced, and so there is no need to have any x-coordinate to specify the position. The x-axis labels are just treated as names for human reading, regardless of whether they are actually names, numbers or dates. In this case, the x-axis labels should be specified using Axis.setLabels. For example, in PHP:

$c->xAxis->setLabels($myArrayOfXData);

In some cases, the bars are randomly or not uniformly spaced, and so their positions need to be specified using x-coordinates. In this case, the x-coordinates should be numbers or dates that can be used to infer the position of the bars, and be set using Layer.setXData. For example:

$myBarLayer->setXData($myArrayOfXData);

If auto-scaling is used, the labels on the x-axis may not be the same as the x-data. For example, if the x-data are (0, 1.241, 3.44, 37), ChartDirector may choose (0, 10, 20, 30, 40) as x-axis labels. You may notice the same for y-axis labels. For example, if the y-data are (57, 35, 140, 222), ChartDirector may choose (0, 50, 100, 150, 200, 250) as the y-axis labels.

So for your case, if your bars are equally spaced, you may use Axis.setLabels instead of  Layer.setXData. If you would like to use Layer.setXData, but you want the axis labels to be integers only, you may use Axis.setMinTickInc. For example:

$c->xAxis->setMinTickInc(1);  #minimum tick incremenet is 1

If are using Layer.setXData, and you would like to specify the x-axis labels yourself (instead of auto-scaling based on the x-data), you may use Axis.setLinearScale or Axis.setLinearScale2.

Hope this can help.

Regards
Peter Kwan