Package org.jfree.chart.renderer.xy

Examples of org.jfree.chart.renderer.xy.XYItemRenderer


    }

    final String chartType = getChartType();
    if (STEP_AREA_CHART_STR.equals(chartType))
    {
      final XYItemRenderer renderer;
      if (isMarkersVisible())
      {
        renderer = new XYStepAreaRenderer(XYStepAreaRenderer.AREA_AND_SHAPES);
      }
      else
View Full Code Here


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

    final XYPlot xypl = chart.getXYPlot();
    final XYItemRenderer renderer = xypl.getRenderer();
    final XYBarRenderer br = (XYBarRenderer) renderer;
    br.setDrawBarOutline(isChartSectionOutline());
    if (margin != null)
    {
      br.setMargin(margin.doubleValue());
View Full Code Here

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

    final XYPlot xypl = chart.getXYPlot();
    final XYItemRenderer renderer = xypl.getRenderer();
    if (renderer instanceof XYDotRenderer)
    {
      final XYDotRenderer renderer1 = (XYDotRenderer) renderer;
      renderer1.setDotHeight(getDotHeight());
      renderer1.setDotWidth(getDotWidth());
View Full Code Here

    else
    {
      linesAxis = new NumberAxis(getSecondValueAxisLabel());
    }

    final XYItemRenderer lineRenderer;
    if (isThreeD())
    {
      lineRenderer = new XYLine3DRenderer();
    }
    else
View Full Code Here

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

    final XYPlot plot = chart.getXYPlot();
    final XYItemRenderer renderer = plot.getRenderer();

    if (StringUtils.isEmpty(getTooltipFormula()) == false)
    {
      renderer.setBaseToolTipGenerator(new FormulaXYZTooltipGenerator(getRuntime(), getTooltipFormula()));
    }
    if (StringUtils.isEmpty(getUrlFormula()) == false)
    {
      renderer.setURLGenerator(new FormulaXYZURLGenerator(getRuntime(), getUrlFormula()));
    }
    renderer.setBaseItemLabelsVisible(Boolean.TRUE.equals(getItemsLabelVisible()));
    if (getItemLabelFont() != null)
    {
      renderer.setBaseItemLabelFont(getItemLabelFont());
    }

    plot.setOrientation(computePlotOrientation());

    // May be an axis that supports dates
    final ValueAxis domainAxis = plot.getDomainAxis();
    if (domainAxis instanceof NumberAxis)
    {
      final NumberAxis numberAxis = (NumberAxis) domainAxis;
      numberAxis.setAutoRangeIncludesZero(isDomainIncludesZero());
      numberAxis.setAutoRangeStickyZero(isDomainStickyZero());
      if (getDomainPeriodCount() > 0)
      {
        if (getDomainTickFormat() != null)
        {
          numberAxis.setTickUnit(new NumberTickUnit(getDomainPeriodCount(), getDomainTickFormat()));
        }
        else if (getDomainTickFormatString() != null)
        {
          final FastDecimalFormat formatter = new FastDecimalFormat
              (getDomainTickFormatString(), getResourceBundleFactory().getLocale());
          numberAxis.setTickUnit(new FastNumberTickUnit(getDomainPeriodCount(), formatter));
        }
        else
        {
          numberAxis.setTickUnit(new FastNumberTickUnit(getDomainPeriodCount()));
        }
      }
      else
      {
        if (getDomainTickFormat() != null)
        {
          numberAxis.setNumberFormatOverride(getDomainTickFormat());
        }
        else if (getDomainTickFormatString() != null)
        {
          final DecimalFormat formatter = new DecimalFormat
              (getDomainTickFormatString(), new DecimalFormatSymbols(getResourceBundleFactory().getLocale()));
          numberAxis.setNumberFormatOverride(formatter);
        }
      }
    }
    else if (domainAxis instanceof DateAxis)
    {
      final DateAxis numberAxis = (DateAxis) domainAxis;

      if (getDomainPeriodCount() > 0 && getDomainTimePeriod() != null)
      {
        if (getDomainTickFormatString() != null)
        {
          final SimpleDateFormat formatter = new SimpleDateFormat
              (getDomainTickFormatString(), new DateFormatSymbols(getResourceBundleFactory().getLocale()));
          numberAxis.setTickUnit
              (new DateTickUnit(getDateUnitAsInt(getDomainTimePeriod()), (int) getDomainPeriodCount(), formatter));
        }
        else
        {
          numberAxis.setTickUnit
              (new DateTickUnit(getDateUnitAsInt(getDomainTimePeriod()), (int) getDomainPeriodCount()));
        }
      }
    }

    if (domainAxis != null)
    {
      domainAxis.setLabel(getDomainTitle());
      if (getDomainTitleFont() != null)
      {
        domainAxis.setLabelFont(getDomainTitleFont());
      }
      domainAxis.setVerticalTickLabels(isDomainVerticalTickLabels());
      if (getDomainTickFont() != null)
      {
        domainAxis.setTickLabelFont(getDomainTickFont());
      }
      if (getDomainMinimum() != ValueAxis.DEFAULT_LOWER_BOUND)
      {
        domainAxis.setLowerBound(getDomainMinimum());
      }
      if (getDomainMaximum() != ValueAxis.DEFAULT_UPPER_BOUND)
      {
        domainAxis.setUpperBound(getDomainMaximum());
      }
    }

    final ValueAxis rangeAxis = plot.getRangeAxis();
    if (rangeAxis instanceof NumberAxis)
    {
      final NumberAxis numberAxis = (NumberAxis) rangeAxis;

      if (getRangePeriodCount() > 0)
      {
        if (getRangeTickFormat() != null)
        {
          numberAxis.setTickUnit(new NumberTickUnit(getRangePeriodCount(), getRangeTickFormat()));
        }
        else if (getRangeTickFormatString() != null)
        {
          final FastDecimalFormat formatter = new FastDecimalFormat
              (getRangeTickFormatString(), getResourceBundleFactory().getLocale());
          numberAxis.setTickUnit(new FastNumberTickUnit(getRangePeriodCount(), formatter));
        }
        else
        {
          numberAxis.setTickUnit(new FastNumberTickUnit(getRangePeriodCount()));
        }
      }
      else
      {
        if (getRangeTickFormat() != null)
        {
          numberAxis.setNumberFormatOverride(getRangeTickFormat());
        }
        else if (getRangeTickFormatString() != null)
        {
          final DecimalFormat formatter = new DecimalFormat
              (getRangeTickFormatString(), new DecimalFormatSymbols(getResourceBundleFactory().getLocale()));
          numberAxis.setNumberFormatOverride(formatter);
        }
      }
    }
    else if (rangeAxis instanceof DateAxis)
    {
      final DateAxis numberAxis = (DateAxis) rangeAxis;

      if (getRangePeriodCount() > 0 && getRangeTimePeriod() != null)
      {
        if (getRangeTickFormatString() != null)
        {
          final SimpleDateFormat formatter = new SimpleDateFormat
              (getRangeTickFormatString(), new DateFormatSymbols(getResourceBundleFactory().getLocale()));
          numberAxis.setTickUnit
              (new DateTickUnit(getDateUnitAsInt(getRangeTimePeriod()), (int) getRangePeriodCount(), formatter));
        }
        else
        {
          numberAxis.setTickUnit
              (new DateTickUnit(getDateUnitAsInt(getRangeTimePeriod()), (int) getRangePeriodCount()));
        }
      }
      else
      {
        if (getRangeTickFormatString() != null)
        {
          final SimpleDateFormat formatter = new SimpleDateFormat
              (getRangeTickFormatString(), new DateFormatSymbols(getResourceBundleFactory().getLocale()));
          numberAxis.setDateFormatOverride(formatter);
        }
      }
    }

    if (rangeAxis != null)
    {
      rangeAxis.setLabel(getRangeTitle());
      if (getRangeTitleFont() != null)
      {
        rangeAxis.setLabelFont(getRangeTitleFont());
      }
      if (getRangeTickFont() != null)
      {
        rangeAxis.setTickLabelFont(getRangeTickFont());
      }
      if (getRangeMinimum() != ValueAxis.DEFAULT_LOWER_BOUND)
      {
        rangeAxis.setLowerBound(getRangeMinimum());
      }
      if (getRangeMaximum() != ValueAxis.DEFAULT_UPPER_BOUND)
      {
        rangeAxis.setUpperBound(getRangeMaximum());
      }
    }

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

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

    final XYPlot xypl = chart.getXYPlot();
    final XYItemRenderer renderer = xypl.getRenderer();
    renderer.setStroke(translateLineStyle(lineWidth, lineStyle));
    if (renderer instanceof XYLineAndShapeRenderer)
    {
      final XYLineAndShapeRenderer renderer1 = (XYLineAndShapeRenderer) renderer;
      renderer1.setShapesVisible(isMarkersVisible());
      renderer1.setBaseShapesFilled(isMarkersVisible());
View Full Code Here

      categoryPlot.getDomainAxis().setCategoryLabelPositions(CategoryLabelPositions.UP_45);
    }
    else if(plot instanceof XYPlot)
    {
      XYPlot xyPlot = (XYPlot)plot;
      XYItemRenderer xyItemRenderer = xyPlot.getRenderer();
      XYDataset xyDataset = xyPlot.getDataset();
      if(xyDataset != null)
      {
        for(int i = 0; i < xyDataset.getSeriesCount(); i++)
        {
          xyItemRenderer.setSeriesOutlinePaint(i, ChartThemesConstants.TRANSPARENT_PAINT);
        }
      }
      xyPlot.setRangeGridlinePaint(ChartThemesConstants.GRAY_PAINT_217);
      xyPlot.setRangeGridlineStroke(new BasicStroke(0.5f));
      xyPlot.setDomainGridlinesVisible(false);
View Full Code Here

  }

  protected void handleXYPlotSettings(XYPlot p, JRChartPlot jrPlot)
  {
    PlotSettings plotSettings = getPlotSettings();
    XYItemRenderer xyItemRenderer = p.getRenderer();
    Paint[] paintSequence = getPaintSequence(plotSettings, jrPlot)
    if (paintSequence != null)
    {
      for(int i = 0; i < paintSequence.length; i++)
      {
        xyItemRenderer.setSeriesPaint(i, paintSequence[i]);
      }
    }
    Paint[] outlinePaintSequence = getOutlinePaintSequence(plotSettings)
    if (outlinePaintSequence != null)
    {
      for(int i = 0; i < outlinePaintSequence.length; i++)
      {
        xyItemRenderer.setSeriesOutlinePaint(i, outlinePaintSequence[i]);
      }
    }
    Stroke[] strokeSequence = getStrokeSequence(plotSettings);
    if (strokeSequence != null)
    {
      for(int i = 0; i < strokeSequence.length; i++)
      {
        xyItemRenderer.setSeriesStroke(i, strokeSequence[i]);
      }
    }
    Stroke[] outlineStrokeSequence = getOutlineStrokeSequence(plotSettings);
    if (outlineStrokeSequence != null)
    {
      for(int i = 0; i < outlineStrokeSequence.length; i++)
      {
        xyItemRenderer.setSeriesOutlineStroke(i, outlineStrokeSequence[i]);
      }
    }
   
    Boolean domainGridlineVisible = plotSettings.getDomainGridlineVisible();
    if(domainGridlineVisible == null || domainGridlineVisible.booleanValue())
View Full Code Here

    {
      XYPlot xyPlot = (XYPlot)plot;
      XYDataset xyDataset = xyPlot.getDataset();
      if(xyDataset != null)
      {
        XYItemRenderer xyItemRenderer = xyPlot.getRenderer();
        for(int i = 0; i < xyDataset.getSeriesCount(); i++)
        {
          xyItemRenderer.setSeriesOutlinePaint(i, ChartThemesConstants.TRANSPARENT_PAINT);
        }
      }
      xyPlot.setRangeGridlinePaint(ChartThemesConstants.GRAY_PAINT_134);
      xyPlot.setRangeGridlineStroke(new BasicStroke(1f));
      xyPlot.setDomainGridlinesVisible(false);
View Full Code Here

      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

TOP

Related Classes of org.jfree.chart.renderer.xy.XYItemRenderer

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.