/** * Some checks for the paint lookup mechanism. */ @Test public void testPaintLookup() { BarRenderer r = new BarRenderer(); assertEquals(Color.blue, r.getBasePaint()); // first check that autoPopulate==false works as expected r.setAutoPopulateSeriesPaint(false); assertEquals(Color.blue, r.lookupSeriesPaint(0)); assertNull(r.getSeriesPaint(0)); // now check autoPopulate==true r.setAutoPopulateSeriesPaint(true); /*CategoryPlot plot =*/ new CategoryPlot(null, new CategoryAxis( "Category"), new NumberAxis("Value"), r); assertEquals(DefaultDrawingSupplier.DEFAULT_PAINT_SEQUENCE[0], r.lookupSeriesPaint(0)); assertNotNull(r.getSeriesPaint(0)); }
/** * Some checks for the fill paint lookup mechanism. */ @Test public void testFillPaintLookup() { BarRenderer r = new BarRenderer(); assertEquals(Color.white, r.getBaseFillPaint()); // first check that autoPopulate==false works as expected r.setAutoPopulateSeriesFillPaint(false); assertEquals(Color.white, r.lookupSeriesFillPaint(0)); assertNull(r.getSeriesFillPaint(0)); // now check autoPopulate==true r.setAutoPopulateSeriesFillPaint(true); /*CategoryPlot plot =*/ new CategoryPlot(null, new CategoryAxis( "Category"), new NumberAxis("Value"), r); assertEquals(DefaultDrawingSupplier.DEFAULT_FILL_PAINT_SEQUENCE[0], r.lookupSeriesFillPaint(0)); assertNotNull(r.getSeriesFillPaint(0)); }
/** * Some checks for the outline paint lookup mechanism. */ @Test public void testOutlinePaintLookup() { BarRenderer r = new BarRenderer(); assertEquals(Color.gray, r.getBaseOutlinePaint()); // first check that autoPopulate==false works as expected r.setAutoPopulateSeriesOutlinePaint(false); assertEquals(Color.gray, r.lookupSeriesOutlinePaint(0)); assertNull(r.getSeriesOutlinePaint(0)); // now check autoPopulate==true r.setAutoPopulateSeriesOutlinePaint(true); /*CategoryPlot plot =*/ new CategoryPlot(null, new CategoryAxis( "Category"), new NumberAxis("Value"), r); assertEquals(DefaultDrawingSupplier.DEFAULT_OUTLINE_PAINT_SEQUENCE[0], r.lookupSeriesOutlinePaint(0)); assertNotNull(r.getSeriesOutlinePaint(0)); }
/** * Some checks for the paint lookup mechanism. */ @Test public void testPaintLookup() { BarRenderer r = new BarRenderer(); assertEquals(Color.BLUE, r.getDefaultPaint()); // first check that autoPopulate==false works as expected r.setAutoPopulateSeriesPaint(false); assertEquals(Color.BLUE, r.lookupSeriesPaint(0)); assertNull(r.getSeriesPaint(0)); // now check autoPopulate==true r.setAutoPopulateSeriesPaint(true); /*CategoryPlot plot =*/ new CategoryPlot(null, new CategoryAxis( "Category"), new NumberAxis("Value"), r); assertEquals(DefaultDrawingSupplier.DEFAULT_PAINT_SEQUENCE[0], r.lookupSeriesPaint(0)); assertNotNull(r.getSeriesPaint(0)); }
/** * Some checks for the fill paint lookup mechanism. */ @Test public void testFillPaintLookup() { BarRenderer r = new BarRenderer(); assertEquals(Color.WHITE, r.getDefaultFillPaint()); // first check that autoPopulate==false works as expected r.setAutoPopulateSeriesFillPaint(false); assertEquals(Color.WHITE, r.lookupSeriesFillPaint(0)); assertNull(r.getSeriesFillPaint(0)); // now check autoPopulate==true r.setAutoPopulateSeriesFillPaint(true); /*CategoryPlot plot =*/ new CategoryPlot(null, new CategoryAxis( "Category"), new NumberAxis("Value"), r); assertEquals(DefaultDrawingSupplier.DEFAULT_FILL_PAINT_SEQUENCE[0], r.lookupSeriesFillPaint(0)); assertNotNull(r.getSeriesFillPaint(0)); }
/** * Some checks for the outline paint lookup mechanism. */ @Test public void testOutlinePaintLookup() { BarRenderer r = new BarRenderer(); assertEquals(Color.GRAY, r.getDefaultOutlinePaint()); // first check that autoPopulate==false works as expected r.setAutoPopulateSeriesOutlinePaint(false); assertEquals(Color.GRAY, r.lookupSeriesOutlinePaint(0)); assertNull(r.getSeriesOutlinePaint(0)); // now check autoPopulate==true r.setAutoPopulateSeriesOutlinePaint(true); /*CategoryPlot plot =*/ new CategoryPlot(null, new CategoryAxis( "Category"), new NumberAxis("Value"), r); assertEquals(DefaultDrawingSupplier.DEFAULT_OUTLINE_PAINT_SEQUENCE[0], r.lookupSeriesOutlinePaint(0)); assertNotNull(r.getSeriesOutlinePaint(0)); }
protected void setPlotDrawingDefaults(Plot p, JRChartPlot jrPlot) { PlotSettings plotSettings = getPlotSettings(); Paint[] paintSequence = getPaintSequence(plotSettings, jrPlot); Paint[] outlinePaintSequence = getOutlinePaintSequence(plotSettings); Stroke[] strokeSequence = getStrokeSequence(plotSettings); Stroke[] outlineStrokeSequence = getOutlineStrokeSequence(plotSettings); // Shape[] defaultPlotShapeSequence = // getDefaultValue(defaultPlotPropertiesMap, ChartThemesConstants.PLOT_SHAPE_SEQUENCE) != null ? // (Shape[])getDefaultValue(defaultPlotPropertiesMap, ChartThemesConstants.PLOT_SHAPE_SEQUENCE) : // DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE; p.setDrawingSupplier(new DefaultDrawingSupplier( paintSequence, outlinePaintSequence, strokeSequence, outlineStrokeSequence, DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE ) ); }
protected Paint[] getOutlinePaintSequence(PlotSettings plotSettings) { List<PaintProvider> outlinePaintSequenceProvider = plotSettings.getSeriesOutlinePaintSequence(); Paint[] outlinePaintSequence = null; if (outlinePaintSequenceProvider != null && !outlinePaintSequenceProvider.isEmpty()) { outlinePaintSequence = new Paint[outlinePaintSequenceProvider.size()]; for (int i=0; i< outlinePaintSequenceProvider.size(); i++) { outlinePaintSequence[i] = outlinePaintSequenceProvider.get(i).getPaint(); } } else { outlinePaintSequence = DefaultDrawingSupplier.DEFAULT_OUTLINE_PAINT_SEQUENCE; } return outlinePaintSequence; }
public void init(double x, double y, double sx, double sy) { xSize = x; ySize =y; xStart = sx; yStart = sy; //System.out.println("MixtureEMExperiment init "+x+" ,"+y+" sx="+sx+" sy="+sy); //getContentPane().setLayout(new BorderLayout()); DB = new Database(xSize, ySize,sx,sy); CGMix = new CurvedGaussMixture(xSize, ySize, DB); GLMix = new GaussLineMixture(xSize, ySize, DB); initResutlsTable(); DefaultDrawingSupplier supplier = new DefaultDrawingSupplier(); color_mainGroup = supplier.getNextPaint(); for (int i=0; i<10; i++){ color_kernels[i] = supplier.getNextPaint(); } }
private void setGeneralChart() { DefaultPieDataset dataset = new DefaultPieDataset(); int different = HandlerProxy.getRepositoryHandler().getDifferentSongsPlayed(); int total = HandlerProxy.getRepositoryHandler().getSongs().size(); dataset.setValue(LanguageTool.getString("SONGS_PLAYED"), different); dataset.setValue(LanguageTool.getString("SONGS_NEVER_PLAYED"), total - different); JFreeChart chart = ChartFactory.createPieChart3D(LanguageTool.getString("SONGS_PLAYED"), dataset, false, false, false); chart.getTitle().setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11)); chart.setBackgroundPaint(new GradientPaint(0, 0, ColorDefinitions.GENERAL_NON_PANEL_TOP_GRADIENT_COLOR, 0, 200, ColorDefinitions.GENERAL_NON_PANEL_BOTTOM_GRADIENT_COLOR)); chart.setPadding(new RectangleInsets(5,0,0,0)); chart.getPlot().setBackgroundPaint(new GradientPaint(0, 0, ColorDefinitions.GENERAL_NON_PANEL_TOP_GRADIENT_COLOR, 0, 200, ColorDefinitions.GENERAL_NON_PANEL_BOTTOM_GRADIENT_COLOR)); DefaultDrawingSupplier drawingSupplier = new DefaultDrawingSupplier(new Paint[] {new Color(0,1,0,0.6f), new Color(1,0,0,0.6f)}, new Paint[] {new Color(0,1,0,0.4f), new Color(1,0,0,0.4f)}, DefaultDrawingSupplier.DEFAULT_STROKE_SEQUENCE, DefaultDrawingSupplier.DEFAULT_STROKE_SEQUENCE, DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE); chart.getPlot().setDrawingSupplier(drawingSupplier); ((StatsDialog)frameControlled).getGeneralChart().setIcon(new ImageIcon(chart.createBufferedImage(710, 250))); }
/** * Some checks for the paint lookup mechanism. */ public void testPaintLookup() { BarRenderer r = new BarRenderer(); assertEquals(Color.blue, r.getBasePaint()); // first check that autoPopulate==false works as expected r.setAutoPopulateSeriesPaint(false); assertEquals(Color.blue, r.lookupSeriesPaint(0)); assertNull(r.getSeriesPaint(0)); // now check autoPopulate==true r.setAutoPopulateSeriesPaint(true); /*CategoryPlot plot =*/ new CategoryPlot(null, new CategoryAxis( "Category"), new NumberAxis("Value"), r); assertEquals(DefaultDrawingSupplier.DEFAULT_PAINT_SEQUENCE[0], r.lookupSeriesPaint(0)); assertNotNull(r.getSeriesPaint(0)); }
/** * Some checks for the fill paint lookup mechanism. */ public void testFillPaintLookup() { BarRenderer r = new BarRenderer(); assertEquals(Color.white, r.getBaseFillPaint()); // first check that autoPopulate==false works as expected r.setAutoPopulateSeriesFillPaint(false); assertEquals(Color.white, r.lookupSeriesFillPaint(0)); assertNull(r.getSeriesFillPaint(0)); // now check autoPopulate==true r.setAutoPopulateSeriesFillPaint(true); /*CategoryPlot plot =*/ new CategoryPlot(null, new CategoryAxis( "Category"), new NumberAxis("Value"), r); assertEquals(DefaultDrawingSupplier.DEFAULT_FILL_PAINT_SEQUENCE[0], r.lookupSeriesFillPaint(0)); assertNotNull(r.getSeriesFillPaint(0)); }
/** * Some checks for the outline paint lookup mechanism. */ public void testOutlinePaintLookup() { BarRenderer r = new BarRenderer(); assertEquals(Color.gray, r.getBaseOutlinePaint()); // first check that autoPopulate==false works as expected r.setAutoPopulateSeriesOutlinePaint(false); assertEquals(Color.gray, r.lookupSeriesOutlinePaint(0)); assertNull(r.getSeriesOutlinePaint(0)); // now check autoPopulate==true r.setAutoPopulateSeriesOutlinePaint(true); /*CategoryPlot plot =*/ new CategoryPlot(null, new CategoryAxis( "Category"), new NumberAxis("Value"), r); assertEquals(DefaultDrawingSupplier.DEFAULT_OUTLINE_PAINT_SEQUENCE[0], r.lookupSeriesOutlinePaint(0)); assertNotNull(r.getSeriesOutlinePaint(0)); }
public static void setChartTheme() { StandardChartTheme chartTheme = new StandardChartTheme("CN"); chartTheme.setExtraLargeFont(FONT); chartTheme.setRegularFont(FONT); chartTheme.setLargeFont(FONT); chartTheme.setSmallFont(FONT); chartTheme.setTitlePaint(new Color(51, 51, 51)); chartTheme.setSubtitlePaint(new Color(85, 85, 85)); chartTheme.setLegendBackgroundPaint(Color.WHITE); chartTheme.setLegendItemPaint(Color.BLACK);// chartTheme.setChartBackgroundPaint(Color.WHITE); Paint[] OUTLINE_PAINT_SEQUENCE = new Paint[]{Color.WHITE}; DefaultDrawingSupplier drawingSupplier = new DefaultDrawingSupplier(CHART_COLORS, CHART_COLORS, OUTLINE_PAINT_SEQUENCE, DefaultDrawingSupplier.DEFAULT_STROKE_SEQUENCE, DefaultDrawingSupplier.DEFAULT_OUTLINE_STROKE_SEQUENCE, DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE); chartTheme.setDrawingSupplier(drawingSupplier); chartTheme.setPlotBackgroundPaint(Color.WHITE); chartTheme.setPlotOutlinePaint(Color.WHITE); chartTheme.setLabelLinkPaint(new Color(8, 55, 114)); chartTheme.setLabelLinkStyle(PieLabelLinkStyle.CUBIC_CURVE); chartTheme.setAxisOffset(new RectangleInsets(5, 12, 5, 12)); chartTheme.setDomainGridlinePaint(new Color(192, 208, 224)); chartTheme.setRangeGridlinePaint(new Color(192, 192, 192)); chartTheme.setBaselinePaint(Color.WHITE); chartTheme.setCrosshairPaint(Color.BLUE); chartTheme.setAxisLabelPaint(new Color(51, 51, 51)); chartTheme.setTickLabelPaint(new Color(67, 67, 72)); chartTheme.setBarPainter(new StandardBarPainter()); chartTheme.setXYBarPainter(new StandardXYBarPainter()); chartTheme.setItemLabelPaint(Color.black); chartTheme.setThermometerPaint(Color.white); ChartFactory.setChartTheme(chartTheme); }
/** * Creates and returns a theme called "Darkness". In this theme, the * charts have a black background. * * @return The "Darkness" theme. */ public static ChartTheme createDarknessTheme() { StandardChartTheme theme = new StandardChartTheme("Darkness"); theme.titlePaint = Color.white; theme.subtitlePaint = Color.white; theme.legendBackgroundPaint = Color.black; theme.legendItemPaint = Color.white; theme.chartBackgroundPaint = Color.black; theme.plotBackgroundPaint = Color.black; theme.plotOutlinePaint = Color.yellow; theme.baselinePaint = Color.white; theme.crosshairPaint = Color.red; theme.labelLinkPaint = Color.lightGray; theme.tickLabelPaint = Color.white; theme.axisLabelPaint = Color.white; theme.shadowPaint = Color.darkGray; theme.itemLabelPaint = Color.white; theme.drawingSupplier = new DefaultDrawingSupplier( new Paint[] {Color.decode("0xFFFF00"), Color.decode("0x0036CC"), Color.decode("0xFF0000"), Color.decode("0xFFFF7F"), Color.decode("0x6681CC"), Color.decode("0xFF7F7F"), Color.decode("0xFFFFBF"), Color.decode("0x99A6CC"), Color.decode("0xFFBFBF"), Color.decode("0xA9A938"), Color.decode("0x2D4587")}, new Paint[] {Color.decode("0xFFFF00"), Color.decode("0x0036CC")}, new Stroke[] {new BasicStroke(2.0f)}, new Stroke[] {new BasicStroke(0.5f)}, DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE); theme.wallPaint = Color.darkGray; theme.errorIndicatorPaint = Color.lightGray; theme.gridBandPaint = new Color(255, 255, 255, 20); theme.gridBandAlternatePaint = new Color(255, 255, 255, 40); theme.shadowGenerator = null; return theme; }
/** * Creates a new default instance. * * @param name the name of the theme (<code>null</code> not permitted). * @param shadow a flag that controls whether a shadow generator is * included. * * @since 1.0.14 */ public StandardChartTheme(String name, boolean shadow) { ParamChecks.nullNotPermitted(name, "name"); this.name = name; this.extraLargeFont = new Font("Tahoma", Font.BOLD, 20); this.largeFont = new Font("Tahoma", Font.BOLD, 14); this.regularFont = new Font("Tahoma", Font.PLAIN, 12); this.smallFont = new Font("Tahoma", Font.PLAIN, 10); this.titlePaint = Color.black; this.subtitlePaint = Color.black; this.legendBackgroundPaint = Color.white; this.legendItemPaint = Color.darkGray; this.chartBackgroundPaint = Color.white; this.drawingSupplier = new DefaultDrawingSupplier(); this.plotBackgroundPaint = Color.lightGray; this.plotOutlinePaint = Color.black; this.labelLinkPaint = Color.black; this.labelLinkStyle = PieLabelLinkStyle.CUBIC_CURVE; this.axisOffset = new RectangleInsets(4, 4, 4, 4); this.domainGridlinePaint = Color.white; this.rangeGridlinePaint = Color.white; this.baselinePaint = Color.black; this.crosshairPaint = Color.blue; this.axisLabelPaint = Color.darkGray; this.tickLabelPaint = Color.darkGray; this.barPainter = new GradientBarPainter(); this.xyBarPainter = new GradientXYBarPainter(); this.shadowVisible = false; this.shadowPaint = Color.gray; this.itemLabelPaint = Color.black; this.thermometerPaint = Color.white; this.wallPaint = BarRenderer3D.DEFAULT_WALL_PAINT; this.errorIndicatorPaint = Color.black; this.shadowGenerator = shadow ? new DefaultShadowGenerator() : null; }
/** * Creates and returns a theme called "Darkness". In this theme, the * charts have a black background. * * @return The "Darkness" theme. */ public static ChartTheme createDarknessTheme() { StandardChartTheme theme = new StandardChartTheme("Darkness"); theme.titlePaint = Color.WHITE; theme.subtitlePaint = Color.WHITE; theme.legendBackgroundPaint = Color.BLACK; theme.legendItemPaint = Color.WHITE; theme.chartBackgroundPaint = Color.BLACK; theme.plotBackgroundPaint = Color.BLACK; theme.plotOutlinePaint = Color.YELLOW; theme.baselinePaint = Color.WHITE; theme.crosshairPaint = Color.RED; theme.labelLinkPaint = Color.LIGHT_GRAY; theme.tickLabelPaint = Color.WHITE; theme.axisLabelPaint = Color.WHITE; theme.shadowPaint = Color.DARK_GRAY; theme.itemLabelPaint = Color.WHITE; theme.drawingSupplier = new DefaultDrawingSupplier( new Paint[] {Color.decode("0xFFFF00"), Color.decode("0x0036CC"), Color.decode("0xFF0000"), Color.decode("0xFFFF7F"), Color.decode("0x6681CC"), Color.decode("0xFF7F7F"), Color.decode("0xFFFFBF"), Color.decode("0x99A6CC"), Color.decode("0xFFBFBF"), Color.decode("0xA9A938"), Color.decode("0x2D4587")}, new Paint[] {Color.decode("0xFFFF00"), Color.decode("0x0036CC")}, new Stroke[] {new BasicStroke(2.0f)}, new Stroke[] {new BasicStroke(0.5f)}, DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE); theme.errorIndicatorPaint = Color.LIGHT_GRAY; theme.gridBandPaint = new Color(255, 255, 255, 20); theme.gridBandAlternatePaint = new Color(255, 255, 255, 40); theme.shadowGenerator = null; return theme; }
/** * Creates a new default instance. * * @param name the name of the theme ({@code null} not permitted). * @param shadow a flag that controls whether a shadow generator is * included. * * @since 1.0.14 */ public StandardChartTheme(String name, boolean shadow) { Args.nullNotPermitted(name, "name"); this.name = name; this.extraLargeFont = new Font("Tahoma", Font.BOLD, 20); this.largeFont = new Font("Tahoma", Font.BOLD, 14); this.regularFont = new Font("Tahoma", Font.PLAIN, 12); this.smallFont = new Font("Tahoma", Font.PLAIN, 10); this.titlePaint = Color.BLACK; this.subtitlePaint = Color.BLACK; this.legendBackgroundPaint = Color.WHITE; this.legendItemPaint = Color.DARK_GRAY; this.chartBackgroundPaint = Color.WHITE; this.drawingSupplier = new DefaultDrawingSupplier(); this.plotBackgroundPaint = Color.LIGHT_GRAY; this.plotOutlinePaint = Color.BLACK; this.labelLinkPaint = Color.BLACK; this.labelLinkStyle = PieLabelLinkStyle.CUBIC_CURVE; this.axisOffset = new RectangleInsets(4, 4, 4, 4); this.domainGridlinePaint = Color.WHITE; this.rangeGridlinePaint = Color.WHITE; this.baselinePaint = Color.BLACK; this.crosshairPaint = Color.BLUE; this.axisLabelPaint = Color.DARK_GRAY; this.tickLabelPaint = Color.DARK_GRAY; this.barPainter = new GradientBarPainter(); this.xyBarPainter = new GradientXYBarPainter(); this.shadowVisible = false; this.shadowPaint = Color.GRAY; this.itemLabelPaint = Color.BLACK; this.thermometerPaint = Color.WHITE; this.errorIndicatorPaint = Color.BLACK; this.shadowGenerator = shadow ? new DefaultShadowGenerator() : null; }
protected void populateSeriesColors(Paint[] colors, Paint[] colorSequence) { if (colors != null) { int size = colorSequence != null ? colorSequence.length : 0; System.arraycopy(colorSequence, 0, colors, 0, colorSequence.length); System.arraycopy(DefaultDrawingSupplier.DEFAULT_PAINT_SEQUENCE, 0, colors, size, DefaultDrawingSupplier.DEFAULT_PAINT_SEQUENCE.length); } }
protected Stroke[] getStrokeSequence(PlotSettings plotSettings) { List<Stroke> strokeSequenceList = plotSettings.getSeriesStrokeSequence(); Stroke[] strokeSequence = null; if (strokeSequenceList != null && !strokeSequenceList.isEmpty()) { strokeSequence = strokeSequenceList.toArray(new Stroke[strokeSequenceList.size()]); } else { strokeSequence = DefaultDrawingSupplier.DEFAULT_STROKE_SEQUENCE; } return strokeSequence; }
protected Stroke[] getOutlineStrokeSequence(PlotSettings plotSettings) { List<Stroke> outlineStrokeSequenceList = getChartThemeSettings().getPlotSettings().getSeriesOutlineStrokeSequence(); Stroke[] outlineStrokeSequence = null; if (outlineStrokeSequenceList != null && !outlineStrokeSequenceList.isEmpty()) { outlineStrokeSequence = outlineStrokeSequenceList.toArray(new Stroke[outlineStrokeSequenceList.size()]); } else { outlineStrokeSequence = DefaultDrawingSupplier.DEFAULT_OUTLINE_STROKE_SEQUENCE; } return outlineStrokeSequence; }