本文整理汇总了Java中org.jfree.chart.axis.NumberAxis类的典型用法代码示例。如果您正苦于以下问题:Java NumberAxis类的具体用法?Java NumberAxis怎么用?Java NumberAxis使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NumberAxis类属于org.jfree.chart.axis包,在下文中一共展示了NumberAxis类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createWindPlot
import org.jfree.chart.axis.NumberAxis; //导入依赖的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: createPolarChart
import org.jfree.chart.axis.NumberAxis; //导入依赖的package包/类
/**
* Creates a polar plot for the specified dataset (x-values interpreted as
* angles in degrees). The chart object returned by this method uses a
* {@link PolarPlot} instance as the plot, with a {@link NumberAxis} for
* the radial axis.
*
* @param title the chart title (<code>null</code> permitted).
* @param dataset the dataset (<code>null</code> permitted).
* @param legend legend required?
* @param tooltips tooltips required?
* @param urls URLs required?
*
* @return A chart.
*/
public static JFreeChart createPolarChart(String title,
XYDataset dataset,
boolean legend,
boolean tooltips,
boolean urls) {
PolarPlot plot = new PolarPlot();
plot.setDataset(dataset);
NumberAxis rangeAxis = new NumberAxis();
rangeAxis.setAxisLineVisible(false);
rangeAxis.setTickMarksVisible(false);
rangeAxis.setTickLabelInsets(new RectangleInsets(0.0, 0.0, 0.0, 0.0));
plot.setAxis(rangeAxis);
plot.setRenderer(new DefaultPolarItemRenderer());
JFreeChart chart = new JFreeChart(
title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
return chart;
}
示例3: ThermometerPlot
import org.jfree.chart.axis.NumberAxis; //导入依赖的package包/类
/**
* Creates a new thermometer plot, using default attributes where necessary.
*
* @param dataset the data set.
*/
public ThermometerPlot(ValueDataset dataset) {
super();
this.padding = new RectangleInsets(UnitType.RELATIVE, 0.05, 0.05, 0.05,
0.05);
this.dataset = dataset;
if (dataset != null) {
dataset.addChangeListener(this);
}
NumberAxis axis = new NumberAxis(null);
axis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
axis.setAxisLineVisible(false);
setRangeAxis(axis);
setAxisRange();
}
示例4: plotSeperate
import org.jfree.chart.axis.NumberAxis; //导入依赖的package包/类
private void plotSeperate(XYDataset dataset, String p)
{
NumberAxis rangeAxis1 = new NumberAxis(p);
rangeAxis1.setAutoRangeIncludesZero(false); // override default
rangeAxis1.setLowerMargin(0.40); // to leave room for volume bars
DecimalFormat format = new DecimalFormat("0");
rangeAxis1.setNumberFormatOverride(format);
final ValueAxis timeAxis = new DateAxis("Date");
timeAxis.setLowerMargin(0.02); // reduce the default margins
timeAxis.setUpperMargin(0.02);
XYPlot plot = new XYPlot(dataset, timeAxis, rangeAxis1, null);
XYItemRenderer renderer1 = new XYLineAndShapeRenderer(true, false);
renderer1.setBaseToolTipGenerator(
new StandardXYToolTipGenerator(
StandardXYToolTipGenerator.DEFAULT_TOOL_TIP_FORMAT,
new SimpleDateFormat("d-MMM-yyyy"), new DecimalFormat("0.00#")
)
);
plot.setRenderer(0, renderer1);
final CombinedDomainXYPlot cplot1 = (CombinedDomainXYPlot)this.candlestickChart.getPlot();
if (plot != null) cplot1.add(plot, 1); // weight is 1.
}
示例5: raster
import org.jfree.chart.axis.NumberAxis; //导入依赖的package包/类
public void raster(Collection<Spike> spikes,String title)
{
CombinedDomainXYPlot plot = new CombinedDomainXYPlot(new NumberAxis("Time"));
// Build a plot for each layer
for (int i=0; i<net.nLayers(); i++)
plot.add(layerRaster(spikes,net.lay(i)),1);
JFreeChart chart= new JFreeChart("Raster: "+title,JFreeChart.DEFAULT_TITLE_FONT, plot,true);
// Put it in a frame!
JFrame fr=new JFrame();
fr.getContentPane().add(new ChartPanel(chart));
fr.setSize(1200,1000);
fr.setVisible(true);
}
示例6: layerRaster
import org.jfree.chart.axis.NumberAxis; //导入依赖的package包/类
public XYPlot layerRaster(Collection<Spike> spikes,Layer lay)
{
// throw new UnsupportedOperationException("This is broken for now!");
// Add the data
Iterator<Spike> itr=spikes.iterator();
XYSeries data=new XYSeries("Events");
for (int i=0; i<spikes.size(); i++)
{ Spike evt=itr.next();
if (evt.layer==lay.ixLayer)
data.add((float)evt.time/1000,evt.addr);
}
XYDataset raster = new XYSeriesCollection(data);
//SamplingXYLineAndShapeRenderer renderer = new SamplingXYLineAndShapeRenderer(false, true);
XYDotRenderer renderer = new XYDotRenderer();
renderer.setDotWidth(2);
renderer.setDotHeight(5);
return new XYPlot(raster, null, new NumberAxis("Layer "+lay.ixLayer), renderer);
}
示例7: createChart
import org.jfree.chart.axis.NumberAxis; //导入依赖的package包/类
/**
* Creates a sample chart.
*
* @param dataset the dataset.
*
* @return The chart.
*/
private static JFreeChart createChart(CategoryDataset dataset) {
JFreeChart chart = ChartFactory.createBarChart(
"Performance: JFreeSVG vs Batik", null /* x-axis label*/,
"Milliseconds" /* y-axis label */, dataset, PlotOrientation.HORIZONTAL,false,false,false);
chart.addSubtitle(new TextTitle("Time to generate 1000 charts in SVG "
+ "format (lower bars = better performance)"));
chart.setBackgroundPaint(Color.white);
CategoryPlot plot = (CategoryPlot) chart.getPlot();
// ******************************************************************
// More than 150 demo applications are included with the JFreeChart
// Developer Guide...for more information, see:
//
// > http://www.object-refinery.com/jfreechart/guide.html
//
// ******************************************************************
NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
BarRenderer renderer = (BarRenderer) plot.getRenderer();
renderer.setDrawBarOutline(false);
// chart.getLegend().setFrame(BlockBorder.NONE);
return chart;
}
示例8: createHighLowChart
import org.jfree.chart.axis.NumberAxis; //导入依赖的package包/类
/**
* Creates and returns a default instance of a high-low-open-close chart.
*
* @param title the chart title (<code>null</code> permitted).
* @param timeAxisLabel a label for the time axis (<code>null</code>
* permitted).
* @param valueAxisLabel a label for the value axis (<code>null</code>
* permitted).
* @param dataset the dataset for the chart (<code>null</code> permitted).
* @param legend a flag specifying whether or not a legend is required.
*
* @return A high-low-open-close chart.
*/
public static JFreeChart createHighLowChart(String title,
String timeAxisLabel,
String valueAxisLabel,
OHLCDataset dataset,
boolean legend) {
ValueAxis timeAxis = new DateAxis(timeAxisLabel);
NumberAxis valueAxis = new NumberAxis(valueAxisLabel);
HighLowRenderer renderer = new HighLowRenderer();
renderer.setBaseToolTipGenerator(new HighLowItemLabelGenerator());
XYPlot plot = new XYPlot(dataset, timeAxis, valueAxis, renderer);
JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
plot, legend);
return chart;
}
示例9: visualizarSerieChartAsignRescateVict
import org.jfree.chart.axis.NumberAxis; //导入依赖的package包/类
public void visualizarSerieChartAsignRescateVict(Color color,CategoryDataset dataset) {
ChartPanel chartPanel = new ChartPanel(chartNotifAsigResc);
chartNotifAsigResc.setBackgroundPaint(Color.white);
CategoryPlot plot = (CategoryPlot) chartNotifAsigResc.getPlot();
plot.setBackgroundPaint(color);
plot.setDataset(dataset);
plot.setDomainGridlinePaint(Color.white);
plot.setRangeGridlinePaint(Color.white);
NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
rangeAxis.setUpperMargin(0.15);
CategoryItemRenderer renderer = plot.getRenderer();
renderer.setItemLabelGenerator(new LabelGenerator(50.0));
renderer.setItemLabelFont(new Font("Serif", Font.PLAIN, 8));
renderer.setItemLabelsVisible(true);
chartPanel.setPreferredSize(new java.awt.Dimension(500, 270));
setContentPane(chartPanel);
this.pack();
RefineryUtilities.centerFrameOnScreen(this);
this.setVisible(true);
}
示例10: visualizarSeriesTiemposRescateVictPorRobots
import org.jfree.chart.axis.NumberAxis; //导入依赖的package包/类
public void visualizarSeriesTiemposRescateVictPorRobots(CategoryDataset dataset) {
JFreeChart chart = ChartFactory.createBarChart(
"Tiempos de Rescate de Victimas por cada robot ", // chart title
"Robots en el entorno", // domain axis label
"Tiempo milisegundos", // range axis label
dataset, // data
PlotOrientation.VERTICAL, // orientation
true, // include legend
true, // tooltips?
false // URLs?
);
ChartPanel chartPanel = new ChartPanel(chart);
chart.setBackgroundPaint(Color.white);
CategoryPlot plot = chart.getCategoryPlot();
plot.setBackgroundPaint(Color.lightGray);
plot.setDomainGridlinePaint(Color.white);
plot.setRangeGridlinePaint(Color.white);
NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
rangeAxis.setUpperMargin(0.15);
CategoryItemRenderer renderer = plot.getRenderer();
renderer.setItemLabelGenerator(new LabelGenerator(50.0));
renderer.setItemLabelFont(new Font("Serif", Font.PLAIN, 8));
renderer.setItemLabelsVisible(true);
chartPanel.setPreferredSize(new java.awt.Dimension(500, 270));
this.visualizar(chartPanel);
}
示例11: makeValueAxis
import org.jfree.chart.axis.NumberAxis; //导入依赖的package包/类
@SuppressWarnings("unchecked")
protected final <A extends ValueAxis> A makeValueAxis(final JFreeChartBuilder.AxisParameters parameters) {
final A retVal = (A) new NumberAxis(parameters.getLabel());
if (parameters.isIntervalSet()) {
retVal.setAutoRange(false);
retVal.setRange(parameters.getInterval());
} else {
retVal.setAutoRange(true);
}
((NumberAxis) retVal).setNumberFormatOverride(parameters.getFormat());
return retVal;
}
示例12: createCandlestickChart
import org.jfree.chart.axis.NumberAxis; //导入依赖的package包/类
/**
* Creates and returns a default instance of a candlesticks chart.
*
* @param title the chart title (<code>null</code> permitted).
* @param timeAxisLabel a label for the time axis (<code>null</code> permitted).
* @param valueAxisLabel a label for the value axis (<code>null</code> permitted).
* @param dataset the dataset for the chart (<code>null</code> permitted).
* @param legend a flag specifying whether or not a legend is required.
*
* @return a candlestick chart.
*/
public static JFreeChart createCandlestickChart(String title,
String timeAxisLabel,
String valueAxisLabel,
OHLCDataset dataset,
boolean legend) {
ValueAxis timeAxis = new DateAxis(timeAxisLabel);
NumberAxis valueAxis = new NumberAxis(valueAxisLabel);
XYPlot plot = new XYPlot(dataset, timeAxis, valueAxis, null);
plot.setRenderer(new CandlestickRenderer());
JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
return chart;
}
示例13: createHighLowChart
import org.jfree.chart.axis.NumberAxis; //导入依赖的package包/类
/**
* Creates and returns a default instance of a high-low-open-close chart with
* a special timeline. This timeline can be a {@link org.jfree.chart.axis.SegmentedTimeline}
* such as the Monday trough Friday timeline that will remove Saturdays and Sundays from
* the axis.
*
* @param title the chart title (<code>null</code> permitted).
* @param timeAxisLabel a label for the time axis (<code>null</code> permitted).
* @param valueAxisLabel a label for the value axis (<code>null</code> permitted).
* @param dataset the dataset for the chart (<code>null</code> permitted).
* @param timeline the timeline.
* @param legend a flag specifying whether or not a legend is required.
*
* @return a high-low-open-close chart.
*/
public static JFreeChart createHighLowChart(String title,
String timeAxisLabel,
String valueAxisLabel,
OHLCDataset dataset,
Timeline timeline,
boolean legend) {
DateAxis timeAxis = new DateAxis(timeAxisLabel);
timeAxis.setTimeline(timeline);
NumberAxis valueAxis = new NumberAxis(valueAxisLabel);
HighLowRenderer renderer = new HighLowRenderer();
renderer.setToolTipGenerator(new HighLowItemLabelGenerator());
XYPlot plot = new XYPlot(dataset, timeAxis, valueAxis, renderer);
JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
return chart;
}
示例14: testXYAutoRange1
import org.jfree.chart.axis.NumberAxis; //导入依赖的package包/类
/**
* Checks that the auto-range for the domain axis on an XYPlot is
* working as expected.
*/
public void testXYAutoRange1() {
XYSeries series = new XYSeries("Series 1");
series.add(1.0, 1.0);
series.add(2.0, 2.0);
series.add(3.0, 3.0);
XYSeriesCollection dataset = new XYSeriesCollection();
dataset.addSeries(series);
JFreeChart chart = ChartFactory.createScatterPlot(
"Test",
"X",
"Y",
dataset,
PlotOrientation.VERTICAL,
false,
false,
false
);
XYPlot plot = (XYPlot) chart.getPlot();
NumberAxis axis = (NumberAxis) plot.getDomainAxis();
axis.setAutoRangeIncludesZero(false);
assertEquals(0.9, axis.getLowerBound(), EPSILON);
assertEquals(3.1, axis.getUpperBound(), EPSILON);
}
示例15: createBoxAndWhiskerChart
import org.jfree.chart.axis.NumberAxis; //导入依赖的package包/类
/**
* Creates and returns a default instance of a box and whisker chart.
*
* @param title the chart title (<code>null</code> permitted).
* @param timeAxisLabel a label for the time axis (<code>null</code> permitted).
* @param valueAxisLabel a label for the value axis (<code>null</code> permitted).
* @param dataset the dataset for the chart (<code>null</code> permitted).
* @param legend a flag specifying whether or not a legend is required.
*
* @return a box and whisker chart.
*/
public static JFreeChart createBoxAndWhiskerChart(String title,
String timeAxisLabel,
String valueAxisLabel,
BoxAndWhiskerXYDataset dataset,
boolean legend) {
ValueAxis timeAxis = new DateAxis(timeAxisLabel);
NumberAxis valueAxis = new NumberAxis(valueAxisLabel);
valueAxis.setAutoRangeIncludesZero(false);
XYBoxAndWhiskerRenderer renderer = new XYBoxAndWhiskerRenderer(10.0);
XYPlot plot = new XYPlot(dataset, timeAxis, valueAxis, renderer);
JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
return chart;
}