Package org.jfree.chart.renderer.category

Examples of org.jfree.chart.renderer.category.CategoryItemRenderer


    categoryPlot.setRangeGridlinePaint(ChartThemesConstants.GRAY_PAINT_134);
    categoryPlot.getDomainAxis().setTickLabelsVisible(
        //barPlot.isShowTickLabels()
        true
        );
    CategoryItemRenderer categoryRenderer = categoryPlot.getRenderer();
    categoryRenderer.setBaseItemLabelsVisible(true);
    BarRenderer barRenderer = (BarRenderer)categoryRenderer;
    barRenderer.setSeriesPaint(0, (Paint)ChartThemesConstants.EYE_CANDY_SIXTIES_COLORS.get(3));
    barRenderer.setSeriesPaint(1, (Paint)ChartThemesConstants.EYE_CANDY_SIXTIES_COLORS.get(0));
    CategoryDataset categoryDataset = categoryPlot.getDataset();
    if(categoryDataset != null)
View Full Code Here


      categoryPlot.getDomainAxis().setTickLabelFont(WidgetUtils.FONT_SMALL);
      categoryPlot.getRangeAxis().setLabelFont(WidgetUtils.FONT_SMALL);
      categoryPlot.getRangeAxis().setTickLabelFont(WidgetUtils.FONT_SMALL);
      categoryPlot.setDrawingSupplier(new DCDrawingSupplier());

      final CategoryItemRenderer renderer = categoryPlot.getRenderer();
      renderer.setBaseOutlinePaint(WidgetUtils.BG_COLOR_DARK);
      renderer.setBaseOutlineStroke(wideStroke);

      if (renderer instanceof BarRenderer) {
        BarRenderer barRenderer = (BarRenderer) renderer;
        barRenderer.setShadowPaint(WidgetUtils.BG_COLOR_BRIGHT);
        barRenderer.setBarPainter(new StandardBarPainter());
      }

    } else if (plot instanceof XYPlot) {
      // tweaks for line charts
      final XYPlot xyPlot = (XYPlot) plot;

      xyPlot.setDrawingSupplier(new DCDrawingSupplier());

      xyPlot.getDomainAxis().setLabelFont(WidgetUtils.FONT_SMALL);
      xyPlot.getDomainAxis().setTickLabelFont(WidgetUtils.FONT_SMALL);
      xyPlot.getRangeAxis().setLabelFont(WidgetUtils.FONT_SMALL);
      xyPlot.getRangeAxis().setTickLabelFont(WidgetUtils.FONT_SMALL);

      final XYItemRenderer renderer = xyPlot.getRenderer();
      final int seriesCount = xyPlot.getSeriesCount();
      for (int i = 0; i < seriesCount; i++) {
        renderer.setSeriesStroke(i, wideStroke);
      }
    }
  }
View Full Code Here

        }
        JFreeChart chart = ChartFactory.createBarChart(
                "Best score summary (higher score is better)", "Data", "Score",
                dataset, PlotOrientation.VERTICAL, true, true, false
        );
        CategoryItemRenderer renderer = ((CategoryPlot) chart.getPlot()).getRenderer();
        CategoryItemLabelGenerator generator = new StandardCategoryItemLabelGenerator();
        renderer.setBaseItemLabelGenerator(generator);
        renderer.setBaseItemLabelsVisible(true);
        BufferedImage chartImage = chart.createBufferedImage(1024, 768);
        File chartSummaryFile = new File(solverStatisticFilesDirectory, "summary.png");
        OutputStream out = null;
        try {
            out = new FileOutputStream(chartSummaryFile);
View Full Code Here

  protected void configureChart(final JFreeChart chart)
  {
    super.configureChart(chart);

    final CategoryPlot cpl = chart.getCategoryPlot();
    final CategoryItemRenderer renderer = cpl.getRenderer();
    renderer.setStroke(translateLineStyle(lineWidth, lineStyle));
    if (renderer instanceof LineAndShapeRenderer)
    {
      final LineAndShapeRenderer shapeRenderer = (LineAndShapeRenderer) renderer;
      shapeRenderer.setShapesVisible(isMarkersVisible());
      shapeRenderer.setBaseShapesFilled(isMarkersVisible());
View Full Code Here

  }

  protected void configureChart(final JFreeChart chart)
  {
    final CategoryPlot cpl = chart.getCategoryPlot();
    final CategoryItemRenderer renderer = cpl.getRenderer();
    final BarRenderer br = (BarRenderer) renderer;
    if (isAutoRange())
    {
      br.setIncludeBaseInRange(false);
    }
View Full Code Here

    public JFreeChart createChartImpl(String title, String xAxisTitle, String yAxisTitle, final Dataset dataset,
            PlotOrientation plotOrientation, boolean showLegend, boolean showToolTips, boolean showUrls)
    {
        CategoryAxis xAxis = new CategoryAxis(xAxisTitle);
        ValueAxis yAxis = new NumberAxis(yAxisTitle);
        CategoryItemRenderer renderer = new StatisticalBarRenderer();

        CategoryPlot plot = new CategoryPlot((StatisticalCategoryDataset) dataset, xAxis, yAxis, renderer);

        JFreeChart chart = new JFreeChart(title, new Font("Arial", Font.PLAIN, 10), plot, true);
        return chart;
View Full Code Here

  protected void configureChart(final JFreeChart chart)
  {
    super.configureChart(chart);

    final CategoryPlot cpl = chart.getCategoryPlot();
    final CategoryItemRenderer renderer = cpl.getRenderer();
    if (StringUtils.isEmpty(getTooltipFormula()) == false)
    {
      renderer.setBaseToolTipGenerator(new FormulaCategoryTooltipGenerator(getRuntime(), getTooltipFormula()));
    }
    if (StringUtils.isEmpty(getUrlFormula()) == false)
    {
      renderer.setBaseItemURLGenerator(new FormulaCategoryURLGenerator(getRuntime(), getUrlFormula()));
    }
    if (this.categoricalLabelFormat != null)
    {
      final StandardCategoryItemLabelGenerator scilg;
      if (categoricalLabelDecimalFormat != null)
      {
        final DecimalFormat numFormat = new DecimalFormat(categoricalLabelDecimalFormat,
                                                          new DecimalFormatSymbols(getRuntime().getResourceBundleFactory().getLocale()));
        numFormat.setRoundingMode(RoundingMode.HALF_UP);
        scilg = new StandardCategoryItemLabelGenerator(categoricalLabelFormat, numFormat);
      }
      else if (categoricalLabelDateFormat != null)
      {
        scilg = new StandardCategoryItemLabelGenerator(categoricalLabelFormat,
            new SimpleDateFormat(categoricalLabelDateFormat, getRuntime().getResourceBundleFactory().getLocale()));
      }
      else
      {
        final DecimalFormat formatter = new DecimalFormat();
        formatter.setDecimalFormatSymbols
            (new DecimalFormatSymbols(getRuntime().getResourceBundleFactory().getLocale()));
        scilg = new StandardCategoryItemLabelGenerator(categoricalLabelFormat, formatter);
      }
      renderer.setBaseItemLabelGenerator(scilg);
    }
    renderer.setBaseItemLabelsVisible(Boolean.TRUE.equals(getItemsLabelVisible()));
    if (getItemLabelFont() != null)
    {
      renderer.setBaseItemLabelFont(getItemLabelFont());
    }

    if (categoricalItemLabelRotation != null)
    {
      final ItemLabelPosition orgPosItemLabelPos = renderer.getBasePositiveItemLabelPosition();
      if (orgPosItemLabelPos == null)
      {
        final ItemLabelPosition pos2 = new ItemLabelPosition
            (ItemLabelAnchor.OUTSIDE12, TextAnchor.BOTTOM_CENTER,
                TextAnchor.CENTER, categoricalItemLabelRotation.doubleValue());
        renderer.setBasePositiveItemLabelPosition(pos2);
      }
      else
      {
        final ItemLabelPosition pos2 = new ItemLabelPosition
            (orgPosItemLabelPos.getItemLabelAnchor(), orgPosItemLabelPos.getTextAnchor(),
                orgPosItemLabelPos.getRotationAnchor(), categoricalItemLabelRotation.doubleValue());
        renderer.setBasePositiveItemLabelPosition(pos2);
      }

      final ItemLabelPosition orgNegItemLabelPos = renderer.getBaseNegativeItemLabelPosition();
      if (orgNegItemLabelPos == null)
      {
        final ItemLabelPosition pos2 = new ItemLabelPosition
            (ItemLabelAnchor.OUTSIDE12, TextAnchor.BOTTOM_CENTER,
                TextAnchor.CENTER, categoricalItemLabelRotation.doubleValue());
        renderer.setBaseNegativeItemLabelPosition(pos2);
      }
      else
      {
        final ItemLabelPosition neg2 = new ItemLabelPosition
            (orgNegItemLabelPos.getItemLabelAnchor(), orgNegItemLabelPos.getTextAnchor(),
                orgNegItemLabelPos.getRotationAnchor(), categoricalItemLabelRotation.doubleValue());
        renderer.setBaseNegativeItemLabelPosition(neg2);
      }
    }

    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());
View Full Code Here

    super.configureChart(chart);
    final CategoryPlot cpl = chart.getCategoryPlot();

    cpl.getDomainAxis().setCategoryMargin(0.0);

    final CategoryItemRenderer renderer = cpl.getRenderer();
    if ((isStacked()) && renderAsPercentages && (renderer instanceof StackedAreaRenderer))
    {
      final StackedAreaRenderer sbr = (StackedAreaRenderer) renderer;
      sbr.setRenderAsPercentages(true);
    }
View Full Code Here

    final CategoryDataset linesDataset = createLinesDataset();

    //Create the renderer with the barchart, use a different bar renderer depending
    //if 3D chart or not
    final CategoryPlot plot = chart.getCategoryPlot();
    final CategoryItemRenderer lineRenderer;
    if (isThreeD())
    {
      lineRenderer = new LineRenderer3D();
    }
    else
View Full Code Here

        }

        // process all renderers
        int rendererCount = plot.getRendererCount();
        for (int i = 0; i < rendererCount; i++) {
            CategoryItemRenderer r = plot.getRenderer(i);
            if (r != null) {
                applyToCategoryItemRenderer(r);
            }
        }
View Full Code Here

TOP

Related Classes of org.jfree.chart.renderer.category.CategoryItemRenderer

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.