List of usage examples for org.jfree.chart.axis ValueAxis setLabelPaint
public void setLabelPaint(Paint paint)
From source file:net.relet.freimap.LinkInfo.java
private void sexupAxis(ValueAxis axis) { axis.setLabelFont(VisorFrame.smallerfont); axis.setLabelPaint(VisorFrame.fgcolor2); axis.setTickLabelFont(VisorFrame.smallerfont); axis.setTickLabelPaint(VisorFrame.fgcolor2); }
From source file:com.wattzap.view.graphs.MMPGraph.java
public MMPGraph(XYSeries series) { super();//from w w w .j a v a2 s . c om NumberAxis yAxis = new NumberAxis(userPrefs.messages.getString("poWtt")); yAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); double maxY = series.getMaxY(); yAxis.setRange(0, maxY + 20); yAxis.setTickLabelPaint(Color.white); yAxis.setLabelPaint(Color.white); LogAxis xAxis = new LogAxis(userPrefs.messages.getString("time")); xAxis.setTickLabelPaint(Color.white); xAxis.setBase(4); xAxis.setAutoRange(false); xAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); xAxis.setRange(1, series.getMaxX() + 500); xAxis.setNumberFormatOverride(new NumberFormat() { @Override public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) { long millis = (long) number * 1000; if (millis >= 60000) { return new StringBuffer(String.format("%d m %d s", TimeUnit.MILLISECONDS.toMinutes((long) millis), TimeUnit.MILLISECONDS.toSeconds((long) millis) - TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes((long) millis)))); } else { return new StringBuffer(String.format("%d s", TimeUnit.MILLISECONDS.toSeconds((long) millis) - TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes((long) millis)))); } } @Override public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos) { return new StringBuffer(String.format("%s", number)); } @Override public Number parse(String source, ParsePosition parsePosition) { return null; } }); XYPlot plot = new XYPlot(new XYSeriesCollection(series), xAxis, yAxis, new XYLineAndShapeRenderer(true, false)); JFreeChart chart = new JFreeChart("", JFreeChart.DEFAULT_TITLE_FONT, plot, false); chart.setBackgroundPaint(Color.gray); plot = chart.getXYPlot(); plot.setBackgroundPaint(Color.darkGray); /*plot.setDomainGridlinePaint(Color.lightGray); plot.setRangeGridlinePaint(Color.lightGray);*/ ValueAxis domainAxis = plot.getDomainAxis(); domainAxis.setTickLabelPaint(Color.white); domainAxis.setLabelPaint(Color.white); chartPanel = new ChartPanel(chart); chartPanel.setSize(100, 800); chartPanel.setFillZoomRectangle(true); chartPanel.setMouseWheelEnabled(true); chartPanel.setBackground(Color.gray); setLayout(new BorderLayout()); add(chartPanel, BorderLayout.CENTER); setBackground(Color.black); chartPanel.revalidate(); setVisible(true); }
From source file:com.wattzap.view.Profile.java
@Override public void callback(Messages message, Object o) { double distance = 0.0; switch (message) { case SPEED:/* w ww . j a v a 2 s . c om*/ Telemetry t = (Telemetry) o; distance = t.getDistanceKM(); break; case STARTPOS: distance = (Double) o; break; case CLOSE: if (this.isVisible()) { remove(chartPanel); setVisible(false); revalidate(); } return; case GPXLOAD: // Note if we are loading a Power Profile there is no GPX data so we don't show the chart panel RouteReader routeData = (RouteReader) o; if (chartPanel != null) { remove(chartPanel); if (routeData.routeType() == RouteReader.POWER) { setVisible(false); chartPanel.revalidate(); return; } } else if (routeData.routeType() == RouteReader.POWER) { return; } logger.debug("Load " + routeData.getFilename()); XYDataset xyDataset = new XYSeriesCollection(routeData.getSeries()); // create the chart... final JFreeChart chart = ChartFactory.createXYAreaChart(routeData.getName(), // chart // title userPrefs.messages.getString("distancekm"), // domain axis label userPrefs.messages.getString("heightMeters"), // range axis label xyDataset, // data PlotOrientation.VERTICAL, // orientation false, // include legend false, // tooltips false // urls ); chart.setBackgroundPaint(Color.darkGray); plot = chart.getXYPlot(); // plot.setForegroundAlpha(0.85f); plot.setBackgroundPaint(Color.white); plot.setDomainGridlinePaint(Color.lightGray); plot.setRangeGridlinePaint(Color.lightGray); ValueAxis rangeAxis = plot.getRangeAxis(); rangeAxis.setTickLabelPaint(Color.white); rangeAxis.setLabelPaint(Color.white); ValueAxis domainAxis = plot.getDomainAxis(); domainAxis.setTickLabelPaint(Color.white); domainAxis.setLabelPaint(Color.white); double minY = routeData.getSeries().getMinY(); double maxY = routeData.getSeries().getMaxY(); rangeAxis.setRange(minY - 100.0, maxY + 100.0); chartPanel = new ChartPanel(chart); chartPanel.setSize(100, 800); setLayout(new BorderLayout()); add(chartPanel, BorderLayout.CENTER); setBackground(Color.black); chartPanel.revalidate(); setVisible(true); break; }// switch if (plot == null) { return; } if (marker != null) { plot.removeDomainMarker(marker); } marker = new ValueMarker(distance); marker.setPaint(Color.blue); BasicStroke stroke = new BasicStroke(2); marker.setStroke(stroke); plot.addDomainMarker(marker); }
From source file:com.xilinx.ultrascale.gui.DMABarChart.java
private void makeChart() { dataset = new DefaultCategoryDataset(); chart = ChartFactory.createBarChart("", "Time Interval", "Throughput (Gbps)", dataset, PlotOrientation.VERTICAL, true, true, false); chart.setBackgroundPaint(bg);//from www .j a va2 s . co m TextTitle ttitle = new TextTitle(title, new Font(title, Font.BOLD, 15)); ttitle.setPaint(Color.WHITE); chart.setTitle(ttitle); CategoryPlot plot = chart.getCategoryPlot(); BarRenderer renderer = (BarRenderer) plot.getRenderer(); renderer.setDrawBarOutline(false); ValueAxis axis = plot.getRangeAxis(); axis.setUpperBound(64.0); axis.setLowerBound(0.0); axis.setTickLabelPaint(new Color(185, 185, 185)); axis.setLabelPaint(new Color(185, 185, 185)); CategoryAxis caxis = plot.getDomainAxis(); caxis.setTickLabelPaint(new Color(185, 185, 185)); caxis.setLabelPaint(new Color(185, 185, 185)); renderer.setItemMargin(0); renderer.setSeriesPaint(0, new Color(0x2e, 0x90, 0x18));//(0x17, 0x7b, 0x7c)); renderer.setSeriesPaint(1, new Color(0x12, 0x45, 0x73));//(0xa2, 0x45, 0x73) renderer.setSeriesPaint(3, new Color(0xff, 0x80, 0x40)); renderer.setSeriesPaint(2, new Color(0x6f, 0x2c, 0x85)); renderer.setSeriesPaint(4, new Color(0xa1, 0x60, 0x98)); renderer.setBaseToolTipGenerator( new StandardCategoryToolTipGenerator("{0}:{2}", new DecimalFormat("0.000"))); //renderer.setMaximumBarWidth(0.05); // addDummy(); }
From source file:com.xilinx.ultrascale.gui.BarChartsEth.java
License:asdf
private void makeChart(String name) { dataset = new DefaultCategoryDataset(); // chart = ChartFactory.createLineChart("", "", name, dataset, PlotOrientation.VERTICAL, true, true, false); // chart = ChartFactory.createBarChart("asd", "asd", "asdffa", dataset, PlotOrientation.HORIZONTAL, true, true, false); chart = ChartFactory.createBarChart("power", "Time Interval", "Throughput (Gbps)", dataset, PlotOrientation.VERTICAL, true, true, false); chart.setBackgroundPaint(bg);// w w w . j a va 2 s.c o m TextTitle ttitle = new TextTitle(title, new Font(title, Font.BOLD, 15)); ttitle.setPaint(Color.BLACK); chart.setTitle(ttitle); CategoryPlot plot = chart.getCategoryPlot(); // BarRenderer renderer = (BarRenderer)plot.getRenderer(); BarRenderer renderer = (BarRenderer) plot.getRenderer(); renderer.setDrawBarOutline(false); ValueAxis axis = plot.getRangeAxis(); upperBounds(65); axis.setTickLabelPaint(new Color(0, 0, 0));//(185, 185, 185) axis.setLabelPaint(new Color(0, 0, 0)); CategoryAxis caxis = plot.getDomainAxis(); caxis.setTickLabelPaint(new Color(0, 0, 0)); caxis.setLabelPaint(new Color(0, 0, 0)); renderer.setItemMargin(0); renderer.setSeriesPaint(0, new Color(0x2e, 0x90, 0x18));//(0x17, 0x7b, 0x7c)); renderer.setSeriesPaint(1, new Color(0x12, 0x45, 0x73));//(0xa2, 0x45, 0x73) renderer.setSeriesPaint(3, new Color(0xff, 0x80, 0x40)); renderer.setSeriesPaint(2, new Color(0x6f, 0x2c, 0x85)); // renderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator("{0}:{2}", new DecimalFormat("0.000"))); //renderer.setMaximumBarWidth(0.05); addDummy(); }
From source file:com.xilinx.kintex7.DMABarChart.java
private void makeChart() { dataset = new DefaultCategoryDataset(); chart = ChartFactory.createBarChart("", "Time Interval", "Throughput (Gbps)", dataset, PlotOrientation.VERTICAL, true, true, false); chart.setBackgroundPaint(bg);//from ww w . j ava 2 s. c o m TextTitle ttitle = new TextTitle(title, new Font(title, Font.BOLD, 15)); ttitle.setPaint(Color.WHITE); chart.setTitle(ttitle); CategoryPlot plot = chart.getCategoryPlot(); BarRenderer renderer = (BarRenderer) plot.getRenderer(); renderer.setDrawBarOutline(false); ValueAxis axis = plot.getRangeAxis(); axis.setUpperBound(30.0); axis.setLowerBound(0.0); axis.setTickLabelPaint(new Color(185, 185, 185)); axis.setLabelPaint(new Color(185, 185, 185)); CategoryAxis caxis = plot.getDomainAxis(); caxis.setTickLabelPaint(new Color(185, 185, 185)); caxis.setLabelPaint(new Color(185, 185, 185)); renderer.setItemMargin(0); renderer.setSeriesPaint(0, new Color(0, 0, 0x80)); renderer.setSeriesPaint(1, new Color(0, 0x80, 0xff)); renderer.setSeriesPaint(2, new Color(0xa2, 0x45, 0x73)); renderer.setBaseToolTipGenerator( new StandardCategoryToolTipGenerator("{0}:{2}", new DecimalFormat("0.000"))); //renderer.setMaximumBarWidth(0.05); addDummy(); }
From source file:com.xilinx.ultrascale.gui.BarCharts.java
License:asdf
private void makeChart(String name) { dataset = new DefaultCategoryDataset(); // chart = ChartFactory.createLineChart("", "", name, dataset, PlotOrientation.VERTICAL, true, true, false); // chart = ChartFactory.createBarChart("asd", "asd", "asdffa", dataset, PlotOrientation.HORIZONTAL, true, true, false); chart = ChartFactory.createBarChart("power", "Time Interval", "Throughput (Gbps)", dataset, PlotOrientation.VERTICAL, true, true, false); chart.setBackgroundPaint(bg);//from w w w . j av a2 s. c o m TextTitle ttitle = new TextTitle(title, new Font(title, Font.BOLD, 15)); ttitle.setPaint(Color.BLACK); chart.setTitle(ttitle); CategoryPlot plot = chart.getCategoryPlot(); // BarRenderer renderer = (BarRenderer)plot.getRenderer(); BarRenderer renderer = (BarRenderer) plot.getRenderer(); renderer.setDrawBarOutline(false); ValueAxis axis = plot.getRangeAxis(); upperBounds(65); axis.setTickLabelPaint(new Color(0, 0, 0));//(185, 185, 185) axis.setLabelPaint(new Color(0, 0, 0)); CategoryAxis caxis = plot.getDomainAxis(); caxis.setTickLabelPaint(new Color(0, 0, 0)); caxis.setLabelPaint(new Color(0, 0, 0)); renderer.setItemMargin(0); renderer.setSeriesPaint(0, new Color(0x2e, 0x90, 0x18));//(0x17, 0x7b, 0x7c)); renderer.setSeriesPaint(1, new Color(0x12, 0x45, 0x73));//(0xa2, 0x45, 0x73) renderer.setSeriesPaint(3, new Color(0xff, 0x80, 0x40)); renderer.setSeriesPaint(2, new Color(0x6f, 0x2c, 0x85)); // renderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator("{0}:{2}", new DecimalFormat("0.000"))); //renderer.setMaximumBarWidth(0.05); addDummy(); }
From source file:com.xilinx.virtex7.DMABarChart.java
private void makeChart() { dataset = new DefaultCategoryDataset(); chart = ChartFactory.createBarChart("", "Time Interval", "Throughput (Gbps)", dataset, PlotOrientation.VERTICAL, true, true, false); chart.setBackgroundPaint(bg);/*from w ww . j av a 2s .c o m*/ TextTitle ttitle = new TextTitle(title, new Font(title, Font.BOLD, 15)); ttitle.setPaint(Color.WHITE); chart.setTitle(ttitle); CategoryPlot plot = chart.getCategoryPlot(); BarRenderer renderer = (BarRenderer) plot.getRenderer(); renderer.setDrawBarOutline(false); ValueAxis axis = plot.getRangeAxis(); axis.setUpperBound(64.0); axis.setLowerBound(0.0); axis.setTickLabelPaint(new Color(185, 185, 185)); axis.setLabelPaint(new Color(185, 185, 185)); CategoryAxis caxis = plot.getDomainAxis(); caxis.setTickLabelPaint(new Color(185, 185, 185)); caxis.setLabelPaint(new Color(185, 185, 185)); renderer.setItemMargin(0); renderer.setSeriesPaint(0, new Color(0, 0, 0x80)); renderer.setSeriesPaint(1, new Color(0, 0x80, 0xff)); renderer.setSeriesPaint(2, new Color(0xa2, 0x45, 0x73)); renderer.setSeriesPaint(3, new Color(0x40, 0xa1, 0xff)); renderer.setSeriesPaint(4, new Color(0xa1, 0x60, 0x98)); renderer.setBaseToolTipGenerator( new StandardCategoryToolTipGenerator("{0}:{2}", new DecimalFormat("0.000"))); //renderer.setMaximumBarWidth(0.05); addDummy(); }
From source file:org.n52.io.img.ChartRenderer.java
private void configureDomainAxis(XYPlot xyPlot) { ValueAxis domainAxis = xyPlot.getDomainAxis(); domainAxis.setTickLabelFont(FONT_LABEL); domainAxis.setLabelFont(FONT_LABEL); domainAxis.setTickLabelPaint(COLOR); domainAxis.setLabelPaint(COLOR); }
From source file:imageviewer.tools.HistogramTool.java
public void plot(MouseEvent e) { if (e.getSource() instanceof ImagePanel) { Image image = ((ImagePanel) e.getSource()).getSource(); Histogram h = image.getHistogram(); SimpleHistogramDataset shd = new SimpleHistogramDataset("Voxel distribution"); for (int i = 0, numBands = h.getNumBands(); i < numBands; i++) { int[] binData = h.getBins(i); for (int j = 0; j < binData.length; j++) { SimpleHistogramBin shb = new SimpleHistogramBin(j - 0.5, j + 0.5, true, false); shb.setItemCount(binData[j]); shd.addBin(shb);//from w ww . ja va 2s. com } } double[] domainBounds = null, rangeBounds = null; if (chart != null) { ValueAxis va = chart.getXYPlot().getDomainAxis(); domainBounds = new double[] { va.getLowerBound(), va.getUpperBound() }; va = chart.getXYPlot().getRangeAxis(); rangeBounds = new double[] { va.getLowerBound(), va.getUpperBound() }; } chart = ChartFactory.createHistogram(null, "Voxel value", "Count", shd, PlotOrientation.VERTICAL, false, true, false); chart.setBackgroundPaint(new Color(20, 30, 45)); chart.setAntiAlias(true); ValueAxis domainAxis = chart.getXYPlot().getDomainAxis(); domainAxis.setLabelFont(axisFont); domainAxis.setTickLabelFont(tickFont); domainAxis.setAxisLinePaint(Color.white); domainAxis.setTickLabelPaint(Color.white); domainAxis.setLabelPaint(Color.white); if (domainBounds != null) { domainAxis.setAutoRange(false); domainAxis.setLowerBound(domainBounds[0]); domainAxis.setUpperBound(domainBounds[1]); } else { domainAxis.setLowerBound(0); } ValueAxis rangeAxis = chart.getXYPlot().getRangeAxis(); rangeAxis.setLabelFont(axisFont); rangeAxis.setTickLabelFont(tickFont); rangeAxis.setAxisLinePaint(Color.white); rangeAxis.setTickLabelPaint(Color.white); rangeAxis.setLabelPaint(Color.white); if (rangeBounds != null) { rangeAxis.setAutoRange(false); rangeAxis.setLowerBound(rangeBounds[0]); rangeAxis.setUpperBound(rangeBounds[1]); } chart.getXYPlot().getRenderer().setSeriesPaint(0, new Color(0, 51, 113)); ((XYBarRenderer) chart.getXYPlot().getRenderer()).setDrawBarOutline(false); chart.getXYPlot().setBackgroundAlpha(0.05f); double[] mean = h.getMean(); double[] sd = h.getStandardDeviation(); IntervalMarker im = new IntervalMarker(mean[0] - sd[0] / 2, mean[0] + sd[0] / 2); im.setPaint(new Color(200, 200, 200, 128)); chart.getXYPlot().addDomainMarker(0, im, Layer.BACKGROUND); cp.setChart(chart); } }