当前位置: 首页>>代码示例>>Java>>正文


Java NumberTickUnit类代码示例

本文整理汇总了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 );
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:26,代码来源:ZoomControl.java

示例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 );
            }
        }
    }
 
开发者ID:mleoking,项目名称:PhET,代码行数:27,代码来源:ZoomControl.java

示例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));
    }

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:27,代码来源:LogAxis.java

示例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();
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:25,代码来源:ChartNode.java

示例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;
}
 
开发者ID:modsim,项目名称:vizardous,代码行数:25,代码来源:CellDivisionTimeChart2D.java

示例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;
}
 
开发者ID:foryuki,项目名称:viewpark,代码行数:24,代码来源:ImageAction.java

示例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;
    }
}
 
开发者ID:scalalab,项目名称:scalalab,代码行数:25,代码来源:jPlot.java

示例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);
  }
}
 
开发者ID:debrief,项目名称:limpet,代码行数:26,代码来源:ChartBuilder.java

示例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;
}
 
开发者ID:BrainTech,项目名称:svarog,代码行数:27,代码来源:RocDialog.java

示例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));
}
 
开发者ID:BrainTech,项目名称:svarog,代码行数:23,代码来源:ResponseChartPanel.java

示例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;
}
 
开发者ID:BrainTech,项目名称:svarog,代码行数:22,代码来源:DtfOrderCriteriaPanel.java

示例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);

}
 
开发者ID:pseppecher,项目名称:jamel,代码行数:21,代码来源:JamelAxis.java

示例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));

    
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:36,代码来源:NumberAxisTests.java

示例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);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:13,代码来源:LogAxis.java

示例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));
    
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:40,代码来源:NumberAxisTests.java


注:本文中的org.jfree.chart.axis.NumberTickUnit类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。