Package org.jfree.chart.plot

Examples of org.jfree.chart.plot.XYPlot


    {
      final NumberAxis catAxis = new NumberAxis("Range");// NON-NLS
      final NumberAxis barsAxis = new NumberAxis("Value");// NON-NLS
      final NumberAxis linesAxis = new NumberAxis("Value2");// NON-NLS

      final XYPlot plot = new XYPlot(createXYZDataset(), catAxis, barsAxis, new XYAreaRenderer());
      plot.setRenderer(1, new XYLineAndShapeRenderer());

      // add lines dataset and axis to plot
      plot.setDataset(1, createXYZDataset());
      plot.setRangeAxis(1, linesAxis);

      // map lines to second axis
      plot.mapDatasetToRangeAxis(1, 1);

      // set rendering order
      plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD);

      // set location of second axis
      plot.setRangeAxisLocation(1, AxisLocation.BOTTOM_OR_RIGHT);

      return new JFreeChart("XY Area Line Chart", plot);// NON-NLS
    }
    if (aExpression instanceof XYAreaChartExpression)
    {
View Full Code Here


    final ValueAxis timeAxis = new DateAxis(timeAxisLabel);
    timeAxis.setLowerMargin(0.02)// reduce the default margins
    timeAxis.setUpperMargin(0.02);
    final NumberAxis valueAxis = new NumberAxis(valueAxisLabel);
    valueAxis.setAutoRangeIncludesZero(false)// override default
    final XYPlot plot = new XYPlot(dataset, timeAxis, valueAxis, null);

    XYToolTipGenerator toolTipGenerator = null;
    if (tooltips)
    {
      toolTipGenerator
          = StandardXYToolTipGenerator.getTimeSeriesInstance();
    }

    XYURLGenerator urlGenerator = null;
    if (urls)
    {
      urlGenerator = new StandardXYURLGenerator();
    }

    final XYBarRenderer renderer;
    if (stacked)
    {
      renderer = new StackedXYBarRenderer();
    }
    else
    {
      renderer = new XYBarRenderer();
    }
    renderer.setBaseToolTipGenerator(toolTipGenerator);
    renderer.setURLGenerator(urlGenerator);
    plot.setRenderer(renderer);

    return new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
  }
View Full Code Here

    if (urls)
    {
      renderer.setURLGenerator(new StandardXYURLGenerator());
    }

    final XYPlot plot = new XYPlot(dataset, domainAxis, valueAxis, renderer);
    plot.setOrientation(orientation);

    return new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
        plot, legend);
  }
View Full Code Here

    if (urls)
    {
      renderer.setURLGenerator(new StandardXYURLGenerator());
    }

    final XYPlot plot = new XYPlot(dataset, domainAxis, valueAxis, renderer);
    plot.setOrientation(orientation);

    return new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
        plot, legend);
  }
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

    if (xyDataset instanceof TimeSeriesCollection)
    {
      chart =
          ChartFactory.createTimeSeriesChart(computeTitle(), getDomainTitle(), getRangeTitle(), xyDataset,
              isShowLegend(), false, false);
      final XYPlot xyPlot = chart.getXYPlot();
      final XYLineAndShapeRenderer itemRenderer = (XYLineAndShapeRenderer) xyPlot.getRenderer();
      final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(false, true);
      renderer.setBaseToolTipGenerator(itemRenderer.getBaseToolTipGenerator());
      renderer.setURLGenerator(itemRenderer.getURLGenerator());
      xyPlot.setRenderer(renderer);

    }
    else
    {
      final PlotOrientation orientation = computePlotOrientation();
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

    final ValueAxis timeAxis = new DateAxis(timeAxisLabel);
    timeAxis.setLowerMargin(0.02)// reduce the default margins
    timeAxis.setUpperMargin(0.02);
    final NumberAxis valueAxis = new NumberAxis(valueAxisLabel);
    valueAxis.setAutoRangeIncludesZero(false)// override default
    final XYPlot plot = new XYPlot(dataset, timeAxis, valueAxis, null);

    XYToolTipGenerator toolTipGenerator = null;
    if (tooltips)
    {
      toolTipGenerator
          = StandardXYToolTipGenerator.getTimeSeriesInstance();
    }

    XYURLGenerator urlGenerator = null;
    if (urls)
    {
      urlGenerator = new StandardXYURLGenerator();
    }

    final XYAreaRenderer2 renderer;
    if (stacked)
    {
      renderer = new StackedXYAreaRenderer2();
    }
    else
    {
      renderer = new XYAreaRenderer2();
    }
    renderer.setBaseToolTipGenerator(toolTipGenerator);
    renderer.setURLGenerator(urlGenerator);
    plot.setRenderer(renderer);

    return new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
  }
View Full Code Here

    {
      urlGenerator = new StandardXYURLGenerator();
    }
    final StackedXYAreaRenderer2 renderer = new StackedXYAreaRenderer2(toolTipGenerator, urlGenerator);
    renderer.setOutline(true);
    final XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer);
    plot.setOrientation(orientation);

    plot.setRangeAxis(yAxis)// forces recalculation of the axis range

    return new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
  }
View Full Code Here

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

    final XYPlot plot = chart.getXYPlot();

    if (isSharedRangeAxis() == false)
    {
      final ValueAxis linesAxis = plot.getRangeAxis(1);
      if (linesAxis instanceof NumberAxis)
      {
        final NumberAxis numberAxis = (NumberAxis) linesAxis;

        if (getLinePeriodCount() > 0)
        {
          if (getLineTicksLabelFormat() != null)
          {
            final FastDecimalFormat formatter = new FastDecimalFormat
                (getLineTicksLabelFormat(), getResourceBundleFactory().getLocale());
            numberAxis.setTickUnit(new FastNumberTickUnit(getLinePeriodCount(), formatter));
          }
          else
          {
            numberAxis.setTickUnit(new FastNumberTickUnit(getLinePeriodCount()));
          }
        }
        else
        {
          if (getLineTicksLabelFormat() != null)
          {
            final DecimalFormat formatter = new DecimalFormat
                (getLineTicksLabelFormat(), new DecimalFormatSymbols(getResourceBundleFactory().getLocale()));
            numberAxis.setNumberFormatOverride(formatter);
          }
        }
      }
      else if (linesAxis instanceof DateAxis)
      {
        final DateAxis numberAxis = (DateAxis) linesAxis;

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

      if (linesAxis != null)
      {
        final Font labelFont = Font.decode(getLabelFont());
        linesAxis.setLabelFont(labelFont);
        linesAxis.setTickLabelFont(labelFont);

        if (getLineTitleFont() != null)
        {
          linesAxis.setLabelFont(getLineTitleFont());
        }
        if (getLineTickFont() != null)
        {
          linesAxis.setTickLabelFont(getLineTickFont());
        }
        final Double lineRangeMin = getLineRangeMinimum();
        if (lineRangeMin != null)
        {
          linesAxis.setLowerBound(lineRangeMin.doubleValue());
        }
        final Double lineRangeMax = getLineRangeMaximum();
        if (lineRangeMax != null)
        {
          linesAxis.setUpperBound(lineRangeMax.doubleValue());
        }
      }
    }

    final XYLineAndShapeRenderer linesRenderer = (XYLineAndShapeRenderer) plot.getRenderer(1);
    if (linesRenderer != null)
    {
      //set stroke with line width
      linesRenderer.setStroke(translateLineStyle(getLineWidth(), getLineStyle()));
      //hide shapes on line
View Full Code Here

TOP

Related Classes of org.jfree.chart.plot.XYPlot

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.