primafaces chart x axis [duplicate]

匿名 (未验证) 提交于 2019-12-03 01:26:01

问题:

This question already has an answer here:

You can see the problem from this site.

Here is the code of my index.html file:

<h:head></h:head>         <h:form>       <p:outputLabel value="Primefaces Tutorial"></p:outputLabel>       <p:chart type="bar" model="#{viewEmployeesManagedBean.barModel}" style="height:500px"  xaxisAngle="90" />    </h:form> </html> 

I create a chart in primefaces java. xAxis overlaps. I use xaxisAngle. But it seems it makes no difference. Any idea how to fix it?

I want vertical xAxis labels. What should I do?

回答1:

The duplicate refers to it doing in the model. You can however also do it in javascript but you need to use the extender functionality. An example of how to use this in this case is

JavaScript:

function customExtender() { 	this.cfg.axes = { 		xaxis : { 			renderer : $.jqplot.DateAxisRenderer, 			rendererOptions : { 				tickRenderer : $.jqplot.CanvasAxisTickRenderer 			}, 			tickOptions : { 				formatString : '%b %#d, %H:%M:%S', 				angle : 60 			} 		}, 		yaxis : { 			rendererOptions : { 				tickRenderer : $.jqplot.CanvasAxisTickRenderer 			}, 			tickOptions : { 				fontSize : '10pt', 				fontFamily : 'Tahoma', 				angle : 30 			}  		}  	}; }

ManagedBean

barModel.setExtender("customExtender"); 


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