【发布时间】:2018-09-08 15:00:27
【问题描述】:
我有一组跨越多个日期的数据。一些数据点需要用不同的样式来标识,以便它们脱颖而出。我可以通过使用不同的标记样式创建 2 条绘图线来近似我需要的内容,但它看起来并不连贯,并且可能会让某些人感到困惑。这是使用该方法的示例。
以上示例中的所有数据点都应连接。问题是
- 是否可以创建具有不同标记样式的单个绘图线?
- 如果上述答案是否定的,有没有办法以某种方式“合并”两条绘图线,以便所有点都连接起来?
创建示例图的代码:
<?php
require_once 'jpgraph/jpgraph.php';
require_once 'jpgraph/jpgraph_line.php';
require_once 'jpgraph/jpgraph_date.php';
$line1D = array(1497844800,1498449600,1505102400,1516597200);
$line1Y = array(79.00,76.00,53.00,14.00);
$line2D = array(1504584000,1507521600);
$line2Y = array(9.87,9.93);
$graph = new Graph(640,480);
$graph->clearTheme();
$graph->SetScale('datlin');
$graph->xaxis->SetLabelAngle(60);
$graph->xaxis->SetFont(FF_ARIAL,FS_NORMAL,8);
$graph->xaxis->SetLabelFormatString('m/d/Y',true);
$graph->yaxis->scale->SetGrace(5);
$line1=new LinePlot($line1Y,$line1D);
$line1->SetColor('#4A6EC6');
$line1->SetWeight(2);
$line1->mark->SetFillColor('#4A6EC6');
$line1->mark->SetType(MARK_FILLEDCIRCLE);
$graph->Add($line1);
$line2=new LinePlot($line2Y,$line2D);
$line2->SetColor('#4A6EC6');
$line2->SetWeight(2);
$line2->mark->SetType(MARK_CIRCLE);
$line2->mark->SetColor('#4A6EC6');
$graph->Add($line2);
$graph->Stroke(); // display the graph
?>
【问题讨论】: