protected JPanel getOptionPanel() { initGUI(); JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); if (absPerformance instanceof AbstractPerformance2D) { panel.add(dim1Sort.getPropertyPanel()); } panel.add(measSort.getPropertyPanel()); panel.add(timeUnitSort.getPropertyPanel()); panel.add(colorSort.getPropertyPanel()); panel.setBackground(colorBg); return panel; }
// XY Block Chart // ////////////////////////////////////////////////////////////////////////////// protected JScrollPane getGraphPanel() { max = Double.MIN_VALUE; updatePerformance(); if (measSort.getValue().equals("time")) { datasetList = getXYBlockChartDatasetList(tsMap); } else { datasetList = getXYBlockChartDatasetList_freq(tsMap); } return drawGraphPanel(); }
// Pie Chart // ////////////////////////////////////////////////////////////////////////////// protected JScrollPane getGraphPanel() { DefaultCategoryDataset dataset; if (absPerformance instanceof AbstractPerformance2D) { dataset = getDefaultCategoryDataset((AbstractPerformance2D) absPerformance); } else { dataset = getDefaultCategoryDataset(absPerformance); } PlotOrientation order = PlotOrientation.VERTICAL; if (orientationSort.getValue().equals("Horizontal")) { order = PlotOrientation.HORIZONTAL; } String strCategory = absPerformance.getItemName(); if (absPerformance instanceof AbstractPerformance2D) { if (isItemA) { strCategory = ((AbstractPerformance2D) absPerformance).getSecondItemName(); } else { strCategory = ((AbstractPerformance2D) absPerformance).getItemName(); } } if (dimSort.getValue().equals("2D")) { chart = ChartFactory.createStackedBarChart( null, strCategory, "time", dataset, order, bLegend, true, false); } else if (dimSort.getValue().equals("3D")) { chart = ChartFactory.createStackedBarChart3D( null, strCategory, "time", dataset, order, bLegend, true, false); } // set the background color for the chart... chart.setBackgroundPaint(Color.white); // get a reference to the plot for further customisation... CategoryPlot plot = chart.getCategoryPlot(); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); // set the range axis to display integers only... NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); rangeAxis.setUpperMargin(0.15); chartPanel = new ChartPanel(chart, false); scrollPane = new JScrollPane(chartPanel); return scrollPane; }
private ChartPanel getChartPanel(DefaultXYZDataset dataset, int i) { String key = (String) dataset.getSeriesKey(0); DateAxis yAxis = new DateAxis("Date"); yAxis.setLowerMargin(0.0); yAxis.setUpperMargin(0.0); yAxis.setTickUnit(new DateTickUnit(DateTickUnit.DAY, 1)); NumberAxis xAxis = new NumberAxis("Hour"); xAxis.setUpperMargin(0.0); xAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); XYBlockRenderer renderer = new XYBlockRenderer(); renderer.setBlockWidth(1000.0 * 60.0 * 60.0 * 24.0); renderer.setBlockAnchor(RectangleAnchor.BOTTOM_LEFT); // range scaling PaintScale paintScale; if (colorSort.getValue().equals("gray")) // gray scaling { paintScale = new GrayPaintScale(0.0, maxArray[i]); } else { int color_max, color_min; if (colorSort.getValue().equals("red")) { // red scaling color_max = 0xFF33FF; color_min = 0xFF3300; } else if (colorSort.getValue().equals("blue")) { // blue scaling color_max = 0x0033FF; color_min = 0x003300; } else { // yellow scaling color_max = 0xFFFFFF; color_min = 0xFFFF00; } paintScale = new LookupPaintScale(0.0, maxArray[i], new Color(color_max)); int d = Math.max((color_max - color_min) / ((int) maxArray[i] + 1), 1); for (int k = 0; k <= maxArray[i]; k++) { ((LookupPaintScale) paintScale) .add(new Double(k + 0.5), new Color(color_max - (k + 1) * d)); } } renderer.setPaintScale(paintScale); XYPlot plot = new XYPlot(dataset, yAxis, xAxis, renderer); plot.setOrientation(PlotOrientation.HORIZONTAL); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); plot.setForegroundAlpha(0.66F); JFreeChart chart = new JFreeChart(key, plot); chart.removeLegend(); chart.setBackgroundPaint(Color.white); // adding data ranges NumberAxis scaleAxis = new NumberAxis(null); scaleAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); scaleAxis.setLowerBound(0.0); scaleAxis.setUpperBound(maxArray[i]); PaintScaleLegend psl = new PaintScaleLegend(paintScale, scaleAxis); psl.setAxisOffset(5.0); psl.setPosition(RectangleEdge.BOTTOM); psl.setMargin(new RectangleInsets(5, 5, 5, 5)); chart.addSubtitle(psl); ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setBorder(BorderFactory.createLineBorder(Color.lightGray)); return chartPanel; }
protected JPanel getOptionPanel() { JPanel panel = super.getOptionPanel(); panel.add(dimSort.getPropertyPanel()); panel.add(orientationSort.getPropertyPanel()); return panel; }