Example usage for org.jfree.chart.axis CategoryLabelPositions UP_90

List of usage examples for org.jfree.chart.axis CategoryLabelPositions UP_90

Introduction

In this page you can find the example usage for org.jfree.chart.axis CategoryLabelPositions UP_90.

Prototype

CategoryLabelPositions UP_90

To view the source code for org.jfree.chart.axis CategoryLabelPositions UP_90.

Click Source Link

Document

UP_90 category label positions.

Usage

From source file:org.jfree.chart.demo.ParetoChartDemo1.java

public static JFreeChart createChart(CategoryDataset acategorydataset[]) {
    JFreeChart jfreechart = ChartFactory.createBarChart("Freshmeat Software Projects", "Language", "Projects",
            acategorydataset[0], PlotOrientation.VERTICAL, true, true, false);
    jfreechart.addSubtitle(new TextTitle("By Programming Language"));
    jfreechart.addSubtitle(new TextTitle("As at 5 March 2003"));
    jfreechart.setBackgroundPaint(Color.white);
    CategoryPlot categoryplot = (CategoryPlot) jfreechart.getPlot();
    categoryplot.setBackgroundPaint(Color.lightGray);
    categoryplot.setRangeGridlinePaint(Color.white);
    CategoryAxis categoryaxis = categoryplot.getDomainAxis();
    categoryaxis.setLowerMargin(0.02D);/*from w w w .  ja  v  a2s. c  om*/
    categoryaxis.setUpperMargin(0.02D);
    categoryaxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90);
    NumberAxis numberaxis = (NumberAxis) categoryplot.getRangeAxis();
    numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    LineAndShapeRenderer lineandshaperenderer = new LineAndShapeRenderer();
    NumberAxis numberaxis1 = new NumberAxis("Percent");
    numberaxis1.setNumberFormatOverride(NumberFormat.getPercentInstance());
    categoryplot.setRangeAxis(1, numberaxis1);
    categoryplot.setDataset(1, acategorydataset[1]);
    categoryplot.setRenderer(1, lineandshaperenderer);
    categoryplot.mapDatasetToRangeAxis(1, 1);
    categoryplot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD);
    return jfreechart;
}

From source file:graph.GraphCreater.java

public GraphCreater(String applicationTitle, String chartTitle, ArrayList<String> resultList,
        ArrayList<String> dateList) {
    super(applicationTitle);
    JFreeChart lineChart = ChartFactory.createLineChart(chartTitle, "Testing date",
            "Sugar level - units(mg/dL)", createDataset(resultList, dateList), PlotOrientation.VERTICAL, true,
            true, false);/*from w w  w.  ja v  a 2s . c o  m*/

    ChartPanel chartPanel = new ChartPanel(lineChart);
    chartPanel.setPreferredSize(new java.awt.Dimension(560, 367));
    setContentPane(chartPanel);
    final CategoryPlot plot = (CategoryPlot) lineChart.getPlot();
    CategoryAxis catAxis = plot.getDomainAxis();
    catAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90);

}

From source file:com.ev.gui.views.OverallDiagramView.java

public OverallDiagramView() {
    OverallConsumption oc = new OverallConsumption();
    chart = ChartFactory.createBarChart3D(getLang().getString("Overallview"), getLang().getString("Year"),
            getLang().getString("Consumption"), oc.generateAllDataset(), PlotOrientation.VERTICAL, true, true,
            true);/*from   w w  w.  j  av a  2  s  .c  o  m*/
    chart.getCategoryPlot().getDomainAxis().setCategoryLabelPositions(CategoryLabelPositions.UP_90);
    chartPanel = new ChartPanel(chart);
    chart.setBackgroundPaint(chartPanel.getBackground());
    add(chartPanel);
}

From source file:com.xpn.xwiki.plugin.charts.params.CategoryLabelPositionsChartParam.java

@Override
protected void init() {
    addChoice("down_45", CategoryLabelPositions.DOWN_45);
    addChoice("down_90", CategoryLabelPositions.DOWN_90);
    addChoice("standard", CategoryLabelPositions.STANDARD);
    addChoice("up_45", CategoryLabelPositions.UP_45);
    addChoice("up_90", CategoryLabelPositions.UP_90);
}

From source file:org.jenkinsci.plugins.todos.TodosChartBuilder.java

/**
 * Build a trend chart from the provided data.
 * /* w  ww. java 2s.  c om*/
 * @param action
 *            the build action
 * @return the trend chart
 */
public static JFreeChart buildChart(TodosBuildAction action) {
    String strComments = Messages.Todos_ReportSummary_Comments();

    JFreeChart chart = ChartFactory.createStackedAreaChart(null, null, strComments, buildDataset(action),
            PlotOrientation.VERTICAL, true, false, true);

    chart.setBackgroundPaint(Color.white);

    CategoryPlot plot = chart.getCategoryPlot();
    plot.setBackgroundPaint(Color.WHITE);
    plot.setOutlinePaint(null);
    plot.setForegroundAlpha(0.8f);
    plot.setRangeGridlinesVisible(true);
    plot.setRangeGridlinePaint(Color.black);

    CategoryAxis domainAxis = new ShiftedCategoryAxis(null);
    plot.setDomainAxis(domainAxis);
    domainAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90);
    domainAxis.setLowerMargin(0.0);
    domainAxis.setUpperMargin(0.0);
    domainAxis.setCategoryMargin(0.0);

    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

    // Crop extra space around the graph
    plot.setInsets(new RectangleInsets(0, 0, 0, 5.0));

    TodosAreaRenderer renderer = new TodosAreaRenderer(action.getUrlName());
    plot.setRenderer(renderer);

    return chart;
}

From source file:org.javarebel.chart.generator.DefaultAxisConfig.java

public CategoryLabelPositions getLabelPosition() {
    return CategoryLabelPositions.UP_90;
}

From source file:com.thalesgroup.hudson.plugins.sourcemonitor.SourceMonitorChartBuilder.java

public static JFreeChart buildChart(SourceMonitorBuildAction action) {
    JFreeChart chart = ChartFactory.createStackedAreaChart(null, null, "Number of errors", buildDataset(action),
            PlotOrientation.VERTICAL, true, false, true);

    chart.setBackgroundPaint(Color.white);

    CategoryPlot plot = chart.getCategoryPlot();
    plot.setBackgroundPaint(Color.WHITE);
    plot.setOutlinePaint(null);//from  w w  w .j a  v  a2s  . com
    plot.setForegroundAlpha(0.8f);
    plot.setRangeGridlinesVisible(true);
    plot.setRangeGridlinePaint(Color.black);

    CategoryAxis domainAxis = new ShiftedCategoryAxis(null);
    plot.setDomainAxis(domainAxis);
    domainAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90);
    domainAxis.setLowerMargin(0.0);
    domainAxis.setUpperMargin(0.0);
    domainAxis.setCategoryMargin(0.0);
    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    // crop extra space around the graph
    plot.setInsets(new RectangleInsets(0, 0, 0, 5.0));

    CategoryItemRenderer firstRender = new DefaultCategoryItemRenderer();
    SourceMonitorRenderer renderer = new SourceMonitorRenderer(action.getUrlName());
    plot.setRenderer(firstRender);

    return chart;
}

From source file:org.evosuite.jenkins.plot.Plot.java

@Override
protected JFreeChart createGraph() {
    final JFreeChart chart = ChartFactory.createLineChart(null, "Build Number #", this.yLabel, this.dataset,
            PlotOrientation.VERTICAL, true, true, true);
    chart.setBackgroundPaint(Color.WHITE);

    CategoryPlot plot = (CategoryPlot) chart.getPlot();

    CategoryAxis domainAxis = new CategoryAxis();
    domainAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90);
    domainAxis.setLowerMargin(0.0);/*from   ww w  .j a v a 2s. com*/
    domainAxis.setUpperMargin(0.0);
    domainAxis.setCategoryMargin(0.0);

    plot.setDomainAxis(domainAxis);
    plot.setBackgroundPaint(Color.WHITE);

    ValueAxis yAxis = plot.getRangeAxis();
    yAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    //yAxis.setRange(0.0, 100.0);

    URLAndTooltipRenderer urlRenderer = new URLAndTooltipRenderer(this.project.getProject());
    ColorPalette.apply(urlRenderer);
    plot.setRenderer(urlRenderer);

    return chart;
}

From source file:org.jgrasstools.gears.utils.chart.CategoryHistogram.java

public JFreeChart getChart() {
    if (chart == null) {
        createDataset();/*from  w  w  w  .  ja  va  2s.c om*/
        chart = ChartFactory.createBarChart(title,
                // chart title
                "Category",
                // domain axis label
                "Value",
                // range axis label
                dataset,
                // data
                PlotOrientation.VERTICAL,
                // orientation
                false,
                // include legend
                true,
                // tooltips?
                false
        // URLs?
        );

        CategoryPlot plot = (CategoryPlot) chart.getPlot();
        CategoryAxis rangeAxis = plot.getDomainAxis();
        rangeAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90);
    }
    return chart;
}

From source file:cheuk.licenseheaderchecker.resource.DataGraph.java

/**
* Creates a trend graph/*from   ww  w .  ja  v a  2 s.  c o  m*/
*
* @return the JFreeChart graph object
*/
protected JFreeChart createGraph() {

    final JFreeChart chart = ChartFactory.createLineChart(null, // chart title
            null, // unused
            yLabel, // range axis label
            categoryDataset, // data
            PlotOrientation.VERTICAL, // orientation
            false, // include legend
            true, // tooltips
            false // urls
    );

    // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...

    //final LegendTitle legend = chart.getLegend();
    //legend.setPosition(RectangleEdge.RIGHT);

    chart.setBackgroundPaint(Color.white);

    final CategoryPlot plot = chart.getCategoryPlot();

    // plot.setAxisOffset(new Spacer(Spacer.ABSOLUTE, 5.0, 5.0, 5.0, 5.0));
    plot.setBackgroundPaint(Color.WHITE);
    plot.setOutlinePaint(null);
    plot.setRangeGridlinesVisible(true);
    plot.setRangeGridlinePaint(Color.black);

    CategoryAxis domainAxis = new ShiftedCategoryAxis(null);
    plot.setDomainAxis(domainAxis);
    domainAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90);
    domainAxis.setLowerMargin(0.0);
    domainAxis.setUpperMargin(0.0);
    domainAxis.setCategoryMargin(0.0);

    final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    rangeAxis.setLowerBound(0);
    //        rangeAxis.setAutoRange(true);

    final StackedAreaRenderer renderer = new StackedAreaRenderer2();
    plot.setRenderer(renderer);
    //renderer.setBaseStroke(new BasicStroke(2.0f));
    //ColorPalette.apply(renderer);
    plot.setRenderer(renderer);
    renderer.setSeriesPaint(2, RED);
    renderer.setSeriesPaint(1, GRAY);
    renderer.setSeriesPaint(0, YELLOW);

    // crop extra space around the graph
    plot.setInsets(new RectangleInsets(5.0, 0, 0, 5.0));

    return chart;
}