本文整理汇总了Java中org.jfree.chart.axis.NumberTickUnit类的典型用法代码示例。如果您正苦于以下问题:Java NumberTickUnit类的具体用法?Java NumberTickUnit怎么用?Java NumberTickUnit使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
NumberTickUnit类属于org.jfree.chart.axis包,在下文中一共展示了NumberTickUnit类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setRange
import org.jfree.chart.axis.NumberTickUnit; //导入依赖的package包/类
private void setRange( int index ) {
ZoomSpec spec = _specs[ index ];
Range range = spec.getRange();
double tickSpacing = spec.getTickSpacing();
String tickPattern = spec.getTickPattern();
TickUnits tickUnits = new TickUnits();
tickUnits.add( new NumberTickUnit( tickSpacing, new DecimalFormat( tickPattern ) ) );
Iterator i = _plots.iterator();
while ( i.hasNext() ) {
XYPlot plot = (XYPlot) i.next();
if ( _orientation == HORIZONTAL ) {
plot.getDomainAxis().setRange( range );
plot.getDomainAxis().setStandardTickUnits( tickUnits );
}
else {
plot.getRangeAxis().setRange( range );
plot.getRangeAxis().setStandardTickUnits( tickUnits );
}
}
_zoomInButton.setEnabled( index > 0 );
_zoomOutButton.setEnabled( index < _specs.length - 1 );
}
示例2: updateAxis
import org.jfree.chart.axis.NumberTickUnit; //导入依赖的package包/类
private void updateAxis() {
// Range
AxisSpec axisSpec = _zoomSpec.getAxisSpec( _zoomIndex );
Range range = axisSpec.getRange();
// Ticks
double tickSpacing = axisSpec.getTickSpacing();
DecimalFormat tickFormat = axisSpec.getTickFormat();
TickUnits tickUnits = new TickUnits();
tickUnits.add( new NumberTickUnit( tickSpacing, tickFormat ) );
// Adjust the proper axis in each plot
Iterator i = _plots.iterator();
while ( i.hasNext() ) {
XYPlot plot = (XYPlot) i.next();
if ( _orientation == HORIZONTAL ) {
plot.getDomainAxis().setRange( range );
plot.getDomainAxis().setStandardTickUnits( tickUnits );
}
else {
plot.getRangeAxis().setRange( range );
plot.getRangeAxis().setStandardTickUnits( tickUnits );
}
}
}
示例3: setTickUnit
import org.jfree.chart.axis.NumberTickUnit; //导入依赖的package包/类
/**
* Sets the tick unit for the axis and, if requested, sends an
* {@link AxisChangeEvent} to all registered listeners. In addition, an
* option is provided to turn off the "auto-select" feature for tick units
* (you can restore it using the
* {@link ValueAxis#setAutoTickUnitSelection(boolean)} method).
*
* @param unit the new tick unit (<code>null</code> not permitted).
* @param notify notify listeners?
* @param turnOffAutoSelect turn off the auto-tick selection?
*/
public void setTickUnit(NumberTickUnit unit, boolean notify,
boolean turnOffAutoSelect) {
if (unit == null) {
throw new IllegalArgumentException("Null 'unit' argument.");
}
this.tickUnit = unit;
if (turnOffAutoSelect) {
setAutoTickUnitSelection(false, false);
}
if (notify) {
notifyListeners(new AxisChangeEvent(this));
}
}
示例4: EatingAndExerciseControlGraph
import org.jfree.chart.axis.NumberTickUnit; //导入依赖的package包/类
public EatingAndExerciseControlGraph( PhetPCanvas canvas, ControlGraphSeries series, String title, int minY, int maxY, TimeSeriesModel timeSeriesModel ) {
super( canvas, series, title, minY, maxY, timeSeriesModel );
gradientButtonNode = new HTMLImageButtonNode( EatingAndExerciseResources.getString( "time.reset" ), new PhetFont( Font.BOLD, 12 ), Color.green );
gradientButtonNode.addActionListener( new ActionListener() {
public void actionPerformed( ActionEvent e ) {
resetChartArea();
}
} );
addChild( gradientButtonNode );
axisLabel = new PNode();
PText text = new EatingAndExercisePText( EatingAndExerciseResources.getString( "units.time.yrs" ) );
axisLabel.addChild( text );
axisLabel.addChild( new PhetPPath( new Arrow( new Point2D.Double( text.getFullBounds().getMaxX(), text.getFullBounds().getCenterY() ),
new MutableVector2D( 20, 0 ), 6, 6, 2, 0.5, true ).getShape(), Color.black ) );
addChild( axisLabel );
NumberAxis numberAxis = (NumberAxis) getJFreeChartNode().getChart().getXYPlot().getDomainAxis();
numberAxis.setTickUnit( new NumberTickUnit( 2.0 * DEFAULT_RANGE_YEARS / 12.0 ) );
numberAxis.setNumberFormatOverride( new YearMonthFormat() );
relayout();
}
示例5: createJFreeChart
import org.jfree.chart.axis.NumberTickUnit; //导入依赖的package包/类
@Override
public final JFreeChart createJFreeChart(XYDataset dataset) {
String timeUnit = this.forest.getMetaxml().getAllFrames().get(0).getElapsedTimeUnit();
// create the chart...
final JFreeChart chart = ChartFactory.createXYLineChart("Individual division times", // chart title
"Generation [-]", // domain axis label
String.format("Division time [%s]", timeUnit), // range axis label
dataset, // data
PlotOrientation.VERTICAL, // orientation
true, // include legend
true, // tooltips
false // urls
);
this.styleChart(chart);
// Customize the domain axis
final NumberAxis domainAxis = (NumberAxis) chart.getXYPlot().getDomainAxis();
domainAxis.setTickUnit(new NumberTickUnit(1.0)); // Generations are
// integers..
return chart;
}
示例6: BarChart
import org.jfree.chart.axis.NumberTickUnit; //导入依赖的package包/类
public String BarChart() {
DefaultCategoryDataset dataset = new DefaultCategoryDataset();
List<Datas> list = new IncomeDao().getDatas2(park.getParkid());
for (Datas datas : list) {
dataset.addValue(datas.getMoney(), "", datas.getYear() + "年"
+ datas.getMonth() + "月");
}
ChartFactory.setChartTheme(getStandardChartTheme());
chart = ChartFactory.createBarChart3D("停车场柱状图", "月份", "金额", dataset,
PlotOrientation.VERTICAL, true, false, false);// 数据区的方向
CategoryPlot plot = (CategoryPlot) chart.getPlot();
CategoryAxis axis = plot.getDomainAxis();// 数据区的分类轴
axis.setLowerMargin(0);// 分类轴下(左)边距
axis.setUpperMargin(0);// 分类轴上(右)边距
axis.setLabelFont(new Font("宋体", Font.BOLD, 14));// 坐标轴标题字体
axis.setTickLabelFont(new Font("宋体", Font.BOLD, 14));// 坐标轴标尺值字体
NumberAxis numberaxis = (NumberAxis) plot.getRangeAxis();// 获取纵轴坐标
numberaxis.setTickLabelPaint(Color.GRAY);// 纵轴标签颜色
numberaxis.setAutoTickUnitSelection(false); // 纵坐标的默认间距值
numberaxis.setTickUnit(new NumberTickUnit(300));// 设置纵坐标间距值
chart.setTitle(getTitle());
return SUCCESS;
}
示例7: setTickUnit
import org.jfree.chart.axis.NumberTickUnit; //导入依赖的package包/类
/**
* Defines delta between ticks on the specified axis.
*
* @param delta the delta
*/
public void setTickUnit(AxisEnum axis, double delta) {
if (m_chart != null) {
NumberAxis rangeAxis = getAxis(axis);
// change the auto tick unit selection to integer units only...
// rangeAxis.setStandardTickUnits(NumberAxis.createStandardTickUnits());
rangeAxis.setTickUnit(new NumberTickUnit(delta));
}
switch (axis) {
case X:
m_xTickDelta = delta;
break;
case Y:
m_yTickDelta = delta;
break;
}
}
示例8: getTickUnit
import org.jfree.chart.axis.NumberTickUnit; //导入依赖的package包/类
@Override
public final NumberTickUnit getTickUnit()
{
final NumberTickUnit tickUnit = super.getTickUnit();
if (tickUnit.getSize() < 15)
{
return tickUnit;
}
else if (tickUnit.getSize() < 45)
{
return new NumberTickUnit(30);
}
else if (tickUnit.getSize() < 90)
{
return new NumberTickUnit(45);
}
else if (tickUnit.getSize() < 180)
{
return new NumberTickUnit(90);
}
else
{
return new NumberTickUnit(180);
}
}
示例9: getRocPlot
import org.jfree.chart.axis.NumberTickUnit; //导入依赖的package包/类
public XYPlot getRocPlot() {
if (rocPlot == null) {
NumberAxis xAxis = new NumberAxis();
xAxis.setAutoRange(false);
xAxis.setRange(0,1);
xAxis.setTickUnit(new NumberTickUnit(0.2));
xAxis.setLabel(_("False positive rate"));
NumberAxis yAxis = new NumberAxis();
yAxis.setAutoRange(false);
yAxis.setRange(0,1);
yAxis.setTickUnit(new NumberTickUnit(0.2));
yAxis.setLabel(_("True positive rate"));
rocPlot = new XYPlot(null, xAxis, yAxis, getPlotRenderer());
AxisSpace axisSpace = new AxisSpace();
axisSpace.setBottom(AXIS_SPACE_SIZE);
axisSpace.setLeft(AXIS_SPACE_SIZE);
rocPlot.setFixedDomainAxisSpace(axisSpace);
rocPlot.setFixedRangeAxisSpace(axisSpace);
}
return rocPlot;
}
示例10: setMaximumDomainAxisValue
import org.jfree.chart.axis.NumberTickUnit; //导入依赖的package包/类
/**
* Sets the maximum value to be shown on the domain axis (x-axis).
* @param maximum maximum value to be shown
*/
public void setMaximumDomainAxisValue(double maximum) {
NumberAxis domainAxis = (NumberAxis) getPlot().getDomainAxis();
double unit = maximum / 16;
if (unit > 0.65) {
unit = Math.round(unit);
} else if (unit > 0.25) {
unit = 0.5;
} else if (unit > 0.1) {
unit = 0.25;
} else {
unit = 0.1;
}
domainAxis.setRange(0, maximum);
domainAxis.setTickUnit(new NumberTickUnit(unit));
}
示例11: createChart
import org.jfree.chart.axis.NumberTickUnit; //导入依赖的package包/类
private static JFreeChart createChart(final XYSeriesWithLegend[] criteria) {
final XYSeriesCollection dataset = new XYSeriesCollection();
for (XYSeries serie : criteria) {
dataset.addSeries(serie);
}
final JFreeChart chart = ChartFactory.createXYLineChart("Model order selection", "model order", "criterion value", dataset, PlotOrientation.VERTICAL, true, false, false);
final XYPlot plot = chart.getXYPlot();
((NumberAxis) plot.getDomainAxis()).setTickUnit(new NumberTickUnit(1.0));
final XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer();
renderer.setLegendItemToolTipGenerator(new XYSeriesLabelGenerator() {
@Override
public String generateLabel(XYDataset xyd, int i) {
return (i>=0 && i<criteria.length) ? criteria[i].getLegend() : "";
}
});
for (int i=0; i<dataset.getSeriesCount(); ++i) {
renderer.setSeriesShapesVisible(i, true);
renderer.setSeriesShapesFilled(i, true);
}
return chart;
}
示例12: selectAutoTickUnit
import org.jfree.chart.axis.NumberTickUnit; //导入依赖的package包/类
@Override
protected void selectAutoTickUnit(Graphics2D g2, Rectangle2D dataArea, RectangleEdge edge) {
final double raw = this.getRange().getLength();
final double magnitude = Math.pow(10, Math.floor(Math.log10(raw)));
double newSize = magnitude / 5;
while (true) {
int nticks = (int) (raw / newSize);
if (nticks <= 10) {
break;
}
newSize = newSize * 2;
}
if (this.integerUnit && newSize < 1) {
newSize = 1;
}
final NumberTickUnit unit2 = new NumberTickUnit(newSize);
setTickUnit(unit2, false, false);
}
示例13: testEquals
import org.jfree.chart.axis.NumberTickUnit; //导入依赖的package包/类
/**
* Confirm that the equals method can distinguish all the required fields.
*/
public void testEquals() {
NumberAxis a1 = new NumberAxis("Test");
NumberAxis a2 = new NumberAxis("Test");
assertTrue(a1.equals(a2));
//private boolean autoRangeIncludesZero;
a1.setAutoRangeIncludesZero(false);
assertFalse(a1.equals(a2));
a2.setAutoRangeIncludesZero(false);
assertTrue(a1.equals(a2));
//private boolean autoRangeStickyZero;
a1.setAutoRangeStickyZero(false);
assertFalse(a1.equals(a2));
a2.setAutoRangeStickyZero(false);
assertTrue(a1.equals(a2));
//private NumberTickUnit tickUnit;
a1.setTickUnit(new NumberTickUnit(25.0));
assertFalse(a1.equals(a2));
a2.setTickUnit(new NumberTickUnit(25.0));
assertTrue(a1.equals(a2));
//private NumberFormat numberFormatOverride;
a1.setNumberFormatOverride(new DecimalFormat("0.00"));
assertFalse(a1.equals(a2));
a2.setNumberFormatOverride(new DecimalFormat("0.00"));
assertTrue(a1.equals(a2));
}
示例14: LogAxis
import org.jfree.chart.axis.NumberTickUnit; //导入依赖的package包/类
/**
* Creates a new <code>LogAxis</code> with the given label.
*
* @param label the axis label (<code>null</code> permitted).
*/
public LogAxis(String label) {
super(label, NumberAxis.createIntegerTickUnits());
setDefaultAutoRange(new Range(0.01, 1.0));
this.tickUnit = new NumberTickUnit(1.0);
this.minorTickCount = 10;
this.setTickMarksVisible(false);
}
示例15: testEquals
import org.jfree.chart.axis.NumberTickUnit; //导入依赖的package包/类
/**
* Confirm that the equals method can distinguish all the required fields.
*/
public void testEquals() {
NumberAxis a1 = new NumberAxis("Test");
NumberAxis a2 = new NumberAxis("Test");
assertTrue(a1.equals(a2));
//private boolean autoRangeIncludesZero;
a1.setAutoRangeIncludesZero(false);
assertFalse(a1.equals(a2));
a2.setAutoRangeIncludesZero(false);
assertTrue(a1.equals(a2));
//private boolean autoRangeStickyZero;
a1.setAutoRangeStickyZero(false);
assertFalse(a1.equals(a2));
a2.setAutoRangeStickyZero(false);
assertTrue(a1.equals(a2));
//private NumberTickUnit tickUnit;
a1.setTickUnit(new NumberTickUnit(25.0));
assertFalse(a1.equals(a2));
a2.setTickUnit(new NumberTickUnit(25.0));
assertTrue(a1.equals(a2));
//private NumberFormat numberFormatOverride;
a1.setNumberFormatOverride(new DecimalFormat("0.00"));
assertFalse(a1.equals(a2));
a2.setNumberFormatOverride(new DecimalFormat("0.00"));
assertTrue(a1.equals(a2));
a1.setRangeType(RangeType.POSITIVE);
assertFalse(a1.equals(a2));
a2.setRangeType(RangeType.POSITIVE);
assertTrue(a1.equals(a2));
}