当前位置: 首页>>代码示例>>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;未经允许,请勿转载。