Example usage for org.jfree.chart.plot CategoryPlot setRangeMinorGridlinePaint

List of usage examples for org.jfree.chart.plot CategoryPlot setRangeMinorGridlinePaint

Introduction

In this page you can find the example usage for org.jfree.chart.plot CategoryPlot setRangeMinorGridlinePaint.

Prototype

public void setRangeMinorGridlinePaint(Paint paint) 

Source Link

Document

Sets the paint for the minor grid lines plotted against the range axis and sends a PlotChangeEvent to all registered listeners.

Usage

From source file:org.pau.assetmanager.viewmodel.chart.PrepareChart.java

public static void prepareJFreeBarChartForStocks(JFreeChart jfchart, CategoryDataset categoryModel) {

    CategoryPlot categoryPlot = ((CategoryPlot) jfchart.getPlot());
    categoryPlot.getRangeAxis().resizeRange(1.2);
    categoryPlot.setBackgroundPaint(Color.WHITE);
    categoryPlot.setDomainGridlinePaint(Color.WHITE);
    categoryPlot.setRangeMinorGridlinePaint(Color.WHITE);
    categoryPlot.setRangeGridlinePaint(Color.BLACK);
    BarRenderer renderer = (BarRenderer) categoryPlot.getRenderer();

    renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());

    renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator("{2} {1} ",
            NumberFomatter.PERCENTAGE_FORMATTER, NumberFormat.getPercentInstance()));
    renderer.setBaseItemLabelsVisible(true);
    renderer.setBaseItemLabelFont(new Font("Serif", Font.PLAIN, 12));
    renderer.setItemLabelAnchorOffset(15);

    renderer.setDrawBarOutline(false);//www . j  a v  a2  s .c  om
    renderer.setShadowVisible(false);
    renderer.setItemMargin(.1);
    renderer.setBarPainter(new StandardBarPainter());

}

From source file:org.pau.assetmanager.viewmodel.chart.PrepareChart.java

public static void prepareSimpleJFreeChart(JFreeChart jfchart) {

    CategoryPlot categoryPlot = ((CategoryPlot) jfchart.getPlot());
    categoryPlot.getRangeAxis().resizeRange(1.2);
    categoryPlot.setBackgroundPaint(Color.WHITE);
    categoryPlot.setDomainGridlinePaint(Color.WHITE);
    categoryPlot.setRangeMinorGridlinePaint(Color.WHITE);
    categoryPlot.setRangeGridlinePaint(Color.BLACK);
    LineAndShapeRenderer renderer = (LineAndShapeRenderer) categoryPlot.getRenderer();

    renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());
    renderer.setBaseItemLabelsVisible(true);

    commonPrepareJFreeChart(renderer);/*w  ww. j  ava  2  s .  com*/

    renderer.setSeriesPaint(0, new Color(0xB3, 0xBE, 0xFF));
    renderer.setSeriesPaint(1, new Color(0xFF, 0xB3, 0xB3));
    renderer.setSeriesPaint(2, new Color(0x61, 0x9E, 0x42));
    renderer.setSeriesPaint(3, Color.black);

    renderer.setSeriesItemLabelPaint(0, new Color(0x21, 0x21, 0xFF));
    renderer.setSeriesItemLabelPaint(1, new Color(0xFF, 0x36, 0x36));
    renderer.setSeriesItemLabelPaint(2, new Color(0x61, 0x9E, 0x42));
    renderer.setSeriesItemLabelPaint(3, Color.black);

}

From source file:org.pau.assetmanager.viewmodel.chart.PrepareChart.java

public static void prepareJFreeBarChart(JFreeChart jfchart, List<PropertyBook> listOfPropertties,
        CategoryDataset categoryModel) {

    CategoryPlot categoryPlot = ((CategoryPlot) jfchart.getPlot());
    categoryPlot.getRangeAxis().resizeRange(1.2);
    categoryPlot.setBackgroundPaint(Color.WHITE);
    categoryPlot.setDomainGridlinePaint(Color.WHITE);
    categoryPlot.setRangeMinorGridlinePaint(Color.WHITE);
    categoryPlot.setRangeGridlinePaint(Color.BLACK);
    BarRenderer renderer = (BarRenderer) categoryPlot.getRenderer();

    renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());
    renderer.setBaseItemLabelsVisible(false);
    for (int i = 0; i < listOfPropertties.size(); i++) {
        renderer.setSeriesStroke(i, new BasicStroke(1));
    }//from   w  w w  .  ja v a  2  s . c o  m
    for (int i = 0; i < categoryModel.getColumnKeys().size(); i++) {
        String label = (String) categoryModel.getColumnKey(i);
        CategoryMarker marker = new CategoryMarker(label);
        marker.setLabel("");
        marker.setPaint(Color.cyan);
        marker.setOutlinePaint(Color.cyan);
        marker.setAlpha(0.1f);
        marker.setLabelAnchor(RectangleAnchor.TOP);
        marker.setLabelTextAnchor(TextAnchor.TOP_CENTER);
        marker.setLabelOffsetType(LengthAdjustmentType.CONTRACT);
        categoryPlot.addDomainMarker(marker, Layer.BACKGROUND);
    }
    renderer.setDrawBarOutline(false);
    renderer.setShadowVisible(false);
    renderer.setItemMargin(.1);
    renderer.setBarPainter(new StandardBarPainter());

}

From source file:org.pau.assetmanager.viewmodel.chart.PrepareChart.java

public static void preparePropertiesVsOwnAllPropertiesJFreeChart(JFreeChart jfchart,
        CategoryDataset categoryModel) {

    CategoryPlot categoryPlot = ((CategoryPlot) jfchart.getPlot());
    categoryPlot.getRangeAxis().resizeRange(1.2);
    categoryPlot.setBackgroundPaint(Color.WHITE);
    categoryPlot.setDomainGridlinePaint(Color.WHITE);
    categoryPlot.setRangeMinorGridlinePaint(Color.WHITE);
    categoryPlot.setRangeGridlinePaint(Color.BLACK);
    BarRenderer renderer = (BarRenderer) categoryPlot.getRenderer();

    renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());
    renderer.setBaseItemLabelsVisible(true);

    renderer.setBaseItemLabelFont(new Font("Serif", Font.PLAIN, 10));
    renderer.setItemLabelAnchorOffset(15);

    renderer.setSeriesStroke(0, new BasicStroke(1));
    renderer.setSeriesStroke(1, new BasicStroke(1));
    renderer.setSeriesStroke(2, new BasicStroke(1));
    renderer.setSeriesStroke(3, new BasicStroke(1));
    renderer.setSeriesStroke(4, new BasicStroke(1));
    renderer.setSeriesStroke(5, new BasicStroke(1));
    renderer.setSeriesPaint(0, new Color(0x77, 0x77, 0xFF));
    renderer.setSeriesPaint(1, new Color(0xCC, 0xCC, 0xFF));
    renderer.setSeriesPaint(2, new Color(0x00, 0x00, 0xFF));
    renderer.setSeriesPaint(3, new Color(0xFF, 0x77, 0x77));
    renderer.setSeriesPaint(4, new Color(0xFF, 0xCC, 0xCC));
    renderer.setSeriesPaint(5, new Color(0xFF, 0x00, 0x00));
    for (int i = 0; i < categoryModel.getColumnKeys().size(); i++) {
        String label = (String) categoryModel.getColumnKey(i);
        CategoryMarker marker = new CategoryMarker(label);
        marker.setLabel("");
        marker.setPaint(Color.cyan);
        marker.setOutlinePaint(Color.cyan);
        marker.setAlpha(0.1f);//from  w w w  .ja  v  a2s .  co m
        marker.setLabelAnchor(RectangleAnchor.TOP);
        marker.setLabelTextAnchor(TextAnchor.TOP_CENTER);
        marker.setLabelOffsetType(LengthAdjustmentType.CONTRACT);
        categoryPlot.addDomainMarker(marker, Layer.BACKGROUND);
    }
    renderer.setDrawBarOutline(false);
    renderer.setShadowVisible(false);
    renderer.setItemMargin(.1);
    renderer.setBarPainter(new StandardBarPainter());
    renderer.setBasePositiveItemLabelPosition(
            new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.TOP_RIGHT));
    renderer.setBaseNegativeItemLabelPosition(
            new ItemLabelPosition(ItemLabelAnchor.OUTSIDE6, TextAnchor.BOTTOM_RIGHT));
}

From source file:org.pau.assetmanager.viewmodel.chart.PrepareChart.java

public static void prepareBalanceChart(JFreeChart jfchart) {

    CategoryPlot categoryPlot = ((CategoryPlot) jfchart.getPlot());
    NumberAxis numberAxis = (NumberAxis) categoryPlot.getRangeAxis();
    numberAxis.setAutoRange(true);//from   w  ww  .j av  a  2s  . co  m
    numberAxis.setAutoRangeIncludesZero(false);
    categoryPlot.setBackgroundPaint(Color.WHITE);
    categoryPlot.setDomainGridlinePaint(Color.WHITE);
    categoryPlot.setRangeMinorGridlinePaint(Color.WHITE);
    categoryPlot.setRangeGridlinePaint(Color.BLACK);
    LineAndShapeRenderer renderer = (LineAndShapeRenderer) categoryPlot.getRenderer();

    renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());
    renderer.setBaseItemLabelsVisible(true);

    commonPrepareJFreeChart(renderer);

    renderer.setSeriesPaint(0, Color.black);

    renderer.setSeriesItemLabelPaint(0, Color.black);

}

From source file:srvclientmonitor.frmMain.java

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
    JPanel panel = new JPanel();
    getContentPane().add(panel);/* www  .  j a  v a2s. c  o  m*/
    DefaultCategoryDataset data = new DefaultCategoryDataset();
    //DefaultPieDataset data = new DefaultPieDataset();  //Para el Grafico PIE

    data.addValue(20, "OSP", "HOY");
    data.addValue(99, "ETL", "HOY");
    data.addValue(25, "LOR", "HOY");
    data.addValue(12, "MOV", "HOY");

    // Creando el Grafico
    //JFreeChart chart = ChartFactory.createPieChart(
    //JFreeChart chart = ChartFactory.createBarChart("Ejemplo Rapido de Grafico en un ChartFrame", "Mes", "Valor", data);

    JFreeChart chart = ChartFactory.createBarChart("", "", "", data, PlotOrientation.VERTICAL, false, false,
            false);
    chart.setBackgroundPaint(Color.BLACK);
    chart.setTitle("");

    CategoryPlot plot = (CategoryPlot) chart.getPlot();
    plot.setRangePannable(true);
    plot.setRangeGridlinesVisible(false);
    plot.setBackgroundAlpha(1);
    plot.setBackgroundPaint(Color.BLACK);
    plot.setForegroundAlpha(1);
    plot.setDomainCrosshairPaint(Color.WHITE);
    plot.setNoDataMessagePaint(Color.WHITE);
    plot.setOutlinePaint(Color.WHITE);
    plot.setRangeCrosshairPaint(Color.WHITE);
    plot.setRangeMinorGridlinePaint(Color.WHITE);
    plot.setRangeZeroBaselinePaint(Color.WHITE);

    //        Paint p = new GradientPaint(0, 0, Color.white, 1000, 0, Color.green);
    //        plot.setBackgroundPaint(p);

    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    rangeAxis.setLabelPaint(Color.WHITE);
    rangeAxis.setAxisLinePaint(Color.WHITE);
    rangeAxis.setTickLabelPaint(Color.WHITE);
    rangeAxis.setVerticalTickLabels(true);

    //ChartUtilities.applyCurrentTheme(chart);

    // Crear el Panel del Grafico con ChartPanel
    ChartPanel chartPanel = new ChartPanel(chart);
    chartPanel.setSize(300, 150);
    chartPanel.setBackground(Color.BLACK);
    chartPanel.setOpaque(false);
    chartPanel.setDomainZoomable(true);
    this.jPanel1.setSize(300, 200);
    this.jPanel1.setBackground(Color.DARK_GRAY);
    this.jPanel1.add(chartPanel);

}