- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试在 DynamicTimeSeriesCollection 中实现 XYTextAnnotation。我不知道如何在 DynamicTimeSeriesCollection 中找到系列的 X 值。到目前为止我的代码:
DynamicTimeSeriesCollection dataset = new DynamicTimeSeriesCollection(1, 60, new Minute());
final JFreeChart result = ChartFactory.createTimeSeriesChart(TITLE, "A", "B", dataset, true, true, false);
float[] series1Small = new float[10];
dataset.setTimeBase(new Minute(1, 1, 1, 1, 2013));
dataset.addSeries(series1Small,0,"1");
JFreeChart result = ChartFactory.createTimeSeriesChart(TITLE, "Время", "Платежи", dataset, true, true, false);
final XYPlot plot = result.getXYPlot();
-----------------------------------------------------------Below line doesn't work.
TimeSeriesDataItem item1 = series1.getDataItem(series1.getItemCount() - 1);
createAnnotation(item1,plot);
这是一个用于使用 TimeSeriesCollection 进行注释的函数。
public static void createAnnotation(TimeSeriesDataItem item,XYPlot plot)
{
double xAnnotation = item.getPeriod().getFirstMillisecond();
double yAnnotation = item.getValue().doubleValue();
XYTextAnnotation annotation = new XYTextAnnotation(item.getValue().toString(), xAnnotation, yAnnotation);
annotation.setFont(new Font("Arial",Font.BOLD,11));
plot.addAnnotation(annotation);
}
最佳答案
从这个 example 开始,我在 createChart()
中添加了以下几行以获得下图:
double x = dataset.getXValue(0, COUNT - 1);
double y = dataset.getYValue(0, COUNT - 1);
String s = dataset.getY(0, COUNT - 1).toString();
XYTextAnnotation a = new XYTextAnnotation(s, x, y);
a.setFont(a.getFont().deriveFont(24f));
plot.addAnnotation(a);
关于java - DynamicTimeSeriesCollection 中的 XYTextAnnotation,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18327071/
我正在尝试在 DynamicTimeSeriesCollection 中实现 XYTextAnnotation。我不知道如何在 DynamicTimeSeriesCollection 中找到系列的 X
本文整理了Java中org.jfree.chart.annotations.XYTextAnnotation.getPaint()方法的一些代码示例,展示了XYTextAnnotation.getPa
本文整理了Java中org.jfree.chart.annotations.XYTextAnnotation.getText()方法的一些代码示例,展示了XYTextAnnotation.getTex
本文整理了Java中org.jfree.chart.annotations.XYTextAnnotation.fireAnnotationChanged()方法的一些代码示例,展示了XYTextAnn
本文整理了Java中org.jfree.chart.annotations.XYTextAnnotation.addEntity()方法的一些代码示例,展示了XYTextAnnotation.addE
本文整理了Java中org.jfree.chart.annotations.XYTextAnnotation.getFont()方法的一些代码示例,展示了XYTextAnnotation.getFon
本文整理了Java中org.jfree.chart.annotations.XYTextAnnotation.getURL()方法的一些代码示例,展示了XYTextAnnotation.getURL(
本文整理了Java中org.jfree.chart.annotations.XYTextAnnotation.getRotationAngle()方法的一些代码示例,展示了XYTextAnnotati
本文整理了Java中org.jfree.chart.annotations.XYTextAnnotation.clone()方法的一些代码示例,展示了XYTextAnnotation.clone()的
本文整理了Java中org.jfree.chart.annotations.XYTextAnnotation.setPaint()方法的一些代码示例,展示了XYTextAnnotation.setPa
本文整理了Java中org.jfree.chart.annotations.XYTextAnnotation.setTextAnchor()方法的一些代码示例,展示了XYTextAnnotation.
本文整理了Java中org.jfree.chart.annotations.XYTextAnnotation.equals()方法的一些代码示例,展示了XYTextAnnotation.equals(
本文整理了Java中org.jfree.chart.annotations.XYTextAnnotation.()方法的一些代码示例,展示了XYTextAnnotation.()的具体用法。这些代码示
本文整理了Java中org.jfree.chart.annotations.XYTextAnnotation.setFont()方法的一些代码示例,展示了XYTextAnnotation.setFon
我是一名优秀的程序员,十分优秀!