如何在水平条形图中使用primefaces + jqplot添加垂直线 [英] How to add a vertical line in a horizontal bar chart using primefaces + jqplot

查看:317
本文介绍了如何在水平条形图中使用primefaces + jqplot添加垂直线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用primefaces + jqplot创建一个水平和堆叠条形图:

I'm using primefaces + jqplot to create a Horizontal and Stacked bar chart:

代码(示例 - Primefaces):

Code ( Example - Primefaces ):

http://www.primefaces.org/showcase/ui /chart/bar.xhtml

我需要在图表中添加一行,如下图所示:(Vertical中的红线)

I need to add a line in chart like this image: ( Red line in Vertical )

http://peltiertech.com/Excel/pix1/AddLine.gif

我可以使用Primefaces + Jqplot吗?

Can i do this with Primefaces + Jqplot ? If it's possible, someone can help me to understand ?

推荐答案

最后解决了我的问题:

1 - 在Managed Bean中添加一个名为extender的扩展器:

1 - Add a extender in Managed Bean with name of extender:

 horizontalBarModel.setExtender("NAME");

2 - 在xhtml中创建javascript函数:

2 - Create a javascript function in xhtml:

function NAME(){}

Canvas Overlay:

3 - Add a Canvas Overlay:

function NAME()
{
 this.cfg.canvasOverlay = {
                show: true,
                objects: [{verticalLine:{
                "shadow":"false",
                "lineWidth":5,
                "color":"rgb(255,0,0)",
                "x":50 
 }}]};

}

水平线取决于以下文件(使用Primefaces 5.0):

4 - This vertical/horizontal lines depend on the following files (using Primefaces 5.0):

jqplot.canvasOverlay.js

您可以在中找到此文件

You can find this file in Bitbucket Cleonello Jqplot.

5 - 添加标签和工具提示: Bitbucket Cleonello Jqplot - 支持画布覆盖线

5 - Add Labels and Tooltips with: Bitbucket Cleonello Jqplot - Support to canvas overlay lines.

这篇关于如何在水平条形图中使用primefaces + jqplot添加垂直线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆