use of hudson.plugins.violations.graph.SeverityTypeDataSet in project violations-plugin by jenkinsci.
the class AbstractViolationsBuildAction method doGraph.
/**
* This corresponds to the url ./graph.
*
* @param req
* the request parameters.
* @param rsp
* the response.
* @throws IOException
* if there is an error writing the graph
*/
public void doGraph(StaplerRequest req, StaplerResponse rsp) throws IOException {
String type = req.getParameter("type");
if (ChartUtil.awtProblemCause != null) {
// not available. send out error message
rsp.sendRedirect2(req.getContextPath() + "/images/headless.png");
return;
}
getBuild().getTimestamp();
if (!StringUtil.isBlank(type)) {
ChartUtil.generateGraph(req, rsp, new SeverityTypeDataSet(getReport(), type).createChart(), X_SIZE, Y_SIZE);
return;
}
DataSetBuilder<String, ChartUtil.NumberOnlyBuildLabel> dsb = new DataSetBuilder<String, ChartUtil.NumberOnlyBuildLabel>();
for (ViolationsReport r : ViolationsReport.iteration(getBuild())) {
for (String ty : r.getViolations().keySet()) {
dsb.add(roundUp(r.getViolations().get(ty)), ty, new ChartUtil.NumberOnlyBuildLabel((Run) r.getBuild()));
}
}
ChartUtil.generateGraph(req, rsp, createChart(dsb.build()), X_SIZE, Y_SIZE);
}
Aggregations