I have about 240 data points (month ends as dates.) The X axis lables are crowded. I want to show only few may be 20. I have tried setnumXtics() and setXTickincrement(). It did not worked in my example below. X axis still same.
$title='Weekly Chart of GDVM_Rank and Close for the Stock';$plot=&newPHPlot(1800,1000);$plot->SetImageBorderType('plain');//Forpresentationinthemanual$plot->SetPrintImage(False);//Donotoutputtheimage$plot->SetTitle($title);$plot->SetPlotBgColor('gray');$plot->SetLightGridColor('black');//Sogridstandsoutfrombackground$y_title1='Weekly GDVM_Rank';$legend1=array('Weekly Rank');$y_title2='Weekly Close';$legend2=array('Weekly Close');$plot->SetDrawPlotAreaBackground(True);$plot->SetPlotType('stackedbars');$plot->SetDataType('text-data');$plot->SetDataValues($data1);$plot->SetYTitle($y_title1);$plot->SetXTitle(Date);#Setandpositionlegend#1:$plot->SetLegend($legend1);$plot->SetLegendPixels(5,30);#Setmarginstoleaveroomforplot2Ytitleontheright.$plot->SetMarginsPixels(120,120);#SpecifyYrangeofthesedatasets://$plot->SetPlotAreaWorld(NULL,0,NULL,5000);$plot->SetPlotAreaWorld(NULL,0,NULL,NULL);$plot->SetYTickIncrement();$plot->SetXLabelAngle(90);//$plot->SetXTickIncrement(100);$plot->SetNumXTicks(10);$plot->SetXTickLabelPos('none');$plot->SetXTickPos('none');$plot->SetXDataLabelPos('plotdown');$plot->SetDataColors('cyan');#FormatYticklabelsasintegers,withthousandsseparator://$plot->SetYLabelType('data',0);//$plot->TuneYAutoRange(10,'Decimal');//$plot->SetYLabelType('data',1);$plot->DrawGraph();echo"<img src=\"".$plot->EncodeImage()."\">\n";
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I see you are displaying X axis data labels, not X tick labels. So changing the X tick increment or number of X ticks will not affect the labels. These are two different types of labels.
The labels you are seeing along the X axis are in your data array ($data1[X][0] for each X). The only way to reduce the axis data label density is to clear out some of these labels from your data array (that is, replace them with empty strings). There is a sample function to do this in the PHPlot distribution: contrib/prune_labels.*
There was a post recently on this forum ("Problems with multiple plot") where the issue of label density was also mentioned (tick labels, in that case). I took a quick look at adding a way to control this inside PHPlot, but there isn't a good place to do this. I'm not giving up on it, but will revisit it in the future.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have about 240 data points (month ends as dates.) The X axis lables are crowded. I want to show only few may be 20. I have tried setnumXtics() and setXTickincrement(). It did not worked in my example below. X axis still same.
I see you are displaying X axis data labels, not X tick labels. So changing the X tick increment or number of X ticks will not affect the labels. These are two different types of labels.
The labels you are seeing along the X axis are in your data array ($data1[X][0] for each X). The only way to reduce the axis data label density is to clear out some of these labels from your data array (that is, replace them with empty strings). There is a sample function to do this in the PHPlot distribution: contrib/prune_labels.*
There was a post recently on this forum ("Problems with multiple plot") where the issue of label density was also mentioned (tick labels, in that case). I took a quick look at adding a way to control this inside PHPlot, but there isn't a good place to do this. I'm not giving up on it, but will revisit it in the future.
yeah...it helped.
require_once 'prune_labels.php';
prune_labels($data1, 20);
prune_labels($data2, 20);