List of usage examples for org.jfree.chart.axis CategoryAxis setTickLabelsVisible
public void setTickLabelsVisible(boolean flag)
From source file:com.jaxzin.iraf.demo.CdfInv.java
private static void customizeChart(JFreeChart chart) { // Set the transparency of the histogram bars chart.getCategoryPlot().setForegroundAlpha(0.5f); // Lock the y-axis to 0.0->0.5 ValueAxis axis = new NumberAxis("Value"); axis.setAutoRange(true);/* w ww .j a v a 2 s . c om*/ chart.getCategoryPlot().setRangeAxis(axis); // Lock the x-axis to -6.0->6.0 CategoryAxis domainAxis = new CategoryAxis("Probability"); domainAxis.setTickLabelsVisible(false); chart.getCategoryPlot().setDomainAxis(domainAxis); }
From source file:net.sf.jsfcomp.chartcreator.utils.ChartAxisUtils.java
public static void createCategorySeriesAxis(JFreeChart chart, ChartAxisData chartAxisData, int axisIndex) { CategoryPlot plot = chart.getCategoryPlot(); if (chartAxisData.isDomain()) { CategoryAxis axis = new CategoryAxis(chartAxisData.getLabel()); axis.setTickLabelsVisible(chartAxisData.isTickLabels()); axis.setTickMarksVisible(chartAxisData.isTickMarks()); if (chartAxisData.getTickLabelFontSize() > 0) { Font tickFont = CategoryAxis.DEFAULT_TICK_LABEL_FONT .deriveFont(chartAxisData.getTickLabelFontSize()); axis.setTickLabelFont(tickFont); }/* ww w.j av a 2s.c o m*/ if (chartAxisData.isVerticalTickLabels()) { axis.setCategoryLabelPositions(CategoryLabelPositions.UP_90); } plot.setDomainAxis(plot.getDomainAxisCount() - 1, axis); } else { ValueAxis axis = createNumberAxis(chart, chartAxisData); axis.setTickLabelsVisible(chartAxisData.isTickLabels()); axis.setTickMarksVisible(chartAxisData.isTickMarks()); if (chartAxisData.getTickLabelFontSize() > 0) { Font tickFont = CategoryAxis.DEFAULT_TICK_LABEL_FONT .deriveFont(chartAxisData.getTickLabelFontSize()); axis.setTickLabelFont(tickFont); } plot.setRangeAxis(axis); } }
From source file:jgnash.ui.budget.BudgetSparkline.java
public static Icon getSparklineImage(final List<BigDecimal> amounts) { DefaultCategoryDataset dataset = new DefaultCategoryDataset(); final boolean[] negate = new boolean[amounts.size()]; for (int i = 0; i < amounts.size(); i++) { dataset.addValue(amounts.get(i), CATEGORY, i); negate[i] = amounts.get(i).signum() == -1; }/*from w ww. j a v a 2s. c o m*/ CategoryAxis xAxis = new CategoryAxis(); xAxis.setTickLabelsVisible(false); xAxis.setTickMarksVisible(false); xAxis.setAxisLineVisible(false); xAxis.setVisible(false); NumberAxis yAxis = new NumberAxis(); yAxis.setTickLabelsVisible(false); yAxis.setTickMarksVisible(false); yAxis.setAxisLineVisible(false); yAxis.setNegativeArrowVisible(false); yAxis.setPositiveArrowVisible(false); yAxis.setAutoRangeIncludesZero(true); yAxis.setAutoRange(true); yAxis.setVisible(false); BarRenderer renderer = new BarRenderer() { @Override public Paint getItemPaint(final int row, final int column) { return negate[column] ? Color.RED : Color.BLACK; } }; renderer.setShadowVisible(false); renderer.setBarPainter(new StandardBarPainter()); CategoryPlot plot = new CategoryPlot(dataset, xAxis, yAxis, renderer); plot.setInsets(INSETS); plot.setDomainGridlinesVisible(false); plot.setDomainCrosshairVisible(false); plot.setRangeGridlinesVisible(false); plot.setRangeCrosshairVisible(false); plot.setBackgroundPaint(CLEAR); JFreeChart chart = new JFreeChart(null, JFreeChart.DEFAULT_TITLE_FONT, plot, false); chart.setBorderVisible(false); chart.setBackgroundPaint(CLEAR); Icon icon = EMPTY_ICON; try { byte[] image = ENCODER .encode(chart.createBufferedImage(DEFAULT_WIDTH, DEFAULT_HEIGHT, BufferedImage.BITMASK, null)); icon = new ImageIcon(image); } catch (IOException ex) { Logger.getLogger(BudgetSparkline.class.getName()).log(Level.SEVERE, null, ex); } return icon; }
From source file:storybook.ui.chart.jfreechart.ChartUtil.java
public static void hideDomainAxis(CategoryPlot paramCategoryPlot) { CategoryAxis localCategoryAxis = paramCategoryPlot.getDomainAxis(); localCategoryAxis.setTickMarksVisible(false); localCategoryAxis.setTickLabelsVisible(false); }
From source file:es.bsc.autonomic.powermodeller.graphics.TotalPowerVsPredictionDecomposed.java
private static JFreeChart createChart() { ///* ww w . jav a2s . c o m*/ DefaultCategoryDataset Pactual = jFreeChartDataSets.get(CoreConfiguration.PACTUAL_LABEL); DefaultCategoryDataset Ppredicted = jFreeChartDataSets.get(CoreConfiguration.PPREDICTED_LABEL); StandardCategoryItemLabelGenerator standardcategoryitemlabelgenerator = new StandardCategoryItemLabelGenerator(); LineAndShapeRenderer renderer1 = new LineAndShapeRenderer(); /*renderer1.setBaseItemLabelGenerator(standardcategoryitemlabelgenerator); renderer1.setBaseItemLabelsVisible(true);*/ StackedAreaRenderer renderer2 = new StackedAreaRenderer(); //plot CategoryPlot plot = new CategoryPlot(); plot.setDataset(Ppredicted); plot.setRenderer(renderer2); plot.setDataset(1, Pactual); plot.setRenderer(1, renderer1); CategoryAxis axis = new CategoryAxis("Sample"); axis.setTickLabelsVisible(false); axis.setCategoryMargin(0.0); plot.setDomainAxis(axis); //more rangeAxis plot.setRangeAxis(new NumberAxis("Power (Watts)")); plot.mapDatasetToRangeAxis(2, 1); // plot.setOrientation(PlotOrientation.VERTICAL); plot.setRangeGridlinesVisible(true); plot.setDomainGridlinesVisible(true); plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD); plot.getDomainAxis().setCategoryLabelPositions(CategoryLabelPositions.UP_45); //chart JFreeChart chart = new JFreeChart(plot); chart.setTitle(NAME); return chart; }
From source file:unikn.dbis.univis.visualization.chart.BarChart.java
/** * starts the Bar3DChart.//from w ww .j a v a 2 s . c o m */ public void plot() { CategoryPlot plot = (CategoryPlot) getChart().getPlot(); CategoryAxis axis = plot.getDomainAxis(); axis.setTickLabelsVisible(false); BarRenderer3D renderer = (BarRenderer3D) plot.getRenderer(); renderer.setDrawBarOutline(false); renderer.setLegendItemLabelGenerator(new LabelGenerator(createTotal())); plot.setNoDataMessage("No data available"); plot.getDomainAxis().setLabelFont(getLegendFont()); plot.getRangeAxis().setLabelFont(getLegendFont()); plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD); }
From source file:ch.unibe.iam.scg.archie.ui.charts.PatientsConsHistChart.java
/** * @see ch.unibe.iam.scg.archie.ui.charts.AbstractChartComposite#initializeChart() *///from w w w . j a v a 2 s.c om @Override protected JFreeChart initializeChart() { JFreeChart chart = ChartFactory.createStackedBarChart(PatientsConsHistChart.CHART_TITLE, "Costs of Consultations", // domain axis label "Patients", // range axis label (DefaultKeyedValues2DDataset) this.creator.getDataset(), // data PlotOrientation.HORIZONTAL, true, // include legend true, // tooltips false // urls ); // set tooltip renderer CategoryPlot plot = (CategoryPlot) chart.getPlot(); plot.getRenderer().setBaseToolTipGenerator(new HistogramTooltipGenerator()); // hide tick labels CategoryAxis axis = (CategoryAxis) plot.getDomainAxis(); axis.setTickLabelsVisible(false); // Set chart background color to it's parents background chart.setBackgroundPaint(new Color(this.parent.getBackground().getRed(), this.parent.getBackground().getGreen(), this.parent.getBackground().getBlue())); return chart; }
From source file:ch.unibe.iam.scg.archie.ui.charts.AgeHistogrammChart.java
/** * @see ch.unibe.iam.scg.archie.ui.charts.AbstractChartComposite#initializeChart() *//* w ww . j a va2 s .c o m*/ @Override protected JFreeChart initializeChart() { JFreeChart chart = ChartFactory.createStackedBarChart(AgeHistogrammChart.CHART_TITLE, "Age", // domain // axis // label "Patients", // range axis label (DefaultKeyedValues2DDataset) this.creator.getDataset(), // data PlotOrientation.HORIZONTAL, true, // include legend true, // tooltips false // urls ); // set tooltip renderer CategoryPlot plot = (CategoryPlot) chart.getPlot(); plot.getRenderer().setBaseToolTipGenerator(new HistogramTooltipGenerator()); // hide tick labels CategoryAxis axis = (CategoryAxis) plot.getDomainAxis(); axis.setTickLabelsVisible(false); // Set chart background color to it's parents background chart.setBackgroundPaint(new Color(this.parent.getBackground().getRed(), this.parent.getBackground().getGreen(), this.parent.getBackground().getBlue())); return chart; }
From source file:unikn.dbis.univis.visualization.chart.AreaChart.java
/** * Makes the plot./* w ww . jav a 2 s .com*/ */ protected void plot() { CategoryPlot plot = (CategoryPlot) getChart().getPlot(); CategoryAxis axis = plot.getDomainAxis(); plot.setForegroundAlpha(0.5f); axis.setTickLabelsVisible(false); plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD); AreaRenderer renderer = (AreaRenderer) plot.getRenderer(); renderer.setLegendItemLabelGenerator(new LabelGenerator(createTotal())); plot.setNoDataMessage("No data available"); plot.getDomainAxis().setLabelFont(getLegendFont()); plot.getRangeAxis().setLabelFont(getLegendFont()); }
From source file:com.rapidminer.gui.plotter.charts.BarChart2DPlotter.java
public JFreeChart createChart(CategoryDataset categoryDataSet, String groupByName, String valueName, boolean createLegend) { JFreeChart chart = ChartFactory.createBarChart(null, // chart title groupByName, // domain axis label valueName, // range axis label categoryDataSet, // data PlotOrientation.VERTICAL, // orientation ((createLegend) && (groupByName != null)), // include legend if group by column is set true, // tooltips false // URLs );// w w w .j a v a 2 s .c o m // get a reference to the plot for further customisation... CategoryPlot plot = (CategoryPlot) chart.getPlot(); plot.setBackgroundPaint(new Color(230, 230, 230)); plot.setDomainGridlinePaint(Color.white); plot.setDomainGridlinesVisible(true); plot.setRangeGridlinePaint(Color.white); // set up paints for series if (groupByName == null) { BarRenderer renderer = (BarRenderer) plot.getRenderer(); renderer.setSeriesPaint(0, SwingTools.LIGHT_BLUE); renderer.setSeriesPaint(1, SwingTools.LIGHT_YELLOW); } // domain axis labels CategoryAxis domainAxis = plot.getDomainAxis(); if (groupByName == null) { domainAxis.setTickLabelsVisible(true); domainAxis.setCategoryLabelPositions( CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 6.0)); } else { domainAxis.setTickLabelsVisible(false); } return chart; }