【问题标题】:Why does JPGraph LinePlot SetStyle draw a white line instead of the specified dashed red line?为什么 JPGraph LinePlot SetStyle 绘制的是白线而不是指定的红色虚线?
【发布时间】:2020-04-08 06:52:18
【问题描述】:

我想在 JPGraph 中有一条带有 Lineplot 的虚线。但是,如果我使用适当的方法,线条会被绘制成白色而不是指定的颜色。

我使用这个代码:

$graph = new Graph($this->graphW, $this->graphH);

...

$lineplot = new LinePlot($this->target_data);
$graph->Add($lineplot);
$lineplot->setLegend($this->lang[15]);

$lineplot->SetStyle('dashed');
$lineplot->setColor('red');

$graph->Stroke();

结果如下:

但是,如果我在代码中添加以下内容:

$lineplot->SetStepStyle();

结果是这样的:

所以问题是:我如何在没有 StepStyle 的情况下获得虚线,为什么没有 SetpStyle 它不能工作?

【问题讨论】:

    标签: php jpgraph


    【解决方案1】:

    在将线条添加到图表之前,先完成所有线条样式。

    $lineplot = new LinePlot($this->target_data);
    $lineplot->setLegend($this->lang[15]);
    $lineplot->SetStyle('dashed');
    $lineplot->setColor('red');
    $graph->Add($lineplot);  // moved this to after the styling was done
    $graph->Stroke();
    

    【讨论】:

      猜你喜欢
      • 2012-04-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-07-12
      • 1970-01-01
      • 1970-01-01
      • 2015-05-23
      • 1970-01-01
      相关资源
      最近更新 更多