How to add a vertical line in a horizontal bar chart using primefaces + jqplot

好久不见. 提交于 2019-12-24 07:48:15

问题


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

Code ( Example - Primefaces ):

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

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

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

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


回答1:


Finally solved my problem:

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

 horizontalBarModel.setExtender("NAME");

2 - Create a javascript function in xhtml:

function NAME(){}

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 
 }}]};

}

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 - Add Labels and Tooltips with: Bitbucket Cleonello Jqplot - Support to canvas overlay lines.



来源:https://stackoverflow.com/questions/29257474/how-to-add-a-vertical-line-in-a-horizontal-bar-chart-using-primefaces-jqplot

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!