Package org.jfree.chart.axis

Examples of org.jfree.chart.axis.CategoryAxis


    // set the visual options
    CategoryPlot plot = barChart.getCategoryPlot();

    // set the X axis labels to be slanted
    CategoryAxis domainAxis = plot.getDomainAxis();
    domainAxis.setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 3.0));

    // set the range axis to display integers only...
    final NumberAxis rangeAxis = (NumberAxis)plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
View Full Code Here


    // set the chart visual options
    CategoryPlot plot = barChart.getCategoryPlot();
   
    // set the X axis labels to be slanted
    CategoryAxis domainAxis = plot.getDomainAxis();
    domainAxis.setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 3.0));
   
    // set the max width of each bar
    BarRenderer renderer = (BarRenderer) plot.getRenderer();
    renderer.setMaxBarWidth(0.10);
View Full Code Here

      }
     
      /**
       * DOAMIN AXIS settings
       */
      CategoryAxis   domainAxis     = categoryPlot.getDomainAxis();
      domainAxis.setAxisLineVisible(visibility.isAxisLine());
      domainAxis.setTickMarksVisible(visibility.isTickMarks());
      domainAxis.setMinorTickMarksVisible(visibility.isMinerTickMarks());
     
      domainAxis.setLabelPaint(axisLabel);
      domainAxis.setTickLabelPaint(tickLabel);
     
      domainAxis.setCategoryLabelPositions(
          CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 6.0));
     
      CategoryItemRenderer rendrer = categoryPlot.getRenderer();
      for(int index = 0; index < colors.getSeries().size(); index++){
        rendrer.setSeriesPaint(index, new Color(colors.getSeries().get(index)));
View Full Code Here

  private JFreeChart createChart(final Expression aExpression)
  {
    if (aExpression instanceof BarLineChartExpression)
    {
      final CategoryAxis catAxis = new CategoryAxis("Category");// NON-NLS
      final NumberAxis barsAxis = new NumberAxis("Value");// NON-NLS
      final NumberAxis linesAxis = new NumberAxis("Value2");// NON-NLS

      final CategoryPlot plot = new CategoryPlot(createDataset(), catAxis, barsAxis, new BarRenderer());
      plot.setRenderer(1, new LineAndShapeRenderer());
View Full Code Here

    }

    final Font labelFont = Font.decode(getLabelFont());


    final CategoryAxis categoryAxis = cpl.getDomainAxis();
    categoryAxis.setLabelFont(labelFont);
    categoryAxis.setTickLabelFont(labelFont);
    if (getCategoryTitleFont() != null)
    {
      categoryAxis.setLabelFont(getCategoryTitleFont());
    }
    if (getCategoryTickFont() != null)
    {
      categoryAxis.setTickLabelFont(getCategoryTickFont());
    }

    if (maxCategoryLabelWidthRatio != null)
    {
      categoryAxis.setMaximumCategoryLabelWidthRatio(maxCategoryLabelWidthRatio.floatValue());
    }
    cpl.setDomainGridlinesVisible(showGridlines);
    if (labelRotation != null)
    {
      categoryAxis.setCategoryLabelPositions
          (CategoryLabelPositions.createUpRotationLabelPositions(labelRotation.doubleValue()));
    }

    final String[] colors = getSeriesColor();
    for (int i = 0; i < colors.length; i++)
    {
      renderer.setSeriesPaint(i, parseColorFromString(colors[i]));
    }

    if (lowerMargin != null)
    {
      categoryAxis.setLowerMargin(lowerMargin.doubleValue());
    }
    if (upperMargin != null)
    {
      categoryAxis.setUpperMargin(upperMargin.doubleValue());
    }
    if (categoryMargin != null)
    {
      categoryAxis.setCategoryMargin(categoryMargin.doubleValue());
    }


    final ValueAxis rangeAxis = cpl.getRangeAxis();
    if (rangeAxis instanceof NumberAxis)
View Full Code Here

    if (orientation == null)
    {
      throw new IllegalArgumentException("Null 'orientation' argument.");
    }
    final CategoryAxis categoryAxis = new FormattedCategoryAxis(categoryAxisLabel,
        getCategoricalAxisMessageFormat(), getRuntime().getResourceBundleFactory().getLocale());
    categoryAxis.setCategoryMargin(0.0);
    final ValueAxis valueAxis = new NumberAxis(valueAxisLabel);

    final StackedAreaRenderer renderer = new StackedAreaRenderer();
    if (tooltips)
    {
View Full Code Here

    plot.setForegroundAlpha(foregroundAlpha);

    if (plot instanceof CategoryPlot)
    {
      // Handle rotation of the category labels.
      CategoryAxis axis = ((CategoryPlot)plot).getDomainAxis();
      // it's OK to use deprecated method here; avoiding it means attempting cast operations 
      double labelRotation = getLabelRotation();
      if (labelRotation == 90)
      {
        axis.setCategoryLabelPositions(CategoryLabelPositions.DOWN_90);
      }
      else if (labelRotation == -90) {
        axis.setCategoryLabelPositions(CategoryLabelPositions.UP_90);
      }
      else if (labelRotation < 0)
      {
        axis.setCategoryLabelPositions(
            CategoryLabelPositions.createUpRotationLabelPositions( (-labelRotation / 180.0) * Math.PI));
      }
      else if (labelRotation > 0)
      {
        axis.setCategoryLabelPositions(
            CategoryLabelPositions.createDownRotationLabelPositions((labelRotation / 180.0) * Math.PI));
      }
    }


 
View Full Code Here

  protected void handleCategoryPlotSettings(CategoryPlot p, JRChartPlot jrPlot)
  {
    Double defaultPlotLabelRotation = (Double)getDefaultValue(defaultPlotPropertiesMap, ChartThemesConstants.PLOT_LABEL_ROTATION);
    PlotOrientation defaultPlotOrientation = (PlotOrientation)getDefaultValue(defaultPlotPropertiesMap, ChartThemesConstants.PLOT_ORIENTATION);
    // Handle rotation of the category labels.
    CategoryAxis axis = p.getDomainAxis();
    boolean hasRotation = jrPlot.getLabelRotationDouble() != null || defaultPlotLabelRotation != null;
    if(hasRotation)
    {
      double labelRotation = jrPlot.getLabelRotationDouble() != null ?
          jrPlot.getLabelRotationDouble().doubleValue() :
          defaultPlotLabelRotation.doubleValue();
     
      if (labelRotation == 90)
      {
        axis.setCategoryLabelPositions(CategoryLabelPositions.DOWN_90);
      }
      else if (labelRotation == -90) {
        axis.setCategoryLabelPositions(CategoryLabelPositions.UP_90);
      }
      else if (labelRotation < 0)
      {
        axis.setCategoryLabelPositions(
            CategoryLabelPositions.createUpRotationLabelPositions( (-labelRotation / 180.0) * Math.PI));
      }
      else if (labelRotation > 0)
      {
        axis.setCategoryLabelPositions(
            CategoryLabelPositions.createDownRotationLabelPositions((labelRotation / 180.0) * Math.PI));
      }
    }
   
    if(defaultPlotOrientation != null)
View Full Code Here

  protected void handleCategoryPlotSettings(CategoryPlot p, JRChartPlot jrPlot)
  {
    PlotSettings plotSettings = getPlotSettings();
    Double themeLabelRotation = plotSettings.getLabelRotation();
    // Handle rotation of the category labels.
    CategoryAxis axis = p.getDomainAxis();
    boolean hasRotation = jrPlot.getLabelRotationDouble() != null || themeLabelRotation != null;
    if(hasRotation)
    {
      double labelRotation = jrPlot.getLabelRotationDouble() != null 
          ? jrPlot.getLabelRotationDouble().doubleValue()
          : themeLabelRotation.doubleValue();
     
      if (labelRotation == 90)
      {
        axis.setCategoryLabelPositions(CategoryLabelPositions.DOWN_90);
      }
      else if (labelRotation == -90) {
        axis.setCategoryLabelPositions(CategoryLabelPositions.UP_90);
      }
      else if (labelRotation < 0)
      {
        axis.setCategoryLabelPositions(
            CategoryLabelPositions.createUpRotationLabelPositions( (-labelRotation / 180.0) * Math.PI));
      }
      else if (labelRotation > 0)
      {
        axis.setCategoryLabelPositions(
            CategoryLabelPositions.createDownRotationLabelPositions((labelRotation / 180.0) * Math.PI));
      }
    }
   
    PlotOrientation plotOrientation = jrPlot.getOrientation() != null ? jrPlot.getOrientation() : plotSettings.getOrientation();
View Full Code Here

    }
   
    public static void createBoxplot(DefaultBoxAndWhiskerCategoryDataset scatterDataset, PrintStream outStream,
            String title, String xAxisLabel, String yAxisLabel, Font lableFont ) throws IOException{
      
        CategoryAxis xAxis = new CategoryAxis(xAxisLabel);
        xAxis.setLabelFont(lableFont);
        NumberAxis yAxis = new NumberAxis(yAxisLabel);
        yAxis.setTickLabelFont(lableFont);
        yAxis.setAutoRangeIncludesZero(false);
        yAxis.setRange(0, 100);
        yAxis.setLabelFont(lableFont);
View Full Code Here

TOP

Related Classes of org.jfree.chart.axis.CategoryAxis

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.