我有一个项目,使图形与许多x轴值,它不能显示显示值类中的show()函数显示,因为它会相互重叠。因此,我希望仅当鼠标位于直线或刻度点上时才显示图形值。这可能吗?如果可能的话,怎么做呢?(如果有其他不是JPGraph的方式,请告诉我。)
谢谢你!:)
我不知道你是否理解我。对不起,我的英语很差。
这是不可能的,因为JPGraph正在渲染平面图像,对于网页来说,这与添加任何平面图像相同,因此它无法知道您的鼠标悬停在哪个数据块上。
试一下这个例子。甚至可以添加到另一个页面的链接。
require_once ('jpgraph/jpgraph.php'); // change to your libraries
require_once ('jpgraph/jpgraph_bar.php'); // change to your libraries
// Some random data to plot
$datay=array(12,26,9,17,31);
// Create the graph.
$graph = new Graph(400,250);
$graph->SetScale("textlin");
// Create a bar pot
$bplot = new BarPlot($datay);
// Create targets for the image maps so that the details are opened in a separate window
$fmtStr = "javascript:window.open('barcsim_details.php?id=%d','_new','width=500,height=300');void(0)";
$n = count($datay);
$targ=array();
$alts=array();
for($i=0; $i < $n; ++$i) {
$targ[$i] = sprintf($fmtStr,$i+1);
$alts[$i] = '%d';
// Note: The format placeholder val=%d will be replaced by the actual value in the ouput HTML by the
// library so that when the user hoovers the mouse over the bar the actual numerical value of the bar
// will be dísplayed
}
$bplot->SetCSIMTargets($targ,$alts);
// Add plot to graph
$graph->Add($bplot);
// Setup the title, also wih a CSIM area
$graph->title->Set("CSIM with popup windows");
$graph->title->SetFont(FF_FONT2,FS_BOLD);
// Assume we can give more details on the graph
$graph->title->SetCSIMTarget(sprintf($fmtStr,-1),'Title for Bar');
// Send back the HTML page which will call this script again to retrieve the image.
$graph->StrokeCSIM();
http://fossies.org/dox/jpgraph-3.0.7/barcsim__popup_8php_source.html lineplot ->美元价值——> Show ();
查看value-method和一些选项
以下函数可能在您的项目中使用。例如
clearviewport();