doulai5585 2013-08-07 22:01
浏览 144
已采纳

使用SetScale时,JpGraph LinePlot输出超出图形区域

I'm using JpGraph to graph some data. When I use the SetScale function to force a y-axis range the output visually overflows the graph area. I would like to have the output cropped to the graph area.

<?php

require_once ('include/jpgraph/jpgraph.php');
require_once ('include/jpgraph/jpgraph_line.php');

$datay1 = array(20,7,16,46,90,5,0,5,95);

// Setup the graph
$graph = new Graph(400,300);
$graph->title->Set('Graph Title');
$graph->title->font_size = 20;
$graph->SetScale("textlin",20,50);

//this version works but does not set the y-axis scale
//$graph->SetScale("textlin");

$p1 = new LinePlot($datay1);
$graph->Add($p1);

// Output line
$graph->Stroke();

?>

This is the current output:
enter image description here

This is the desired output (rendered by Excel):
enter image description here

  • 写回答

2条回答 默认 最新

  • dongshuo5101 2013-10-21 15:15
    关注

    I got in touch with the company behind JpGraph and they were able to help. The missing option is:

    $graph->setClipping(true);
    

    I hope this helps anyone else who may have a similar issue.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)
  • ¥15 keil里为什么main.c定义的函数在it.c调用不了
  • ¥50 切换TabTip键盘的输入法
  • ¥15 可否在不同线程中调用封装数据库操作的类
  • ¥15 微带串馈天线阵列每个阵元宽度计算
  • ¥15 keil的map文件中Image component sizes各项意思
  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据