JPGraph - 条形图未显示值

LNe*_*dza 1 php jpgraph

我正在使用最新版本的JPGraph,我正在尝试更改graph_api文件以显示Group Bar Plots上的值.这是一段显示我的更改的代码片段(对于那些查看API的人来说,这是在graph_group函数中):

$tot = new BarPlot( array_values( $total ) );
$tot->value->show();
$tot->value->SetFormat('%2d');
$tot->value->SetColor('black','black');
$tot->value->SetFont($t_graph_font,FS_BOLD,9);
$tot->SetFillColor('lightblue');
$tot->SetWidth(0.7);
$tot->SetLegend( lang_get( 'legend_total' ) );
$graph->Add($tot);

$p1 = new BarPlot( array_values( $p_metrics['open'] ) );
$p1->SetFillColor( 'yellow' );
$p1->SetWidth( 1 );
$p1->SetLegend( plugin_lang_get( 'legend_opened' ) );
$p1->value->show();
$p1->value->SetColor('white','white');
$p1->value->SetFormat('%2d');
$p1->value->SetFont($t_graph_font,FS_BOLD,8);
$p1->SetFillColor('red');
$p1->SetLegend( lang_get( 'legend_still_open' ) );

$p2 = new BarPlot( array_values( $p_metrics['closed'] ) );
$p2->SetFillColor( 'blue' );
$p2->SetWidth( 1 );
$p2->SetLegend( plugin_lang_get( 'legend_closed' ) );
$p2->value->show();
$p2->value->SetFormat('%2d');
$p2->value->SetColor('black','black');
$p2->SetFillColor('forestgreen');
$p2->SetWidth(0.5);
$p2->SetLegend( lang_get( 'legend_closed' ) );

$gbplot = new GroupBarPlot( array( $p1, $p2 ) );
$gbplot->value->show();

$graph->Add( $gbplot );
Run Code Online (Sandbox Code Playgroud)

根据API,使用"value-> show()"应显示值.当我添加最后一行(对于$ gbplot)时,图表不会显示.如果我将其注释掉,图表将显示sans值.我错过了什么?

LNe*_*dza 7

显然这个问题必须处理JPGraph默认情况下不允许你覆盖它的主题的事实.通过将主题设置为null,我发现允许我进行更广泛的更改.国际海事组织,这是一个非常愚蠢的设置,但c'est la vie.这是我的图表定义现在的样子:

$graph = new Graph( $p_graph_width, $p_graph_height );
$graph->SetScale('textlin');
$graph->graph_theme = null;
$graph->SetFrame(false);
Run Code Online (Sandbox Code Playgroud)

'graph_theme'行是为我修复问题的新增内容.我希望这对未来的其他人有帮助,因为它们的API中没有明确说明.