I wanted to force BarChart's X to have 31 ticks. I only have 10 values, but I would like to show 31 ticks, is it possible?
I use Primefaces, but I also use extender, which is directly using jqplot's api.
I would like it to appear from 1 to 31.
You can enter in the series the values [(11,0), (12,0), ... (31,0)]. It turns out that by using the trendline plugin (trendline), it uses those values equal to 0 to calculate the trendline and does not look interesting. You need the trend line to go to tick 31, even if they do not have values from 10 onwards.
//EsboçodométodoquecriaográficonoPrimefacespublicvoidgetTendChart(List<Tend>tends){BarChartModelchartModel=newBarChartModel();chartModel.setExtender("padrao");
chartModel.setShowPointLabels(true);
Axis yAxis = chartModel.getAxis(AxisType.Y);
yAxis.setTickInterval("500");
ChartSeries series = new BarChartSeries();
tends.forEach(it -> series.set(it.getDia(), it.getValue()));
chartModel.addSeries(series);
chartModel.setLegendPlacement(LegendPlacement.INSIDE);
}
class Tend {
private Integer dia;
private Double value;
public Tend(Integer dia, Double value) {
this.dia = dia;
this.value = value;
}
public Integer getDia() {
return dia;
}
public Double getValue() {
return value;
}
}
//Extender utilizado.
function padrao() {
this.cfg.highlighter = {
show: true,
tooltipAxes: 'y'
};
}