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


Java ValueAxis.setRange方法代碼示例

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


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

示例1: createWindPlot

import org.jfree.chart.axis.ValueAxis; //導入方法依賴的package包/類
/**
 * Creates a wind plot with default settings.
 *
 * @param title  the chart title (<code>null</code> permitted).
 * @param xAxisLabel  a label for the x-axis (<code>null</code> permitted).
 * @param yAxisLabel  a label for the y-axis (<code>null</code> permitted).
 * @param dataset  the dataset for the chart (<code>null</code> permitted).
 * @param legend  a flag that controls whether or not a legend is created.
 * @param tooltips  configure chart to generate tool tips?
 * @param urls  configure chart to generate URLs?
 *
 * @return A wind plot.
 *
 */
public static JFreeChart createWindPlot(String title,
                                        String xAxisLabel,
                                        String yAxisLabel,
                                        WindDataset dataset,
                                        boolean legend,
                                        boolean tooltips,
                                        boolean urls) {

    ValueAxis xAxis = new DateAxis(xAxisLabel);
    ValueAxis yAxis = new NumberAxis(yAxisLabel);
    yAxis.setRange(-12.0, 12.0);

    WindItemRenderer renderer = new WindItemRenderer();
    if (tooltips) {
        renderer.setToolTipGenerator(new StandardXYToolTipGenerator());
    }
    if (urls) {
        renderer.setURLGenerator(new StandardXYURLGenerator());
    }
    XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer);
    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);

    return chart;

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

示例2: zoom

import org.jfree.chart.axis.ValueAxis; //導入方法依賴的package包/類
/**
 * Zooms the axis ranges by the specified percentage about the anchor point.
 *
 * @param percent  the amount of the zoom.
 */
public void zoom(double percent) {

    if (percent > 0.0) {
        ValueAxis domainAxis1 = getDomainAxis();
        Range range = domainAxis1.getRange();
        double center = range.getCentralValue();
        double length = range.getLength();
        double scaledRange = length * percent;
        domainAxis1.setRange(center - scaledRange / 2.0, center + scaledRange / 2.0);

        ValueAxis rangeAxis1 = getRangeAxis();
        range = rangeAxis1.getRange();
        center = range.getCentralValue();
        length = range.getLength();
        scaledRange = length * percent;
        rangeAxis1.setRange(center - scaledRange / 2.0, center + scaledRange / 2.0);
    }
    else {
        getRangeAxis().setAutoRange(true);
        getDomainAxis().setAutoRange(true);
    }

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

示例3: updateChart

import org.jfree.chart.axis.ValueAxis; //導入方法依賴的package包/類
public void updateChart(double[] data) {

		this.removeAll();
		this.revalidate();

		series = new XYSeries("XYGraph");
		for(int i=0; i<data.length;i++){
			if(data[i]>-1){
				series.add(5*i , data[i]/255 );
			}
		}

		dataset = new XYSeriesCollection();
		dataset.addSeries(series);


		chart = ChartFactory.createScatterPlot(
				null, // Title
				"ω [rad/s]", // x-axis Label
				"Q / Qmax", // y-axis Label
				dataset, // Dataset
				PlotOrientation.VERTICAL, 
				false, // Show Legend
				true, // Use tooltips
				false // Configure chart to generate URLs?
				);
		XYPlot plot = (XYPlot) chart.getPlot();
		plot.setBackgroundPaint( Color.WHITE );

		XYItemRenderer renderer = plot.getRenderer();
		renderer.setSeriesPaint(0, Color.RED);
		double delta = 2.0;
		Shape shape1 = new Rectangle2D.Double(-delta, -delta, delta, delta);
		renderer.setSeriesShape(0, shape1);

		ValueAxis yAxis = plot.getRangeAxis();
		yAxis.setRange(0, 1.1);
		ValueAxis xAxis = plot.getDomainAxis();
		xAxis.setRange(0, 2000);

		ChartPanel cp = new ChartPanel(chart);
		cp.setBackground(Color.WHITE);

		this.setLayout(new BorderLayout());
		this.add(cp, BorderLayout.CENTER);
		this.repaint();

	}
 
開發者ID:Tosbert,項目名稱:FizeauExperimentSimulation,代碼行數:49,代碼來源:GraphPanel.java

示例4: createWindPlot

import org.jfree.chart.axis.ValueAxis; //導入方法依賴的package包/類
/**
 * Creates a wind plot with default settings.
 *
 * @param title  the chart title (<code>null</code> permitted).
 * @param xAxisLabel  a label for the x-axis (<code>null</code> permitted).
 * @param yAxisLabel  a label for the y-axis (<code>null</code> permitted).
 * @param dataset  the dataset for the chart (<code>null</code> permitted).
 * @param legend  a flag that controls whether or not a legend is created.
 * @param tooltips  configure chart to generate tool tips?
 * @param urls  configure chart to generate URLs?
 *
 * @return A wind plot.
 *
 */
public static JFreeChart createWindPlot(String title,
                                        String xAxisLabel,
                                        String yAxisLabel,
                                        WindDataset dataset,
                                        boolean legend,
                                        boolean tooltips,
                                        boolean urls) {

    ValueAxis xAxis = new DateAxis(xAxisLabel);
    ValueAxis yAxis = new NumberAxis(yAxisLabel);
    yAxis.setRange(-12.0, 12.0);

    WindItemRenderer renderer = new WindItemRenderer();
    if (tooltips) {
        renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator());
    }
    if (urls) {
        renderer.setURLGenerator(new StandardXYURLGenerator());
    }
    XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer);
    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
            plot, legend);

    return chart;

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


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