Package org.jfree.chart.plot

Examples of org.jfree.chart.plot.XYPlot


      if(routes!=null) solution = makeSolutionSeries(vrp, routes);
    } catch (NoLocationFoundException e) {
      log.warn("cannot plot vrp, since coord is missing");
      return
    }
    final XYPlot plot = createPlot(problem, shipments, solution);
    JFreeChart chart = new JFreeChart(title, plot);
   
    LegendTitle legend = createLegend(routes, shipments, plot);
    chart.removeLegend();
    chart.addLegend(legend);
View Full Code Here


    if(this.boundingBox == null) return seriesCol.getDomainBounds(true);
    else return new Range(boundingBox.minX, boundingBox.maxX);
  }

  private XYPlot createPlot(final XYSeriesCollection problem, XYSeriesCollection shipments, XYSeriesCollection solution) {
    XYPlot plot = new XYPlot();
    plot.setBackgroundPaint(Color.LIGHT_GRAY);
    plot.setRangeGridlinePaint(Color.LIGHT_GRAY);
    plot.setDomainGridlinePaint(Color.LIGHT_GRAY);
   
    XYLineAndShapeRenderer problemRenderer = getProblemRenderer(problem);
    plot.setDataset(0, problem);
    plot.setRenderer(0, problemRenderer);

    XYItemRenderer shipmentsRenderer = getShipmentRenderer(shipments);
    plot.setDataset(1, shipments);
    plot.setRenderer(1, shipmentsRenderer);
   
    if(solution != null){
      XYItemRenderer solutionRenderer = getRouteRenderer(solution);
      plot.setDataset(2, solution);
      plot.setRenderer(2, solutionRenderer);
    }
   
    NumberAxis xAxis = new NumberAxis();
    NumberAxis yAxis = new NumberAxis();
   
    if(boundingBox == null){
      xAxis.setRangeWithMargins(getDomainRange(problem));
      yAxis.setRangeWithMargins(getRange(problem));
    }
    else{
      xAxis.setRangeWithMargins(new Range(boundingBox.minX, boundingBox.maxX));
      yAxis.setRangeWithMargins(new Range(boundingBox.minY, boundingBox.maxY));
    }
   
    plot.setDomainAxis(xAxis);
    plot.setRangeAxis(yAxis);
   
    return plot;
  }
View Full Code Here

    XYErrorRenderer renderer = new XYErrorRenderer();
    renderer.setBaseLinesVisible(true);
    renderer.setDrawXError(false);
    renderer.setDrawYError(true);
    // renderer.setShapesFilled(true);
    XYPlot plot = new XYPlot(xyDataset, timeAxis, valueAxis, renderer);
    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
        plot, true);
    chart.setBackgroundPaint(java.awt.Color.white);
    TextTitle chartTitle = chart.getTitle();
    String fontName = chartTitle.getFont().getFontName();
View Full Code Here

    }

    XYErrorRenderer renderer = new XYErrorRenderer();
    renderer.setBaseLinesVisible(true);
    // renderer.setShapesFilled(true);
    XYPlot plot = new XYPlot(xyDataset, timeAxis, valueAxis, renderer);
    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
        plot, true);
    chart.setBackgroundPaint(java.awt.Color.white);
    TextTitle chartTitle = chart.getTitle();
    String fontName = chartTitle.getFont().getFontName();
View Full Code Here

    }

    XYErrorRenderer renderer = new XYErrorRenderer();

    // renderer.setShapesFilled(true);
    XYPlot plot = new XYPlot(xyDataset, timeAxis, valueAxis, renderer);
    // renderer = (XYErrorRenderer)plot.getRenderer();
    if (history != null) {
      for (String targetName : targetNames) {
        XYIntervalSeries predSeries = null;
        int predIndex = xyDataset.indexOf(targetName + "-predicted");
View Full Code Here

    /**
     * If setters were called before chart has been created, set them now.
     */
     private void initChart() {
        XYPlot plot = m_chart.getXYPlot();

        if (m_xyAnnotation != null) {
            plot.addAnnotation(m_xyAnnotation);
        }
       
        if (m_xMarker != null) {
            plot.addDomainMarker(m_xMarker);
        }
       
        if (m_yMarker != null) {
            plot.addRangeMarker(m_yMarker);
        }
       
        if (m_xAxisRange != null) {
            NumberAxis rangeAxis = getAxis(AxisEnum.X);
            rangeAxis.setRange(m_xAxisRange[0], m_xAxisRange[1]);
        }
       
        if (m_yAxisRange != null) {
            NumberAxis rangeAxis = getAxis(AxisEnum.Y);
            rangeAxis.setRange(m_yAxisRange[0], m_yAxisRange[1]);
        }
       
        if (m_backgroundPaint != null) {
            m_chart.setBackgroundPaint(m_backgroundPaint);
            plot.setBackgroundPaint(m_backgroundPaint);
        }
       
        if (m_gridPaint != null) {
            plot.setDomainGridlinePaint(m_gridPaint);
            plot.setRangeGridlinePaint(m_gridPaint);
        }
       
        if (m_xTickDelta > 0) {
            NumberAxis rangeAxis = getAxis(AxisEnum.X);
            rangeAxis.setTickUnit(new NumberTickUnit(m_xTickDelta));
View Full Code Here

    /**
     * Sets text for X axis.
     * @param label x axis text */
    public void setXLabel(String label) {
        m_xAxisLabel = label;
        XYPlot plot = m_chart.getXYPlot();
        ValueAxis axis = plot.getDomainAxis();
        axis.setLabel(label);
    }
View Full Code Here

    /**
     * Sets text for Y axis.
     * @param label y axis text */
    public void setYLabel(String label) {
        m_yAxisLabel = label;
        XYPlot plot = m_chart.getXYPlot();
        ValueAxis axis = plot.getRangeAxis();
        axis.setLabel(label);
    }
View Full Code Here

     */
    public void setBackground(Paint color) {
        if (m_chart != null) {
            m_chart.setBackgroundPaint(color);
           
            XYPlot plot = m_chart.getXYPlot();
            plot.setBackgroundPaint(color);
        }
       
        m_backgroundPaint = color;
    }
View Full Code Here

     * @param color grid color.
     */
    public void setGridColor(Paint color) {
       
        if (m_chart != null) {
            XYPlot plot = m_chart.getXYPlot();
            plot.setDomainGridlinePaint(color);
            plot.setRangeGridlinePaint(color);
        }
       
        m_gridPaint = color;
    }
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.