问题
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