Cato Utica
Cato Utica

Reputation: 1

Minor tick marks are not shown on X axis of JPGraph bar chart

I am trying to create a bar chart with JpGraph-4.4.2. and make minor as well as major tick marks work. However it seems like the code from examples creates major and minor marks for Y, but only major marks are shown on X.

This code works for Y-axis:

$graph = new Graph(1450,400,'auto');

$graph->SetScale("textlin", 0, 100, 0, 6);

$graph->graph_theme = null;

$graph->yaxis->SetTickPositions(array(0,10,20,30,40,50,60,70,80,90,100), array(5,15,25,35,45,55,65,75,85,95));
$graph->xaxis->SetTickPositions(array(-5,-4,-3,-2,-1,0,1,2,3,4,5,6));

$graph->yaxis->HideLine(false);
$graph->yaxis->HideTicks(false,false);

But when doing the same for the X-axis, it doesn't work anymore.

$graph = new Graph(1450,400,'auto');

$graph->SetScale("textlin", 0, 6, 0, 100);

$graph->graph_theme = null;

$graph->xaxis->SetTickPositions(array(0,10,20,30,40,50,60,70,80,90,100), array(5,15,25,35,45,55,65,75,85,95));
$graph->yaxis->SetTickPositions(array(-5,-4,-3,-2,-1,0,1,2,3,4,5,6));


$graph->xaxis->scale->ticks->SetSize(5,12);

$graph->xaxis->scale->ticks->SupressMinorTickMarks(false);
$graph->xaxis->scale->ticks->SupressTickMarks(false);

$graph->xaxis->HideLine(false);
$graph->xaxis->HideTicks(false,false);

Here's some images of the results I'm getting :

Minor marks appearing on the Y-axis

But not appearing on the X-axis

GD Free type is enabled in php 7.4

Upvotes: 0

Views: 53

Answers (0)

Related Questions