为什么我的p:图表的条形重叠

问题描述 投票:1回答:1

使用jsf和primefaces开发Java8应用程序时,我遇到了一个与barChart栏重叠的小问题。所以我的问题是:如何配置图表的宽度而不影响轴的间隔?

我的第一个想法是用xAxis.setTickInterval();修改轴,但问题是我的轴是一个月/年的DateAxis并且它在轴上显示了同一个月的多次(不是多次时间栏(参见屏幕截图)减少重叠) 。

enter image description here

和代码:

private void createChart() {
		globalGradeEvolution = new BarChartModel();
		globalGradeEvolution.setTitle("Evaluation globale");
		globalGradeEvolution.setLegendPosition("e");
		
		//Define two axis
		Axis yAxis = globalGradeEvolution.getAxis(AxisType.Y);
		DateAxis xAxis = new DateAxis("Dates");
		
		//cacteristics of x axis
		xAxis.setTickAngle(-30);
		xAxis.setMax(LocalDate.now().getYear()+"-"+LocalDate.now().getMonthValue()+"-"+"15"); // middle of the month
		xAxis.setTickFormat("%m/%Y"); // example: 08/2018
		
		//cacteristics of y axis
		yAxis.setLabel("Notes");
		yAxis.setMin(min);
		yAxis.setMax(10);
		yAxis.setTickFormat("%.1f");

		globalGradeEvolution.getAxes().put(AxisType.X, xAxis);
	}
<h:form>
    <p:chart type="bar" model="#{statChartView.globalGradeEvolution}" style="height:400px" responsive="true"/>
</h:form>
jsf primefaces jqplot
1个回答
1
投票

这是PrimeFaces + JqPlot组合中的一个错误。

这个bug已经报告给了PrimeFaces:https://github.com/primefaces/primefaces/issues/3684

© www.soinside.com 2019 - 2024. All rights reserved.