use of massbank.web.SearchExecution in project MassBank-web by MassBank.
the class Contents method init.
public void init() throws ServletException {
try {
result = new SearchExecution(null).exec(new RecordIndexCount());
// construct and show pie charts
int MAX_DISP_DATA = 10;
PieDataset siteGraphData = createDataset(result.mapSiteToRecordCount, MAX_DISP_DATA);
PieDataset instGraphData = createDataset(result.mapInstrumentToRecordCount, MAX_DISP_DATA);
PieDataset msGraphData = createDataset(result.mapMsTypeToRecordCount, MAX_DISP_DATA);
int siteTopNum = (siteGraphData.getItemCount() < MAX_DISP_DATA) ? siteGraphData.getItemCount() : MAX_DISP_DATA;
int instTopNum = (instGraphData.getItemCount() < MAX_DISP_DATA) ? instGraphData.getItemCount() : MAX_DISP_DATA;
int msTopNum = (msGraphData.getItemCount() < MAX_DISP_DATA) ? msGraphData.getItemCount() : MAX_DISP_DATA;
JFreeChart sitechart = drawDataset(siteGraphData, "Contributor top " + siteTopNum);
JFreeChart instchart = drawDataset(instGraphData, "Instrument Type top " + instTopNum);
JFreeChart mschart = drawDataset(msGraphData, "MS Type top " + msTopNum);
SVGGraphics2D g2 = new SVGGraphics2D(900, 350);
Rectangle r = new Rectangle(0, 0, 900, 350);
sitechart.draw(g2, r);
sitechartSVG = g2.getSVGElement();
instchart.draw(g2, r);
instchartSVG = g2.getSVGElement();
mschart.draw(g2, r);
mschartSVG = g2.getSVGElement();
// get the current database timestamp
timestamp = new DatabaseTimestamp();
} catch (SQLException | ConfigurationException e) {
logger.error(e.getMessage());
}
}
Aggregations