本文整理匯總了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;
}
示例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);
}
}
示例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();
}
示例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;
}