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


Java XYPlot.setAxisOffset方法代碼示例

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


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

示例1: createChart

import org.jfree.chart.plot.XYPlot; //導入方法依賴的package包/類
/**
 * Creates a sample chart.
 * 
 * @param dataset  the dataset.
 * 
 * @return A sample chart.
 */
private static JFreeChart createChart(VectorXYDataset dataset) {
    NumberAxis xAxis = new NumberAxis("X");
    xAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    xAxis.setLowerMargin(0.01);
    xAxis.setUpperMargin(0.01);
    xAxis.setAutoRangeIncludesZero(false);
    
    NumberAxis yAxis = new NumberAxis("Y");
    yAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    yAxis.setLowerMargin(0.01);
    yAxis.setUpperMargin(0.01);
    yAxis.setAutoRangeIncludesZero(false);
    VectorRenderer renderer = new VectorRenderer();
    renderer.setSeriesPaint(0, Color.blue);
    XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer);
    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);
    plot.setAxisOffset(new RectangleInsets(5, 5, 5, 5));
    plot.setOutlinePaint(Color.black);
    JFreeChart chart = new JFreeChart("Vector Plot Demo 1", plot);
    chart.setBackgroundPaint(Color.white);
    return chart;
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:32,代碼來源:VectorPlotDemo1.java

示例2: createChart

import org.jfree.chart.plot.XYPlot; //導入方法依賴的package包/類
private static JFreeChart createChart(XYDataset dataset, String chartName) {
// create the chart...

if(chartName == null)
 chartName = FunctionToPlot;

JFreeChart chart = ChartFactory.createXYLineChart(
chartName,
Var,
Value,
dataset,
PlotOrientation.VERTICAL,
true,
true, 
false
);
chart.setBackgroundPaint(Color.white);

 XYPlot plot = (XYPlot) chart.getPlot();
 plot.setBackgroundPaint(Color.lightGray);
 plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
 plot.setDomainGridlinePaint(Color.white);
 plot.setRangeGridlinePaint(Color.white);
XYLineAndShapeRenderer renderer
= (XYLineAndShapeRenderer) plot.getRenderer();
//renderer.setShapesVisible(true);
//renderer.setShapesFilled(true);
// change the auto tick unit selection to integer units only...
 NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
rangeAxis.setLabelAngle(Math.PI/2.0);
 rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); // OPTIONAL CUSTOMISATION COMPLETED.
return chart;
 }
 
開發者ID:mathhobbit,項目名稱:EditCalculateAndChart,代碼行數:34,代碼來源:grPlt.java

示例3: createChart

import org.jfree.chart.plot.XYPlot; //導入方法依賴的package包/類
/**
 * Creates a chart.
 *
 * @param dataset  a dataset.
 *
 * @return A chart.
 */
private static JFreeChart createChart(XYDataset dataset) {

    JFreeChart chart = ChartFactory.createTimeSeriesChart(
        "Legal & General Unit Trust Prices",  // title
        "Date",             // x-axis label
        "Price Per Unit",   // y-axis label
        dataset,            // data
        true,               // create legend?
        true,               // generate tooltips?
        false               // generate URLs?
    );

    chart.setBackgroundPaint(Color.white);

    XYPlot plot = (XYPlot) chart.getPlot();
    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);
    plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
    plot.setDomainCrosshairVisible(true);
    plot.setRangeCrosshairVisible(true);

    XYItemRenderer r = plot.getRenderer();
    if (r instanceof XYLineAndShapeRenderer) {
        XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) r;
        renderer.setBaseShapesVisible(true);
        renderer.setBaseShapesFilled(true);
        renderer.setDrawSeriesLineAsPath(true);
    }

    DateAxis axis = (DateAxis) plot.getDomainAxis();
    axis.setDateFormatOverride(new SimpleDateFormat("MMM-yyyy"));

    return chart;

}
 
開發者ID:Yarichi,項目名稱:Proyecto-DASI,代碼行數:44,代碼來源:TimeSeriesChartDemo1.java

示例4: createChart

import org.jfree.chart.plot.XYPlot; //導入方法依賴的package包/類
/**
 * Creates a chart.
 * 
 * @param dataset  a dataset.
 * 
 * @return A chart.
 */
private static JFreeChart createChart(XYDataset dataset) {

    JFreeChart chart = ChartFactory.createTimeSeriesChart(
        "Legal & General Unit Trust Prices",  // title
        "Date",             // x-axis label
        "Price Per Unit",   // y-axis label
        dataset,            // data
        true,               // create legend?
        true,               // generate tooltips?
        false               // generate URLs?
    );

    chart.setBackgroundPaint(Color.white);

    XYPlot plot = (XYPlot) chart.getPlot();
    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);
    plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
    plot.setDomainCrosshairVisible(true);
    plot.setRangeCrosshairVisible(true);
    
    XYItemRenderer r = plot.getRenderer();
    if (r instanceof XYLineAndShapeRenderer) {
        XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) r;
        renderer.setBaseShapesVisible(true);
        renderer.setBaseShapesFilled(true);
    }
    
    DateAxis axis = (DateAxis) plot.getDomainAxis();
    axis.setDateFormatOverride(new SimpleDateFormat("MMM-yyyy"));
    
    return chart;

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

示例5: createChart

import org.jfree.chart.plot.XYPlot; //導入方法依賴的package包/類
private JFreeChart createChart(XYDataset dataset, boolean createLegend) {

		// create the chart...
		JFreeChart chart = ChartFactory.createXYLineChart(null,      // chart title
				null,                      // x axis label
				null,                      // y axis label
				dataset,                  // data
				PlotOrientation.VERTICAL, createLegend,                     // include legend
				true,                     // tooltips
				false                     // urls
				);

		chart.setBackgroundPaint(Color.white);

		// get a reference to the plot for further customization...
		XYPlot plot = (XYPlot) chart.getPlot();
		plot.setBackgroundPaint(Color.WHITE);
		plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
		plot.setDomainGridlinePaint(Color.LIGHT_GRAY);
		plot.setRangeGridlinePaint(Color.LIGHT_GRAY);

		DeviationRenderer renderer = new DeviationRenderer(true, false);
		Stroke stroke = new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND);
		if (dataset.getSeriesCount() == 1) {
			renderer.setSeriesStroke(0, stroke);
			renderer.setSeriesPaint(0, Color.RED);
			renderer.setSeriesFillPaint(0, Color.RED);
		} else {
			for (int i = 0; i < dataset.getSeriesCount(); i++) {
				renderer.setSeriesStroke(i, stroke);
				Color color = getColorProvider().getPointColor((double) i / (double) (dataset.getSeriesCount() - 1));
				renderer.setSeriesPaint(i, color);
				renderer.setSeriesFillPaint(i, color);
			}
		}
		renderer.setAlpha(0.12f);

		plot.setRenderer(renderer);

		ValueAxis valueAxis = plot.getRangeAxis();
		valueAxis.setLabelFont(LABEL_FONT_BOLD);
		valueAxis.setTickLabelFont(LABEL_FONT);

		return chart;
	}
 
開發者ID:transwarpio,項目名稱:rapidminer,代碼行數:46,代碼來源:DeviationChartPlotter.java

示例6: createChart

import org.jfree.chart.plot.XYPlot; //導入方法依賴的package包/類
private JFreeChart createChart(XYDataset dataset) {
	// create the chart...
	JFreeChart chart = ChartFactory.createXYLineChart(null,      // chart title
			null,                      // x axis label
			null,                      // y axis label
			dataset,                  // data
			PlotOrientation.VERTICAL, true,                     // include legend
			true,                     // tooltips
			false                     // urls
			);

	chart.setBackgroundPaint(Color.white);

	// get a reference to the plot for further customisation...
	XYPlot plot = (XYPlot) chart.getPlot();
	plot.setBackgroundPaint(Color.WHITE);
	plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
	plot.setDomainGridlinePaint(Color.LIGHT_GRAY);
	plot.setRangeGridlinePaint(Color.LIGHT_GRAY);

	ValueAxis valueAxis = plot.getRangeAxis();
	valueAxis.setLabelFont(PlotterAdapter.LABEL_FONT_BOLD);
	valueAxis.setTickLabelFont(PlotterAdapter.LABEL_FONT);

	ValueAxis domainAxis = plot.getDomainAxis();
	domainAxis.setLabelFont(PlotterAdapter.LABEL_FONT_BOLD);
	domainAxis.setTickLabelFont(PlotterAdapter.LABEL_FONT);

	DeviationRenderer renderer = new DeviationRenderer(true, false);
	Stroke stroke = new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND);
	if (dataset.getSeriesCount() == 1) {
		renderer.setSeriesStroke(0, stroke);
		renderer.setSeriesPaint(0, Color.RED);
		renderer.setSeriesFillPaint(0, Color.RED);
	} else if (dataset.getSeriesCount() == 2) {
		renderer.setSeriesStroke(0, stroke);
		renderer.setSeriesPaint(0, Color.RED);
		renderer.setSeriesFillPaint(0, Color.RED);

		renderer.setSeriesStroke(1, stroke);
		renderer.setSeriesPaint(1, Color.BLUE);
		renderer.setSeriesFillPaint(1, Color.BLUE);
	} else {
		for (int i = 0; i < dataset.getSeriesCount(); i++) {
			renderer.setSeriesStroke(i, stroke);
			Color color = colorProvider.getPointColor((double) i / (double) (dataset.getSeriesCount() - 1));
			renderer.setSeriesPaint(i, color);
			renderer.setSeriesFillPaint(i, color);
		}
	}
	renderer.setAlpha(0.12f);
	plot.setRenderer(renderer);

	// legend settings
	LegendTitle legend = chart.getLegend();
	if (legend != null) {
		legend.setPosition(RectangleEdge.TOP);
		legend.setFrame(BlockBorder.NONE);
		legend.setHorizontalAlignment(HorizontalAlignment.LEFT);
		legend.setItemFont(PlotterAdapter.LABEL_FONT);
	}
	return chart;
}
 
開發者ID:transwarpio,項目名稱:rapidminer,代碼行數:64,代碼來源:ROCChartPlotter.java

示例7: createChart

import org.jfree.chart.plot.XYPlot; //導入方法依賴的package包/類
/**
 * Creates a chart.
 * 
 * @param dataset  a dataset.
 * 
 * @return A chart.
 */
private static JFreeChart createChart(XYDataset dataset) {

    JFreeChart chart = ChartFactory.createTimeSeriesChart(
        "Legal & General Unit Trust Prices",  // title
        "Date",             // x-axis label
        "Price Per Unit",   // y-axis label
        dataset,            // data
        false,               // create legend?
        true,               // generate tooltips?
        false               // generate URLs?
    );

    chart.setBackgroundPaint(Color.white);

    XYPlot plot = (XYPlot) chart.getPlot();
    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);
    plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
    plot.setDomainCrosshairVisible(true);
    plot.setRangeCrosshairVisible(true);

    LegendTitle lt = new LegendTitle(plot);
    lt.setItemFont(new Font("Dialog", Font.PLAIN, 9));
    lt.setBackgroundPaint(new Color(200, 200, 255, 100));
    lt.setBorder(new BlockBorder(Color.white));
    lt.setPosition(RectangleEdge.BOTTOM);
    XYTitleAnnotation ta = new XYTitleAnnotation(0.98, 0.02, lt, 
            RectangleAnchor.BOTTOM_RIGHT);
    
    ta.setMaxWidth(0.48);
    plot.addAnnotation(ta);

    XYItemRenderer r = plot.getRenderer();
    if (r instanceof XYLineAndShapeRenderer) {
        XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) r;
        renderer.setBaseShapesVisible(true);
        renderer.setBaseShapesFilled(true);
    }
    
    DateAxis axis = (DateAxis) plot.getDomainAxis();
    axis.setDateFormatOverride(new SimpleDateFormat("MMM-yyyy"));
    
    ValueAxis yAxis = plot.getRangeAxis();
    yAxis.setLowerMargin(0.35);
    return chart;

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


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