/** Some checks for the getStart() method. */ public void testGetStart() { Locale saved = Locale.getDefault(); Locale.setDefault(Locale.ITALY); Calendar cal = Calendar.getInstance(Locale.ITALY); cal.set(2006, Calendar.JANUARY, 16, 3, 47, 55); cal.set(Calendar.MILLISECOND, 0); Second s = new Second(55, 47, 3, 16, 1, 2006); assertEquals(cal.getTime(), s.getStart()); Locale.setDefault(saved); }
public JFreeChart makegraph(Second g_start, Second g_end) { // read XYDataset readset = this.createread(); XYItemRenderer minichart1 = new StandardXYItemRenderer(); minichart1.setSeriesPaint(0, kSarConfig.color1); minichart1.setBaseStroke(kSarConfig.DEFAULT_STROKE); XYPlot subplot1 = new XYPlot(readset, null, new NumberAxis("Read"), minichart1); // writ XYDataset writset = this.createwrit(); XYItemRenderer minichart2 = new StandardXYItemRenderer(); minichart2.setSeriesPaint(0, kSarConfig.color2); minichart1.setSeriesPaint(1, kSarConfig.color3); minichart2.setBaseStroke(kSarConfig.DEFAULT_STROKE); XYPlot subplot2 = new XYPlot(writset, null, new NumberAxis("Write"), minichart2); // wcache XYDataset wcacheset = this.createwcache(); XYItemRenderer minichart3 = new StandardXYItemRenderer(); minichart3.setSeriesPaint(0, kSarConfig.color4); minichart3.setBaseStroke(kSarConfig.DEFAULT_STROKE); XYPlot subplot3 = new XYPlot(wcacheset, null, new NumberAxis("%wcache"), minichart3); // rcache XYDataset rcacheset = this.creatercache(); XYItemRenderer minichart4 = new StandardXYItemRenderer(); minichart4.setSeriesPaint(0, kSarConfig.color5); minichart4.setBaseStroke(kSarConfig.DEFAULT_STROKE); XYPlot subplot4 = new XYPlot(rcacheset, null, new NumberAxis("%rcache"), minichart4); // PANEL CombinedDomainXYPlot plot = new CombinedDomainXYPlot(new DateAxis("")); plot.add(subplot1, 1); plot.add(subplot2, 1); plot.add(subplot3, 1); plot.add(subplot4, 1); plot.setOrientation(PlotOrientation.VERTICAL); JFreeChart mychart = new JFreeChart(this.getGraphTitle(), kSarConfig.DEFAULT_FONT, plot, true); if (setbackgroundimage(mychart) == 1) { subplot1.setBackgroundPaint(null); subplot2.setBackgroundPaint(null); subplot3.setBackgroundPaint(null); subplot4.setBackgroundPaint(null); } if (g_start != null) { DateAxis dateaxis1 = (DateAxis) mychart.getXYPlot().getDomainAxis(); dateaxis1.setRange(g_start.getStart(), g_end.getEnd()); } bufferrcachetrigger.setTriggerValue(kSarConfig.hpuxbufferrcachetrigger); bufferrcachetrigger.tagMarker(subplot4); return mychart; }
public JFreeChart makegraph(Second g_start, Second g_end) { // used XYDataset xydataset1 = this.createused(); XYPlot subplot1; NumberAxis usedaxis = new NumberAxis("% used cpu"); if (mysar.show100axiscpu) { usedaxis.setRange(0.0D, 100D); } if (mysar.showstackedcpu) { StackedXYAreaRenderer2 renderer = new StackedXYAreaRenderer2(); renderer.setSeriesPaint(0, kSarConfig.color1); renderer.setSeriesPaint(1, kSarConfig.color2); renderer.setSeriesPaint(2, kSarConfig.color3); renderer.setSeriesPaint(3, kSarConfig.color4); subplot1 = new XYPlot(stacked_used, new DateAxis(null), usedaxis, renderer); } else { XYItemRenderer minichart1 = new StandardXYItemRenderer(); minichart1.setBaseStroke(kSarConfig.DEFAULT_STROKE); minichart1.setSeriesPaint(0, kSarConfig.color1); minichart1.setSeriesPaint(1, kSarConfig.color2); minichart1.setSeriesPaint(2, kSarConfig.color3); minichart1.setSeriesPaint(2, kSarConfig.color4); subplot1 = new XYPlot(xydataset1, null, usedaxis, minichart1); } // idle XYDataset idleset = this.createidle(); XYItemRenderer minichart2 = new StandardXYItemRenderer(); minichart2.setSeriesPaint(0, kSarConfig.color5); minichart2.setBaseStroke(kSarConfig.DEFAULT_STROKE); XYPlot subplot2 = new XYPlot(idleset, null, new NumberAxis("% idle"), minichart2); // nice XYDataset niceset = this.createnice(); XYItemRenderer minichart3 = new StandardXYItemRenderer(); minichart3.setSeriesPaint(0, kSarConfig.color6); minichart3.setBaseStroke(kSarConfig.DEFAULT_STROKE); XYPlot subplot3 = new XYPlot(niceset, null, new NumberAxis("% niced"), minichart3); // the graph CombinedDomainXYPlot plot = new CombinedDomainXYPlot(new DateAxis("")); plot.add(subplot1, 2); plot.add(subplot3, 1); plot.add(subplot2, 1); plot.setOrientation(PlotOrientation.VERTICAL); // the graph JFreeChart mychart = new JFreeChart(this.getGraphTitle(), kSarConfig.DEFAULT_FONT, plot, true); if (g_start != null) { DateAxis dateaxis1 = (DateAxis) mychart.getXYPlot().getDomainAxis(); dateaxis1.setRange(g_start.getStart(), g_end.getEnd()); } if (setbackgroundimage(mychart) == 1) { subplot1.setBackgroundPaint(null); subplot2.setBackgroundPaint(null); subplot3.setBackgroundPaint(null); } // idle trigger cpuidletrigger.setTriggerValue(kSarConfig.linuxcpuidletrigger); cpuidletrigger.tagMarker(subplot2); // system trigger cpusystemtrigger.setTriggerValue(kSarConfig.linuxcpusystemtrigger); cpusystemtrigger.tagMarker(subplot1); // wio trigger if (cpuOpt.equals("%iowait") || cpuOpt.equals("%steal")) { cpuwiotrigger.setTriggerValue(kSarConfig.linuxcpuwiotrigger); cpuwiotrigger.tagMarker(subplot1); } // usr trigger cpuusrtrigger.setTriggerValue(kSarConfig.linuxcpuusrtrigger); cpuusrtrigger.tagMarker(subplot1); // return mychart; }