本文整理汇总了Java中org.jfree.chart.axis.LogAxis类的典型用法代码示例。如果您正苦于以下问题:Java LogAxis类的具体用法?Java LogAxis怎么用?Java LogAxis使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LogAxis类属于org.jfree.chart.axis包,在下文中一共展示了LogAxis类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testTranslateToJava2D_LogAxis
import org.jfree.chart.axis.LogAxis; //导入依赖的package包/类
@Test
public void testTranslateToJava2D_LogAxis() {
Rectangle2D dataArea = new Rectangle2D.Double(0.0, 0.0, 100.0, 100.0);
ValueAxis axis = new LogAxis();
axis.setRange(1.0, 100.0);
PolarPlot plot = new PolarPlot(null, axis, null);
plot.setMargin(0);
plot.setAngleOffset(0.0);
Point point = plot.translateToJava2D(0.0, 10.0, axis, dataArea );
assertEquals(75.0, point.getX(), 0.5);
assertEquals(50.0, point.getY(), 0.5);
point = plot.translateToJava2D(90.0, 5.0, axis, dataArea );
assertEquals(50.0, point.getX(), 0.5);
assertEquals(67.5, point.getY(), 0.5);
point = plot.translateToJava2D(45.0, 20.0, axis, dataArea );
assertEquals(73.0, point.getX(), 0.5);
assertEquals(73.0, point.getY(), 0.5);
}
示例2: getInstance
import org.jfree.chart.axis.LogAxis; //导入依赖的package包/类
/**
* A static method that returns a panel that is appropriate for the axis
* type.
*
* @param axis the axis whose properties are to be displayed/edited in
* the panel.
*
* @return A panel or {@code null} if axis is {@code null}.
*/
public static DefaultAxisEditor getInstance(Axis axis) {
if (axis != null) {
// figure out what type of axis we have and instantiate the
// appropriate panel
if (axis instanceof NumberAxis) {
return new DefaultNumberAxisEditor((NumberAxis) axis);
}
if (axis instanceof LogAxis) {
return new DefaultLogAxisEditor((LogAxis) axis);
}
else {
return new DefaultAxisEditor(axis);
}
}
else {
return null;
}
}
示例3: testEquals
import org.jfree.chart.axis.LogAxis; //导入依赖的package包/类
/**
* Confirm that the equals method can distinguish all the required fields.
*/
public void testEquals() {
LogAxis a1 = new LogAxis("Test");
LogAxis a2 = new LogAxis("Test");
assertTrue(a1.equals(a2));
a1.setBase(2.0);
assertFalse(a1.equals(a2));
a2.setBase(2.0);
assertTrue(a1.equals(a2));
a1.setSmallestValue(0.1);
assertFalse(a1.equals(a2));
a2.setSmallestValue(0.1);
assertTrue(a1.equals(a2));
a1.setMinorTickCount(8);
assertFalse(a1.equals(a2));
a2.setMinorTickCount(8);
assertTrue(a1.equals(a2));
}
示例4: testTranslateJava2DToValue
import org.jfree.chart.axis.LogAxis; //导入依赖的package包/类
/**
* Test the translation of Java2D values to data values.
*/
public void testTranslateJava2DToValue() {
LogAxis axis = new LogAxis();
axis.setRange(50.0, 100.0);
Rectangle2D dataArea = new Rectangle2D.Double(10.0, 50.0, 400.0, 300.0);
double y1 = axis.java2DToValue(75.0, dataArea, RectangleEdge.LEFT);
assertEquals(94.3874312681693, y1, EPSILON);
double y2 = axis.java2DToValue(75.0, dataArea, RectangleEdge.RIGHT);
assertEquals(94.3874312681693, y2, EPSILON);
double x1 = axis.java2DToValue(75.0, dataArea, RectangleEdge.TOP);
assertEquals(55.961246381405, x1, EPSILON);
double x2 = axis.java2DToValue(75.0, dataArea, RectangleEdge.BOTTOM);
assertEquals(55.961246381405, x2, EPSILON);
axis.setInverted(true);
double y3 = axis.java2DToValue(75.0, dataArea, RectangleEdge.LEFT);
assertEquals(52.9731547179647, y3, EPSILON);
double y4 = axis.java2DToValue(75.0, dataArea, RectangleEdge.RIGHT);
assertEquals(52.9731547179647, y4, EPSILON);
double x3 = axis.java2DToValue(75.0, dataArea, RectangleEdge.TOP);
assertEquals(89.3475453695651, x3, EPSILON);
double x4 = axis.java2DToValue(75.0, dataArea, RectangleEdge.BOTTOM);
assertEquals(89.3475453695651, x4, EPSILON);
}
示例5: testAutoRange3
import org.jfree.chart.axis.LogAxis; //导入依赖的package包/类
/**
* A simple test for the auto-range calculation looking at a
* NumberAxis used as the range axis for a CategoryPlot. In this
* case, the original dataset is replaced with a new dataset.
*/
public void testAutoRange3() {
DefaultCategoryDataset dataset = new DefaultCategoryDataset();
dataset.setValue(100.0, "Row 1", "Column 1");
dataset.setValue(200.0, "Row 1", "Column 2");
JFreeChart chart = ChartFactory.createLineChart("Test", "Categories",
"Value", dataset, false);
CategoryPlot plot = (CategoryPlot) chart.getPlot();
LogAxis axis = new LogAxis("Log(Y)");
plot.setRangeAxis(axis);
assertEquals(96.59363289248458, axis.getLowerBound(), EPSILON);
assertEquals(207.0529847682752, axis.getUpperBound(), EPSILON);
// now replacing the dataset should update the axis range...
DefaultCategoryDataset dataset2 = new DefaultCategoryDataset();
dataset2.setValue(900.0, "Row 1", "Column 1");
dataset2.setValue(1000.0, "Row 1", "Column 2");
plot.setDataset(dataset2);
assertEquals(895.2712433374774, axis.getLowerBound(), EPSILON);
assertEquals(1005.2819262292991, axis.getUpperBound(), EPSILON);
}
示例6: testXYAutoRange1
import org.jfree.chart.axis.LogAxis; //导入依赖的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, false);
XYPlot plot = (XYPlot) chart.getPlot();
LogAxis axis = new LogAxis("Log(Y)");
plot.setRangeAxis(axis);
assertEquals(0.9465508226401592, axis.getLowerBound(), EPSILON);
assertEquals(3.1694019256486126, axis.getUpperBound(), EPSILON);
}
示例7: testXYAutoRange2
import org.jfree.chart.axis.LogAxis; //导入依赖的package包/类
/**
* Checks that the auto-range for the range axis on an XYPlot is
* working as expected.
*/
public void testXYAutoRange2() {
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, false);
XYPlot plot = (XYPlot) chart.getPlot();
LogAxis axis = new LogAxis("Log(Y)");
plot.setRangeAxis(axis);
assertEquals(0.9465508226401592, axis.getLowerBound(), EPSILON);
assertEquals(3.1694019256486126, axis.getUpperBound(), EPSILON);
}
示例8: getInstance
import org.jfree.chart.axis.LogAxis; //导入依赖的package包/类
/**
* A static method that returns a panel that is appropriate for the axis
* type.
*
* @param axis the axis whose properties are to be displayed/edited in
* the panel.
*
* @return A panel or <code>null</code< if axis is <code>null</code>.
*/
public static DefaultAxisEditor getInstance(Axis axis) {
if (axis != null) {
// figure out what type of axis we have and instantiate the
// appropriate panel
if (axis instanceof NumberAxis) {
return new DefaultNumberAxisEditor((NumberAxis) axis);
}
if (axis instanceof LogAxis) {
return new DefaultLogAxisEditor((LogAxis) axis);
}
else {
return new DefaultAxisEditor(axis);
}
}
else {
return null;
}
}
示例9: setAxisProperties
import org.jfree.chart.axis.LogAxis; //导入依赖的package包/类
/**
* Sets the properties of the specified axis to match the properties
* defined on this panel.
*
* @param axis the axis.
*/
@Override
public void setAxisProperties(Axis axis) {
super.setAxisProperties(axis);
LogAxis logAxis = (LogAxis) axis;
if (!isAutoTickUnitSelection()) {
logAxis.setTickUnit(new NumberTickUnit(manualTickUnitValue));
}
}
示例10: saveMeanVarPlot
import org.jfree.chart.axis.LogAxis; //导入依赖的package包/类
/**
* A mean-variance plot is log-log scaled, and a line can be drawn along the lowess fit
* @param datapoints : mean vs variance
* @param fitLine : coordinates (dataspace) of line
* @param outFilename
* @param rasterImage
*/
public void saveMeanVarPlot(Matrix datapoints, Matrix fitLine, String outFilename, boolean rasterImage){
this.setWidth(800);
this.setHeight(800);
this.setXLogScale(true);
this.setYLogScale(true);
this.addDataset("MV", datapoints, new Color(75,75,75,60), 3);
this.setXAxisLabel("Mean");
this.setYAxisLabel("Var");
this.setXRange(1, 100000);
this.setYRange(0.1, 1000000);
//Set the tick units according to the range
double xUpper = daxis.getRange().getUpperBound();
double xLower = daxis.getRange().getLowerBound();
if(daxis instanceof org.jfree.chart.axis.LogAxis)
((LogAxis)daxis).setTickUnit(new NumberTickUnit(1.0));
double yUpper = raxis.getRange().getUpperBound();
double yLower = raxis.getRange().getLowerBound();
if(raxis instanceof org.jfree.chart.axis.LogAxis)
((LogAxis)raxis).setTickUnit(new NumberTickUnit(1.0));
if(fitLine!=null){
//Draw a blue line along mean=var (Poisson)
XYLineAnnotation lineAnnot = new XYLineAnnotation(xLower, xLower, xUpper, xUpper, new BasicStroke(2), Color.blue);
this.plot.addAnnotation(lineAnnot);
//Draw a red line along the fit line
this.addDataset("Fit", fitLine, Color.RED, 3, false, true, false);
}
try {
this.saveImage(new File(outFilename), width, height, rasterImage);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
示例11: Histogram
import org.jfree.chart.axis.LogAxis; //导入依赖的package包/类
public Histogram(Displayable displayable) {
super(new BorderLayout());
if (displayable == null) {
throw new NullPointerException();
}
this.displayable = displayable;
setBackground(MainFrame.THEME_COLOR);
logAxis = new LogAxis();
linAxis = new NumberAxis();
domainAxis = new NumberAxis();
barRenderer = new XYBarRenderer();
plot = new XYPlot();
chart = new JFreeChart(plot);
chartPanel = new ChartPanel(chart) {
@Override
public void restoreAutoBounds() {
super.restoreAutoBounds();
domainAxis.setRange(new Range(Histogram.this.displayable.getMatrix().getMinValue(), Histogram.this.displayable.getMatrix().getMaxValue()));
}
};
menuLog = new JMenuItem("Linear");
log = true;
configureChart();
add(chartPanel, BorderLayout.CENTER);
initPlot();
}
示例12: buildLogAxis
import org.jfree.chart.axis.LogAxis; //导入依赖的package包/类
private LogAxis buildLogAxis() {
LogAxis logAxis = new LogAxis();
logAxis.setNumberFormatOverride(new DecimalFormat("###,###,###,###"));
logAxis.setLowerMargin(.02);
logAxis.setUpperMargin(.02);
return logAxis;
}
示例13: testHashCode
import org.jfree.chart.axis.LogAxis; //导入依赖的package包/类
/**
* Two objects that are equal are required to return the same hashCode.
*/
public void testHashCode() {
LogAxis a1 = new LogAxis("Test");
LogAxis a2 = new LogAxis("Test");
assertTrue(a1.equals(a2));
int h1 = a1.hashCode();
int h2 = a2.hashCode();
assertEquals(h1, h2);
}
示例14: testAutoRange1
import org.jfree.chart.axis.LogAxis; //导入依赖的package包/类
/**
* A simple test for the auto-range calculation looking at a
* LogAxis used as the range axis for a CategoryPlot.
*/
public void testAutoRange1() {
DefaultCategoryDataset dataset = new DefaultCategoryDataset();
dataset.setValue(100.0, "Row 1", "Column 1");
dataset.setValue(200.0, "Row 1", "Column 2");
JFreeChart chart = ChartFactory.createBarChart("Test", "Categories",
"Value", dataset, false);
CategoryPlot plot = (CategoryPlot) chart.getPlot();
LogAxis axis = new LogAxis("Log(Y)");
plot.setRangeAxis(axis);
assertEquals(0.0, axis.getLowerBound(), EPSILON);
assertEquals(2.6066426411261268E7, axis.getUpperBound(), EPSILON);
}
示例15: testSetLowerBound
import org.jfree.chart.axis.LogAxis; //导入依赖的package包/类
/**
* Some checks for the setLowerBound() method.
*/
public void testSetLowerBound() {
LogAxis axis = new LogAxis("X");
axis.setRange(0.0, 10.0);
axis.setLowerBound(5.0);
assertEquals(5.0, axis.getLowerBound(), EPSILON);
axis.setLowerBound(10.0);
assertEquals(10.0, axis.getLowerBound(), EPSILON);
assertEquals(11.0, axis.getUpperBound(), EPSILON);
}