开发者

PChart - Show a fixed number of lablels in X-Axis

How to show only a fixed number of labels in X-Axis ??

I have tried "LabelSkip", but I think it works only with an interval and not with fixed number of labels.

Here is a print-screen of my c开发者_开发问答hart:

PChart - Show a fixed number of lablels in X-Axis


Are you using pChart 1 or pChart2 ?

This can be achived in pChart 1 using setFixedScale

To draw a scale with a maximum value of 10 with 5 points use the following command before drawing the scale

$Graph->setFixedScale(0,10,5);


I know it has been a while since this was asked, but it may help someone:

$maxXLabels = 5; // How many labels on-screen?

$labelSkip = floor( count( $timestamp ) / $maxXLabels ); // how many should we skip?
$myPicture->drawScale(array("LabelSkip"=>$labelSkip));


I have used "LabelSkip"=>(count($series)/10) to have 10 labels on the X axis

Works fine for me


Joel Deutscher's answer worked for me. I would have up voted it, but I do not have enough stackoverflow reputation for that.

It works exactly as he said: Chart Width / MinDivHeight = Number of labels on the chart.

Here's my code

$scaleSettings = array("DrawXLines"=>FALSE,"Mode"=>SCALE_MODE_START0,"GridR"=>0,"GridG"=>0,"GridB"=>0,"GridAlpha"=>10,"Pos"=>SCALE_POS_TOPBOTTOM, "MinDivHeight" => 50);

$pchart->chart->drawScale($scaleSettings);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜