dqask02082 2011-07-26 06:07
浏览 108

JPGraph底部边缘与Legend开/关

I have a problem with PHP Graphing library at JPGraph.net . I have a really simple LinePlot() and if i add a legend to the graph the bottom margin of the graph extend by circa 10 pixels. Making the graph legend Show() or Hide() doesn't make any difference the bottom margin is added to the graph right after the legend is associated with a lineplot.

Is there any solution to switch off this behaviour? Because i generate thumbnail size graphs (eg. 180x100) the bottom margin white area is quite "large".

For better understanding:

Left: starting point before legend is added

Right: After the legend is added, no other changes to the margins/code of the graph

Oops i dont have enough reputation to post images :(

left_good right_bad

  • 写回答

4条回答 默认 最新

  • doulu8341 2011-07-26 06:31
    关注

    Keep in mind the legend is more or less independent from the graph itself, it can be placed anywhere.

    The margin of the graph itself can - in most cases - be modified using...

    Graph::SetMargin($left_m, $right_m, $top_m, $bottom_m)
    

    ...(margin in pixels) which could look like this in your code:

    $graph = new Graph(180,100);    
    $graph->SetMargin(10,20,30,40);
    
    /* followed by alot more code for your graph until... */
    $graph->Stroke();
    

    I advise looking into the extensive documentation which is included in the JPGraph packages, the classes are well documented and they offer alot of examples how to work with it.

    评论

报告相同问题?

悬赏问题

  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥15 想问一下树莓派接上显示屏后出现如图所示画面,是什么问题导致的
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化