Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-mvc/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java JFreeChart IntervalMarker垂直标签_Java_Rotation_Jfreechart_Marker - Fatal编程技术网

Java JFreeChart IntervalMarker垂直标签

Java JFreeChart IntervalMarker垂直标签,java,rotation,jfreechart,marker,Java,Rotation,Jfreechart,Marker,我想旋转间隔标记的标签: IntervalMarker im = new IntervalMarker(...); im.setLabel("LABEL"); // im.setLabelOffsetType(LengthAdjustmentType.EXPAND); // im.setLabelOffset(new RectangleInsets(10.0, 10.0, 10.0, 10.0)); // im.setLabelFo

我想旋转间隔标记的标签:

        IntervalMarker im = new IntervalMarker(...);
        im.setLabel("LABEL");
//      im.setLabelOffsetType(LengthAdjustmentType.EXPAND);
//      im.setLabelOffset(new RectangleInsets(10.0, 10.0, 10.0, 10.0)); 
//      im.setLabelFont(new Font("SansSerif", Font.ITALIC, 11));
        im.setLabelAnchor(RectangleAnchor.TOP_LEFT);
        im.setLabelTextAnchor(TextAnchor.TOP_LEFT);
        im.setPaint(new Color(208, 194, 214));
它不允许我上传图片,以下是链接:

我想有“标签”垂直,为更好的外观


谢谢

使用
drawAlignedString()
绘图渲染器的
draw{Domain | Range}标记()方法处理标记的标签。您必须使用
drawRotatedString()

使用
drawAlignedString()
绘图渲染器的
draw{Domain | Range}marker()方法处理标记标签的渲染。您必须改用
drawRotatedString()

我找不到直接执行此操作的方法,但您始终可以在适当的位置放置旋转文本批注。

我找不到直接执行此操作的方法,但是,您可以始终将旋转文本批注放在适当的位置。

我发现将文本批注添加到垂直标记更容易,以便更好地控制其标签。下面是一个例子:

// vertical line marker and label
Marker updateMarker = new ValueMarker(dayOf, Color.black, dashedStroke, null, null, 1.0f);    
XYTextAnnotation updateLabel = new XYTextAnnotation("Update", dayOf - labelOffset, labelHeight);
updateLabel.setFont(new Font("Sans Serif", Font.BOLD, 10));
updateLabel.setRotationAnchor(TextAnchor.BASELINE_CENTER);
updateLabel.setTextAnchor(TextAnchor.BASELINE_CENTER);
updateLabel.setRotationAngle(-3.14 / 2);
updateLabel.setPaint(Color.black);
plot.addDomainMarker(updateMarker, Layer.BACKGROUND);
plot.addAnnotation(updateLabel);

此旋转使标签显示在从下到上读取的垂直标记线的左侧。我使用变量“labelOffset”和“labelHeight”来确定标签相对于垂直线的确切位置,但这些变量也可以静态设置。

我发现向垂直标记添加文本注释更容易控制标签。下面是一个例子:

// vertical line marker and label
Marker updateMarker = new ValueMarker(dayOf, Color.black, dashedStroke, null, null, 1.0f);    
XYTextAnnotation updateLabel = new XYTextAnnotation("Update", dayOf - labelOffset, labelHeight);
updateLabel.setFont(new Font("Sans Serif", Font.BOLD, 10));
updateLabel.setRotationAnchor(TextAnchor.BASELINE_CENTER);
updateLabel.setTextAnchor(TextAnchor.BASELINE_CENTER);
updateLabel.setRotationAngle(-3.14 / 2);
updateLabel.setPaint(Color.black);
plot.addDomainMarker(updateMarker, Layer.BACKGROUND);
plot.addAnnotation(updateLabel);

此旋转使标签显示在从下到上读取的垂直标记线的左侧。我使用变量“labelOffset”和“labelHeight”来确定标签相对于垂直线的确切位置,但也可以静态设置。

。这帮了大忙。只有一条注释:
XYTextAnnotation
中的
x
y
坐标构造函数未引用图表中的像素或绝对位置。它指的是先前在
XYSeries
中设置的值,这使得计算坐标变得非常容易。这帮了大忙。只有一条注释:
XYTextAnnotation
中的
x
y
坐标构造函数未引用图表中的像素或绝对位置。它指的是以前在
XYSeries
中设置的值,这使得计算坐标非常容易。链接图像似乎不再工作。链接图像似乎不再工作。这是通过使用TextUtilities.drawRotatedString(…)还是其他方式完成的?是否可以提供一个示例或链接?是;是典型的。这是通过使用TextUtilities.drawRotatedString(…)还是其他方式完成的?是否可以提供一个示例或链接?是;这是典型的。