本文整理汇总了Java中org.jfree.chart.annotations.XYTextAnnotation.setRotationAngle方法的典型用法代码示例。如果您正苦于以下问题:Java XYTextAnnotation.setRotationAngle方法的具体用法?Java XYTextAnnotation.setRotationAngle怎么用?Java XYTextAnnotation.setRotationAngle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jfree.chart.annotations.XYTextAnnotation
的用法示例。
在下文中一共展示了XYTextAnnotation.setRotationAngle方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createPlot
import org.jfree.chart.annotations.XYTextAnnotation; //导入方法依赖的package包/类
/**
* Creates a sample plot.
*
* @return A sample plot.
*/
private CombinedDomainXYPlot createPlot() {
// create subplot 1...
XYDataset data1 = createDataset1();
XYItemRenderer renderer1 = new StandardXYItemRenderer();
NumberAxis rangeAxis1 = new NumberAxis("Range 1");
XYPlot subplot1 = new XYPlot(data1, null, rangeAxis1, renderer1);
subplot1.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT);
XYTextAnnotation annotation = new XYTextAnnotation("Hello!", 50.0, 10000.0);
annotation.setFont(new Font("SansSerif", Font.PLAIN, 9));
annotation.setRotationAngle(Math.PI / 4.0);
subplot1.addAnnotation(annotation);
// create subplot 2...
XYDataset data2 = createDataset2();
XYItemRenderer renderer2 = new StandardXYItemRenderer();
NumberAxis rangeAxis2 = new NumberAxis("Range 2");
rangeAxis2.setAutoRangeIncludesZero(false);
XYPlot subplot2 = new XYPlot(data2, null, rangeAxis2, renderer2);
subplot2.setRangeAxisLocation(AxisLocation.TOP_OR_LEFT);
// parent plot...
CombinedDomainXYPlot plot = new CombinedDomainXYPlot(new NumberAxis("Domain"));
plot.setGap(10.0);
// add the subplots...
plot.add(subplot1, 1);
plot.add(subplot2, 1);
plot.setOrientation(PlotOrientation.VERTICAL);
return plot;
}
示例2: createPlot
import org.jfree.chart.annotations.XYTextAnnotation; //导入方法依赖的package包/类
/**
* Creates a sample plot.
*
* @return A sample plot.
*/
private CombinedRangeXYPlot createPlot() {
// create subplot 1...
XYDataset data1 = createDataset1();
XYItemRenderer renderer1 = new StandardXYItemRenderer();
NumberAxis rangeAxis1 = new NumberAxis("Range 1");
XYPlot subplot1 = new XYPlot(data1, null, rangeAxis1, renderer1);
subplot1.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT);
XYTextAnnotation annotation = new XYTextAnnotation("Hello!", 50.0, 10000.0);
annotation.setFont(new Font("SansSerif", Font.PLAIN, 9));
annotation.setRotationAngle(Math.PI / 4.0);
subplot1.addAnnotation(annotation);
// create subplot 2...
XYDataset data2 = createDataset2();
XYItemRenderer renderer2 = new StandardXYItemRenderer();
NumberAxis rangeAxis2 = new NumberAxis("Range 2");
rangeAxis2.setAutoRangeIncludesZero(false);
XYPlot subplot2 = new XYPlot(data2, null, rangeAxis2, renderer2);
subplot2.setRangeAxisLocation(AxisLocation.TOP_OR_LEFT);
// parent plot...
CombinedRangeXYPlot plot = new CombinedRangeXYPlot(new NumberAxis("Range"));
plot.setGap(10.0);
// add the subplots...
plot.add(subplot1, 1);
plot.add(subplot2, 1);
plot.setOrientation(PlotOrientation.VERTICAL);
return plot;
}
示例3: createPlot
import org.jfree.chart.annotations.XYTextAnnotation; //导入方法依赖的package包/类
/**
* Creates a sample plot.
*
* @return A sample plot.
*/
private CombinedDomainXYPlot createPlot() {
// create subplot 1...
XYDataset data1 = createDataset1();
XYItemRenderer renderer1 = new StandardXYItemRenderer();
NumberAxis rangeAxis1 = new NumberAxis("Range 1");
XYPlot subplot1 = new XYPlot(data1, null, rangeAxis1, renderer1);
subplot1.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT);
XYTextAnnotation annotation
= new XYTextAnnotation("Hello!", 50.0, 10000.0);
annotation.setFont(new Font("SansSerif", Font.PLAIN, 9));
annotation.setRotationAngle(Math.PI / 4.0);
subplot1.addAnnotation(annotation);
// create subplot 2...
XYDataset data2 = createDataset2();
XYItemRenderer renderer2 = new StandardXYItemRenderer();
NumberAxis rangeAxis2 = new NumberAxis("Range 2");
rangeAxis2.setAutoRangeIncludesZero(false);
XYPlot subplot2 = new XYPlot(data2, null, rangeAxis2, renderer2);
subplot2.setRangeAxisLocation(AxisLocation.TOP_OR_LEFT);
// parent plot...
CombinedDomainXYPlot plot
= new CombinedDomainXYPlot(new NumberAxis("Domain"));
plot.setGap(10.0);
// add the subplots...
plot.add(subplot1, 1);
plot.add(subplot2, 1);
plot.setOrientation(PlotOrientation.VERTICAL);
return plot;
}
示例4: createPlot
import org.jfree.chart.annotations.XYTextAnnotation; //导入方法依赖的package包/类
/**
* Creates a sample plot.
*
* @return A sample plot.
*/
private CombinedRangeXYPlot createPlot() {
// create subplot 1...
XYDataset data1 = createDataset1();
XYItemRenderer renderer1 = new StandardXYItemRenderer();
NumberAxis rangeAxis1 = new NumberAxis("Range 1");
XYPlot subplot1 = new XYPlot(data1, null, rangeAxis1, renderer1);
subplot1.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT);
XYTextAnnotation annotation
= new XYTextAnnotation("Hello!", 50.0, 10000.0);
annotation.setFont(new Font("SansSerif", Font.PLAIN, 9));
annotation.setRotationAngle(Math.PI / 4.0);
subplot1.addAnnotation(annotation);
// create subplot 2...
XYDataset data2 = createDataset2();
XYItemRenderer renderer2 = new StandardXYItemRenderer();
NumberAxis rangeAxis2 = new NumberAxis("Range 2");
rangeAxis2.setAutoRangeIncludesZero(false);
XYPlot subplot2 = new XYPlot(data2, null, rangeAxis2, renderer2);
subplot2.setRangeAxisLocation(AxisLocation.TOP_OR_LEFT);
// parent plot...
CombinedRangeXYPlot plot
= new CombinedRangeXYPlot(new NumberAxis("Range"));
plot.setGap(10.0);
// add the subplots...
plot.add(subplot1, 1);
plot.add(subplot2, 1);
plot.setOrientation(PlotOrientation.VERTICAL);
return plot;
}
示例5: createPlot
import org.jfree.chart.annotations.XYTextAnnotation; //导入方法依赖的package包/类
/**
* Creates a sample plot.
*
* @return A sample plot.
*/
private CombinedDomainXYPlot createPlot() {
// create subplot 1...
XYDataset data1 = createDataset1();
XYItemRenderer renderer1 = new StandardXYItemRenderer();
NumberAxis rangeAxis1 = new NumberAxis("Range 1");
XYPlot subplot1 = new XYPlot(data1, null, rangeAxis1, renderer1);
subplot1.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT);
XYTextAnnotation annotation = new XYTextAnnotation("Hello!", 50.0,
10000.0);
annotation.setFont(new Font("SansSerif", Font.PLAIN, 9));
annotation.setRotationAngle(Math.PI / 4.0);
subplot1.addAnnotation(annotation);
// create subplot 2...
XYDataset data2 = createDataset2();
XYItemRenderer renderer2 = new StandardXYItemRenderer();
NumberAxis rangeAxis2 = new NumberAxis("Range 2");
rangeAxis2.setAutoRangeIncludesZero(false);
XYPlot subplot2 = new XYPlot(data2, null, rangeAxis2, renderer2);
subplot2.setRangeAxisLocation(AxisLocation.TOP_OR_LEFT);
// parent plot...
CombinedDomainXYPlot plot = new CombinedDomainXYPlot(
new NumberAxis("Domain"));
plot.setGap(10.0);
// add the subplots...
plot.add(subplot1, 1);
plot.add(subplot2, 1);
plot.setOrientation(PlotOrientation.VERTICAL);
return plot;
}
示例6: createPlot
import org.jfree.chart.annotations.XYTextAnnotation; //导入方法依赖的package包/类
/**
* Creates a sample plot.
*
* @return A sample plot.
*/
private CombinedRangeXYPlot createPlot() {
// create subplot 1...
XYDataset data1 = createDataset1();
XYItemRenderer renderer1 = new StandardXYItemRenderer();
NumberAxis xAxis1 = new NumberAxis("X1");
XYPlot subplot1 = new XYPlot(data1, xAxis1, null, renderer1);
subplot1.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT);
XYTextAnnotation annotation
= new XYTextAnnotation("Hello!", 50.0, 10000.0);
annotation.setFont(new Font("SansSerif", Font.PLAIN, 9));
annotation.setRotationAngle(Math.PI / 4.0);
subplot1.addAnnotation(annotation);
// create subplot 2...
XYDataset data2 = createDataset2();
XYItemRenderer renderer2 = new StandardXYItemRenderer();
NumberAxis xAxis2 = new NumberAxis("X2");
xAxis2.setAutoRangeIncludesZero(false);
XYPlot subplot2 = new XYPlot(data2, xAxis2, null, renderer2);
subplot2.setRangeAxisLocation(AxisLocation.TOP_OR_LEFT);
// parent plot...
CombinedRangeXYPlot plot = new CombinedRangeXYPlot(new NumberAxis(
"Range"));
plot.setGap(10.0);
// add the subplots...
plot.add(subplot1, 1);
plot.add(subplot2, 1);
plot.setOrientation(PlotOrientation.VERTICAL);
return plot;
}
示例7: createCombinedChart
import org.jfree.chart.annotations.XYTextAnnotation; //导入方法依赖的package包/类
/**
* Creates a combined chart.
*
* @return the combined chart.
*/
private static JFreeChart createCombinedChart() {
// create subplot 1...
final XYDataset data1 = createDataset1();
final XYItemRenderer renderer1 = new StandardXYItemRenderer();
final NumberAxis rangeAxis1 = new NumberAxis( "Range 1" );
final XYPlot subplot1 = new XYPlot( data1, null, rangeAxis1, renderer1 );
subplot1.setRangeAxisLocation( AxisLocation.BOTTOM_OR_LEFT );
final XYTextAnnotation annotation = new XYTextAnnotation( "Hello!", 50.0, 10000.0 );
annotation.setFont( new Font( "SansSerif", Font.PLAIN, 9 ) );
annotation.setRotationAngle( Math.PI / 4.0 );
subplot1.addAnnotation( annotation );
// create subplot 2...
final XYDataset data2 = createDataset2();
final XYItemRenderer renderer2 = new StandardXYItemRenderer();
final NumberAxis rangeAxis2 = new NumberAxis( "Range 2" );
rangeAxis2.setAutoRangeIncludesZero( false );
final XYPlot subplot2 = new XYPlot( data2, null, rangeAxis2, renderer2 );
subplot2.setRangeAxisLocation( AxisLocation.TOP_OR_LEFT );
// parent plot...
final CombinedDomainXYPlot plot = new CombinedDomainXYPlot( new NumberAxis( "Domain" ) );
plot.setGap( 10.0 );
// add the subplots...
plot.add( subplot1, 1 );
plot.add( subplot2, 1 );
plot.setOrientation( PlotOrientation.VERTICAL );
// return a new chart containing the overlaid plot...
return new JFreeChart( "CombinedDomainXYPlot Demo",
JFreeChart.DEFAULT_TITLE_FONT, plot, true );
}
示例8: createCombinedChart
import org.jfree.chart.annotations.XYTextAnnotation; //导入方法依赖的package包/类
private static JFreeChart createCombinedChart() {
// create subplot 1...
final XYItemRenderer renderer1 = new StandardXYItemRenderer();
final NumberAxis rangeAxis1 = new NumberAxis( "Range 1" );
final XYPlot subplot1 = new XYPlot( createDataset1(), null, rangeAxis1, renderer1 );
subplot1.setRangeAxisLocation( AxisLocation.BOTTOM_OR_LEFT );
final XYTextAnnotation annotation = new XYTextAnnotation( "Hello!", 50.0, 10000.0 );
annotation.setFont( new Font( "SansSerif", Font.PLAIN, 9 ) );
annotation.setRotationAngle( Math.PI / 4.0 );
subplot1.addAnnotation( annotation );
// create subplot 2...
final XYItemRenderer renderer2 = new StandardXYItemRenderer();
final NumberAxis rangeAxis2 = new NumberAxis( "Range 2" );
rangeAxis2.setAutoRangeIncludesZero( false );
final XYPlot subplot2 = new XYPlot( createDataset2(), null, rangeAxis2, renderer2 );
subplot2.setRangeAxisLocation( AxisLocation.TOP_OR_LEFT );
// parent plot...
final CombinedDomainXYPlot plot = new CombinedDomainXYPlot( new NumberAxis( "Domain" ) );
plot.setGap( 10.0 );
// add the subplots...
plot.add( subplot1, 1 );
plot.add( subplot2, 1 );
plot.setOrientation( PlotOrientation.VERTICAL );
// return a new chart containing the overlaid plot...
return new JFreeChart( "CombinedDomainXYPlot Demo",
JFreeChart.DEFAULT_TITLE_FONT, plot, true );
}
示例9: createPlot
import org.jfree.chart.annotations.XYTextAnnotation; //导入方法依赖的package包/类
/**
* Creates a sample plot.
*
* @return A sample plot.
*/
private CombinedDomainXYPlot createPlot() {
// create subplot 1...
XYDataset data1 = createDataset1();
XYItemRenderer renderer1 = new StandardXYItemRenderer();
NumberAxis rangeAxis1 = new NumberAxis("Range 1");
XYPlot subplot1 = new XYPlot(data1, null, rangeAxis1, renderer1);
subplot1.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT);
XYTextAnnotation annotation
= new XYTextAnnotation("Hello!", 50.0, 10000.0);
annotation.setFont(new Font("SansSerif", Font.PLAIN, 9));
annotation.setRotationAngle(Math.PI / 4.0);
subplot1.addAnnotation(annotation);
// create subplot 2...
XYDataset data2 = createDataset2();
XYItemRenderer renderer2 = new StandardXYItemRenderer();
NumberAxis rangeAxis2 = new NumberAxis("Range 2");
rangeAxis2.setAutoRangeIncludesZero(false);
XYPlot subplot2 = new XYPlot(data2, null, rangeAxis2, renderer2);
subplot2.setRangeAxisLocation(AxisLocation.TOP_OR_LEFT);
// parent plot...
CombinedDomainXYPlot plot
= new CombinedDomainXYPlot(new NumberAxis("Domain"));
plot.setGap(10.0);
// add the subplots...
plot.add(subplot1, 1);
plot.add(subplot2, 1);
plot.setOrientation(PlotOrientation.VERTICAL);
return plot;
}
示例10: addAnnotation
import org.jfree.chart.annotations.XYTextAnnotation; //导入方法依赖的package包/类
public void addAnnotation( String text, double x ) {
XYPlot plot = (XYPlot) getChart().getPlot();
Color color = new Color(0, 0, 0, 100);
Marker updateMarker = new ValueMarker(x, color, new BasicStroke(2f));
plot.addDomainMarker(updateMarker);
if (text != null) {
XYTextAnnotation updateLabel = new XYTextAnnotation(text, x, 0);
updateLabel.setRotationAnchor(TextAnchor.BASELINE_CENTER);
updateLabel.setTextAnchor(TextAnchor.BASELINE_CENTER);
updateLabel.setRotationAngle(-3.14 / 2);
updateLabel.setPaint(Color.black);
plot.addAnnotation(updateLabel);
}
setShapeLinesVisibility(plot);
}
示例11: createVLineAnnotation
import org.jfree.chart.annotations.XYTextAnnotation; //导入方法依赖的package包/类
protected XYTextAnnotation createVLineAnnotation(long chartX, double chartHeight) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd MMM yyyy");
double chartY = mainYAxis.getLowerBound()+ 35*mainYAxis.getRange().getLength() / (chartHeight*(CHARTS_TOTAL_WEIGHT-indicPlotWeight)/CHARTS_TOTAL_WEIGHT);
XYTextAnnotation vLineLabel = new XYTextAnnotation(simpleDateFormat.format(chartX), chartX, chartY);
vLineLabel.setFont(mainYAxis.getTickLabelFont().deriveFont(8f));
vLineLabel.setRotationAnchor(TextAnchor.BASELINE_CENTER);
vLineLabel.setTextAnchor(TextAnchor.BASELINE_CENTER);
vLineLabel.setRotationAngle(-3.14 / 2);
vLineLabel.setPaint(Color.black);
return vLineLabel;
}
示例12: createCombinedChart
import org.jfree.chart.annotations.XYTextAnnotation; //导入方法依赖的package包/类
/**
* Creates a combined chart.
*
* @return the combined chart.
*/
private JFreeChart createCombinedChart() {
// create subplot 1...
final XYDataset data1 = createDataset1();
final XYItemRenderer renderer1 = new StandardXYItemRenderer();
final NumberAxis rangeAxis1 = new NumberAxis("Range 1");
final XYPlot subplot1 = new XYPlot(data1, null, rangeAxis1, renderer1);
subplot1.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT);
final XYTextAnnotation annotation = new XYTextAnnotation("Hello!", 50.0, 10000.0);
annotation.setFont(new Font("SansSerif", Font.PLAIN, 9));
annotation.setRotationAngle(Math.PI / 4.0);
subplot1.addAnnotation(annotation);
// create subplot 2...
final XYDataset data2 = createDataset2();
final XYItemRenderer renderer2 = new StandardXYItemRenderer();
final NumberAxis rangeAxis2 = new NumberAxis("Range 2");
rangeAxis2.setAutoRangeIncludesZero(false);
final XYPlot subplot2 = new XYPlot(data2, null, rangeAxis2, renderer2);
subplot2.setRangeAxisLocation(AxisLocation.TOP_OR_LEFT);
// parent plot...
final CombinedDomainXYPlot plot = new CombinedDomainXYPlot(new NumberAxis("Domain"));
plot.setGap(10.0);
// add the subplots...
plot.add(subplot1, 1);
plot.add(subplot2, 1);
plot.setOrientation(PlotOrientation.VERTICAL);
// return a new chart containing the overlaid plot...
return new JFreeChart("CombinedDomainXYPlot Demo",
JFreeChart.DEFAULT_TITLE_FONT, plot, true);
}
示例13: createCombinedChart
import org.jfree.chart.annotations.XYTextAnnotation; //导入方法依赖的package包/类
/**
* Creates a combined chart.
*
* @return The combined chart.
*/
private JFreeChart createCombinedChart() {
// create subplot 1...
final XYDataset data1 = createDataset1();
final XYItemRenderer renderer1 = new StandardXYItemRenderer();
final NumberAxis rangeAxis1 = new NumberAxis("Range 1");
final XYPlot subplot1 = new XYPlot(data1, null, rangeAxis1, renderer1);
subplot1.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT);
// add secondary axis
subplot1.setDataset(1, createDataset2());
final NumberAxis axis2 = new NumberAxis("Range Axis 2");
axis2.setAutoRangeIncludesZero(false);
subplot1.setRangeAxis(1, axis2);
subplot1.setRangeAxisLocation(1, AxisLocation.BOTTOM_OR_RIGHT);
subplot1.setRenderer(1, new StandardXYItemRenderer());
subplot1.mapDatasetToRangeAxis(1, 1);
final XYTextAnnotation annotation = new XYTextAnnotation("Hello!", 50.0, 10000.0);
annotation.setFont(new Font("SansSerif", Font.PLAIN, 9));
annotation.setRotationAngle(Math.PI / 4.0);
subplot1.addAnnotation(annotation);
// create subplot 2...
final XYDataset data2 = createDataset2();
final XYItemRenderer renderer2 = new StandardXYItemRenderer();
final NumberAxis rangeAxis2 = new NumberAxis("Range 2");
rangeAxis2.setAutoRangeIncludesZero(false);
final XYPlot subplot2 = new XYPlot(data2, null, rangeAxis2, renderer2);
subplot2.setRangeAxisLocation(AxisLocation.TOP_OR_LEFT);
// parent plot...
final CombinedDomainXYPlot plot = new CombinedDomainXYPlot(new NumberAxis("Domain"));
plot.setGap(10.0);
// add the subplots...
plot.add(subplot1, 1);
plot.add(subplot2, 1);
plot.setOrientation(PlotOrientation.VERTICAL);
// return a new chart containing the overlaid plot...
return new JFreeChart("CombinedDomainXYPlot Demo",
JFreeChart.DEFAULT_TITLE_FONT, plot, true);
}