當前位置: 首頁>>代碼示例>>Java>>正文


Java Plot類代碼示例

本文整理匯總了Java中org.jfree.chart.plot.Plot的典型用法代碼示例。如果您正苦於以下問題:Java Plot類的具體用法?Java Plot怎麽用?Java Plot使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Plot類屬於org.jfree.chart.plot包,在下文中一共展示了Plot類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setTimeSeriesBarRender

import org.jfree.chart.plot.Plot; //導入依賴的package包/類
public static void setTimeSeriesBarRender(Plot plot, boolean isShowDataLabels) {

        XYPlot xyplot = (XYPlot) plot;
        xyplot.setNoDataMessage(NO_DATA_MSG);

        XYBarRenderer xyRenderer = new XYBarRenderer(0.1D);
        xyRenderer.setBaseItemLabelGenerator(new StandardXYItemLabelGenerator());

        if (isShowDataLabels) {
            xyRenderer.setBaseItemLabelsVisible(true);
            xyRenderer.setBaseItemLabelGenerator(new StandardXYItemLabelGenerator());
        }

        StandardXYToolTipGenerator xyTooltipGenerator = new StandardXYToolTipGenerator("{1}:{2}", new SimpleDateFormat("yyyy-MM-dd"), new DecimalFormat("0"));
        xyRenderer.setBaseToolTipGenerator(xyTooltipGenerator);
        setXY_XAixs(xyplot);
        setXY_YAixs(xyplot);

    }
 
開發者ID:Fanping,項目名稱:iveely.ml,代碼行數:20,代碼來源:ChartUtils.java

示例2: setPieRender

import org.jfree.chart.plot.Plot; //導入依賴的package包/類
public static void setPieRender(Plot plot) {

        plot.setNoDataMessage(NO_DATA_MSG);
        plot.setInsets(new RectangleInsets(10, 10, 5, 10));
        PiePlot piePlot = (PiePlot) plot;
        piePlot.setInsets(new RectangleInsets(0, 0, 0, 0));
        piePlot.setCircular(true);

        piePlot.setLabelGap(0.01);
        piePlot.setInteriorGap(0.05D);
        piePlot.setLegendItemShape(new Rectangle(10, 10));
        piePlot.setIgnoreNullValues(true);
        piePlot.setLabelBackgroundPaint(null);
        piePlot.setLabelShadowPaint(null);
        piePlot.setLabelOutlinePaint(null);
        piePlot.setShadowPaint(null);
        // 0:category 1:value:2 :percentage
        piePlot.setLabelGenerator(new StandardPieSectionLabelGenerator("{0}:{2}"));
    }
 
開發者ID:Fanping,項目名稱:iveely.ml,代碼行數:20,代碼來源:ChartUtils.java

示例3: shrinkSelectionOnCenter

import org.jfree.chart.plot.Plot; //導入依賴的package包/類
/**
 * Zooms in on an anchor point (specified in screen coordinate space).
 * 
 * @param x
 *            the x value (in screen coordinates).
 * @param y
 *            the y value (in screen coordinates).
 */

public void shrinkSelectionOnCenter(double x, double y, MouseEvent selectionEvent) {
	Plot plot = this.chart.getPlot();
	if (plot == null) {
		return;
	}
	// here we tweak the notify flag on the plot so that only
	// one notification happens even though we update multiple
	// axes...
	boolean savedNotify = plot.isNotify();
	plot.setNotify(false);
	shrinkSelectionOnDomain(x, y, selectionEvent);
	shrinkSelectionOnRange(x, y, selectionEvent);
	plot.setNotify(savedNotify);
}
 
開發者ID:transwarpio,項目名稱:rapidminer,代碼行數:24,代碼來源:AbstractChartPanel.java

示例4: restoreAutoBounds

import org.jfree.chart.plot.Plot; //導入依賴的package包/類
/**
 * Restores the auto-range calculation on both axes.
 */

@Override
public void restoreAutoBounds() {
	Plot plot = this.chart.getPlot();
	if (plot == null) {
		return;
	}
	// here we tweak the notify flag on the plot so that only
	// one notification happens even though we update multiple
	// axes...
	boolean savedNotify = plot.isNotify();
	plot.setNotify(false);
	selectCompleteDomainBounds();
	selectCompleteRangeBounds();
	plot.setNotify(savedNotify);
}
 
開發者ID:transwarpio,項目名稱:rapidminer,代碼行數:20,代碼來源:AbstractChartPanel.java

示例5: plotTradeBubblesOnChart

import org.jfree.chart.plot.Plot; //導入依賴的package包/類
private void plotTradeBubblesOnChart(ArrayList<Integer> toPlot, String p, int k, int j)
  {
  	final Plot main_plot = (Plot)((CombinedDomainXYPlot)this.candlestickChart.getPlot()).getSubplots().get(0);
      final XYPlot plot = (XYPlot) main_plot;
      
  	final TimeSeries series = new TimeSeries(p);
///*
for(Integer i: toPlot)
{
	switch(j)
	{
	case 0:
		series.add(new Minute(new Date(chartDatas.get(i).getStartTimeStamp())),chartDatas.get(i).getOpen());
		break;
	case 1:
		series.add(new Minute(new Date(chartDatas.get(i).getStartTimeStamp())),chartDatas.get(i).getHigh());
		break;
	case 2:
		series.add(new Minute(new Date(chartDatas.get(i).getStartTimeStamp())),chartDatas.get(i).getLow());
		break;
	case 3:
		series.add(new Minute(new Date(chartDatas.get(i).getStartTimeStamp())),chartDatas.get(i).getClose());
		break;
	}
	
}
/*
for (int i = 0; i < defaultHighLowDataset.getSeriesCount(); i++) 
{
          series.add(new Minute(defaultHighLowDataset.getXDate(0, i)),plot[i]);
      }
*/
XYDataset dataSet = new TimeSeriesCollection(series);

plot.setDataset(k, dataSet);
  	XYItemRenderer ir = new XYShapeRenderer();
  	//ir.s
  	
  	plot.setRenderer(k, ir);
  }
 
開發者ID:lead4good,項目名稱:open-java-trade-manager,代碼行數:41,代碼來源:ChartJDialog.java

示例6: handleZoomable

import org.jfree.chart.plot.Plot; //導入依賴的package包/類
/**
 * Handle the case where a plot implements the {@link Zoomable} interface.
 *
 * @param zoomable  the zoomable plot.
 * @param e  the mouse wheel event.
 */
private void handleZoomable(ChartCanvas canvas, Zoomable zoomable, 
        ScrollEvent e) {
    // don't zoom unless the mouse pointer is in the plot's data area
    ChartRenderingInfo info = canvas.getRenderingInfo();
    PlotRenderingInfo pinfo = info.getPlotInfo();
    Point2D p = new Point2D.Double(e.getX(), e.getY());
    if (pinfo.getDataArea().contains(p)) {
        Plot plot = (Plot) zoomable;
        // do not notify while zooming each axis
        boolean notifyState = plot.isNotify();
        plot.setNotify(false);
        int clicks = (int) e.getDeltaY();
        double zf = 1.0 + this.zoomFactor;
        if (clicks < 0) {
            zf = 1.0 / zf;
        }
        if (canvas.isDomainZoomable()) {
            zoomable.zoomDomainAxes(zf, pinfo, p, true);
        }
        if (canvas.isRangeZoomable()) {
            zoomable.zoomRangeAxes(zf, pinfo, p, true);
        }
        plot.setNotify(notifyState);  // this generates the change event too
    } 
}
 
開發者ID:jfree,項目名稱:jfreechart-fx,代碼行數:32,代碼來源:ScrollHandlerFX.java

示例7: draw

import org.jfree.chart.plot.Plot; //導入依賴的package包/類
/**
 * Draws the annotation.
 *
 * @param g2  the graphics device.
 * @param plot  the plot.
 * @param dataArea  the data area.
 * @param domainAxis  the domain axis.
 * @param rangeAxis  the range axis.
 * @param rendererIndex  the renderer index.
 * @param info  if supplied, this info object will be populated with
 *              entity information.
 */
public void draw(Graphics2D g2, XYPlot plot, Rectangle2D dataArea,
                 ValueAxis domainAxis, ValueAxis rangeAxis, 
                 int rendererIndex,
                 PlotRenderingInfo info) {

    PlotOrientation orientation = plot.getOrientation();
    RectangleEdge domainEdge = Plot.resolveDomainAxisLocation(
            plot.getDomainAxisLocation(), orientation);
    RectangleEdge rangeEdge = Plot.resolveRangeAxisLocation(
            plot.getRangeAxisLocation(), orientation);
    float j2DX = (float) domainAxis.valueToJava2D(this.x, dataArea, 
            domainEdge);
    float j2DY = (float) rangeAxis.valueToJava2D(this.y, dataArea, 
            rangeEdge);
    Rectangle2D area = new Rectangle2D.Double(j2DX - this.width / 2.0, 
            j2DY - this.height / 2.0, this.width, this.height);
    this.drawable.draw(g2, area);
    String toolTip = getToolTipText();
    String url = getURL();
    if (toolTip != null || url != null) {
        addEntity(info, area, rendererIndex, toolTip, url);
    }
    
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:37,代碼來源:XYDrawableAnnotation.java

示例8: reserveSpace

import org.jfree.chart.plot.Plot; //導入依賴的package包/類
/**
 * Estimates the space required for the axis, given a specific drawing area.
 *
 * @param g2  the graphics device (used to obtain font information).
 * @param plot  the plot that the axis belongs to.
 * @param plotArea  the area within which the axis should be drawn.
 * @param edge  the axis location (top or bottom).
 * @param space  the space already reserved.
 *
 * @return The space required to draw the axis.
 */
public AxisSpace reserveSpace(Graphics2D g2, Plot plot, Rectangle2D plotArea, 
                              RectangleEdge edge, AxisSpace space) {

    // create a new space object if one wasn't supplied...
    if (space == null) {
        space = new AxisSpace();
    }
    
    // if the axis is not visible, no additional space is required...
    if (!isVisible()) {
        return space;
    }

    space = super.reserveSpace(g2, plot, plotArea, edge, space);
    double maxdim = getMaxDim(g2, edge);
    if (RectangleEdge.isTopOrBottom(edge)) {
        space.add(maxdim, edge);
    }
    else if (RectangleEdge.isLeftOrRight(edge)) {
        space.add(maxdim, edge);
    }
    return space;
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:35,代碼來源:SubCategoryAxis.java

示例9: draw

import org.jfree.chart.plot.Plot; //導入依賴的package包/類
/**
 * Draws the annotation.
 *
 * @param g2  the graphics device.
 * @param plot  the plot.
 * @param dataArea  the data area.
 * @param domainAxis  the domain axis.
 * @param rangeAxis  the range axis.
 */
public void draw(Graphics2D g2, XYPlot plot, Rectangle2D dataArea,
                 ValueAxis domainAxis, ValueAxis rangeAxis) {

    PlotOrientation orientation = plot.getOrientation();
    RectangleEdge domainEdge = Plot.resolveDomainAxisLocation(plot.getDomainAxisLocation(), 
                                                              orientation);
    RectangleEdge rangeEdge = Plot.resolveRangeAxisLocation(plot.getRangeAxisLocation(), 
                                                            orientation);
    float j2DX = (float) domainAxis.valueToJava2D(this.x, dataArea, domainEdge);
    float j2DY = (float) rangeAxis.valueToJava2D(this.y, dataArea, rangeEdge);
    Rectangle2D area = new Rectangle2D.Double(j2DX - this.width / 2.0,
                                              j2DY - this.height / 2.0,
                                              this.width, this.height);
    this.drawable.draw(g2, area);

}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:26,代碼來源:XYDrawableAnnotation.java

示例10: reserveSpace

import org.jfree.chart.plot.Plot; //導入依賴的package包/類
/**
 * Estimates the space required for the axis, given a specific drawing area.
 *
 * @param g2  the graphics device (used to obtain font information).
 * @param plot  the plot that the axis belongs to.
 * @param plotArea  the area within which the axis should be drawn.
 * @param edge  the axis location (top or bottom).
 * @param space  the space already reserved.
 *
 * @return The space required to draw the axis.
 */
public AxisSpace reserveSpace(Graphics2D g2, Plot plot, 
                              Rectangle2D plotArea, 
                              RectangleEdge edge, AxisSpace space) {

    // create a new space object if one wasn't supplied...
    if (space == null) {
        space = new AxisSpace();
    }
    
    // if the axis is not visible, no additional space is required...
    if (!isVisible()) {
        return space;
    }

    space = super.reserveSpace(g2, plot, plotArea, edge, space);
    double maxdim = getMaxDim(g2, edge);
    if (RectangleEdge.isTopOrBottom(edge)) {
        space.add(maxdim, edge);
    }
    else if (RectangleEdge.isLeftOrRight(edge)) {
        space.add(maxdim, edge);
    }
    return space;
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:36,代碼來源:SubCategoryAxis.java

示例11: autoAdjustRange

import org.jfree.chart.plot.Plot; //導入依賴的package包/類
/**
 * Rescales the axis to ensure that all data is visible.
 */
protected void autoAdjustRange() {

    Plot plot = getPlot();
    if (plot == null) {
        return;  // no plot, no data
    }

    if (plot instanceof ValueAxisPlot) {
        ValueAxisPlot vap = (ValueAxisPlot) plot;

        Range r = vap.getDataRange(this);
        if (r == null) {
            r = getDefaultAutoRange();
        }
        
        long upper = Math.round(r.getUpperBound());
        long lower = Math.round(r.getLowerBound());
        this.first = createInstance(this.autoRangeTimePeriodClass, 
                new Date(lower), this.timeZone);
        this.last = createInstance(this.autoRangeTimePeriodClass, 
                new Date(upper), this.timeZone);
        setRange(r, false, false);
    }

}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:29,代碼來源:PeriodAxis.java

示例12: setTimeSeriesRender

import org.jfree.chart.plot.Plot; //導入依賴的package包/類
public static void setTimeSeriesRender(Plot plot, boolean isShowData, boolean isShapesVisible) {

        XYPlot xyplot = (XYPlot) plot;
        xyplot.setNoDataMessage(NO_DATA_MSG);
        xyplot.setInsets(new RectangleInsets(10, 10, 5, 10));

        XYLineAndShapeRenderer xyRenderer = (XYLineAndShapeRenderer) xyplot.getRenderer();

        xyRenderer.setBaseItemLabelGenerator(new StandardXYItemLabelGenerator());
        xyRenderer.setBaseShapesVisible(false);
        if (isShowData) {
            xyRenderer.setBaseItemLabelsVisible(true);
            xyRenderer.setBaseItemLabelGenerator(new StandardXYItemLabelGenerator());
            xyRenderer.setBasePositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE1, TextAnchor.BOTTOM_CENTER));
        }
        xyRenderer.setBaseShapesVisible(isShapesVisible);

        DateAxis domainAxis = (DateAxis) xyplot.getDomainAxis();
        domainAxis.setAutoTickUnitSelection(false);
        DateTickUnit dateTickUnit = new DateTickUnit(DateTickUnitType.YEAR, 1, new SimpleDateFormat("yyyy-MM"));
        domainAxis.setTickUnit(dateTickUnit);

        StandardXYToolTipGenerator xyTooltipGenerator = new StandardXYToolTipGenerator("{1}:{2}", new SimpleDateFormat("yyyy-MM-dd"), new DecimalFormat("0"));
        xyRenderer.setBaseToolTipGenerator(xyTooltipGenerator);

        setXY_XAixs(xyplot);
        setXY_YAixs(xyplot);

    }
 
開發者ID:Fanping,項目名稱:iveely.ml,代碼行數:30,代碼來源:ChartUtils.java

示例13: makePlot

import org.jfree.chart.plot.Plot; //導入依賴的package包/類
@Override
protected Plot makePlot(final JFreeChartBuilder.PlotParameters parameters) {

    final DefaultKeyedValues2DDataset tmpDataset = this.getDataset();

    final CategoryAxis tmpCategoryAxis = this.makeCategoryAxis(domain);

    final ValueAxis tmpValueAxis = this.makeValueAxis(range);

    final StackedBarRenderer tmpRenderer = new StackedBarRenderer();
    tmpRenderer.setBarPainter(new StandardBarPainter());
    tmpRenderer.setShadowVisible(false);

    if (this.isTooltips()) {
        tmpRenderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator());
    }
    if (this.isUrls()) {
        tmpRenderer.setBaseItemURLGenerator(new StandardCategoryURLGenerator());
    }

    this.setColours(tmpRenderer, tmpDataset);

    final CategoryPlot retVal = new CategoryPlot(tmpDataset, tmpCategoryAxis, tmpValueAxis, tmpRenderer);
    retVal.setOrientation(parameters.getOrientation());
    retVal.setBackgroundPaint(parameters.getBackground());
    retVal.setOutlinePaint(parameters.getOutline());

    return retVal;
}
 
開發者ID:optimatika,項目名稱:ojAlgo-extensions,代碼行數:30,代碼來源:StackedBarChartBuilder.java

示例14: checkChart

import org.jfree.chart.plot.Plot; //導入依賴的package包/類
/**
 * Test that the chart is using an xy plot with time as the domain axis.
 * 
 * @param chart  the chart.
 */
private void checkChart(JFreeChart chart) {
    Plot plot = chart.getPlot();
    if (!(plot instanceof PolarPlot)) {
        throw new IllegalArgumentException("plot is not a PolarPlot");
   }
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:12,代碼來源:PolarChartPanel.java

示例15: resolveYAxis

import org.jfree.chart.plot.Plot; //導入依賴的package包/類
@Override
public Collection<String> resolveYAxis(int axisIndex) {
	Plot p = chart.getPlot();
	Collection<String> names = new LinkedList<>();
	if (p instanceof XYPlot) {
		XYPlot plot = (XYPlot) p;
		for (int i = 0; i < plot.getRangeAxisCount(); i++) {
			ValueAxis domain = plot.getRangeAxis(i);
			names.add(domain.getLabel());
		}
	}
	return names;
}
 
開發者ID:transwarpio,項目名稱:rapidminer,代碼行數:14,代碼來源:AbstractChartPanel.java


注:本文中的org.jfree.chart.plot.Plot類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。