绘制点而不是线? JFreeChart PolarChart
目前,PolarChart 将所有坐标与线条连接起来创建多边形。我只是希望它用一个点绘制每个点而不是将它们连接在一起。这可能吗?
我尝试过使用 translateValueThetaRadiusToJava2D()
和 Graphics2D 来绘制圆圈,但它非常笨拙且做作。
欢迎任何建议!
Currently, the PolarChart joins all the coordinates with lines creating a polygon. I just want it to plot each point with a dot and NOT join them together. Is this possible?
I have tried using translateValueThetaRadiusToJava2D()
and Graphics2D to draw circles but it's very clunky and contrived.
Any suggestions welcome!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
因此,
DefaultPolarItemRenderer
接收所有极点,将极点转换为常规 Java2D 坐标,用这些点创建一个Polygon
,然后绘制它。以下是我如何让它绘制点而不是多边形:然后在其他地方实例化此类:
So the
DefaultPolarItemRenderer
takes in all the polar points, converts the polar points to regular Java2D coordinates, makes aPolygon
with those points and then draws it. Here's how I got it to draw dots instead of a polygon:and then instantiated this class elsewhere:
这个有点难。给定一个
PolarPlot
,您可以获得其AbstractRenderer
并设置形状。例如,菱形将出现在图例中,但
DefaultPolarItemRenderer
既不渲染形状,也不提供线条控制。您必须扩展默认渲染器并覆盖drawSeries()
。XYLineAndShapeRenderer
是很好的学习例子;您可以在中查看它的使用方式TimeSeriesChartDemo1
。如果这对您来说是未知领域,我会推荐 JFreeChart 开发人员指南†。
†免责声明:不隶属于 Object Refinery Limited;我是一位满意的客户,也是一个很小的贡献者。
This one's a little harder. Given a
PolarPlot
, you can obtain itsAbstractRenderer
and set the shape. For example,The diamond will appear in the legend, but the
DefaultPolarItemRenderer
neither renders shapes, nor provides line control. You'd have to extend the default renderer and overridedrawSeries()
.XYLineAndShapeRenderer
is good example for study; you can see how it's used inTimeSeriesChartDemo1
.If this is terra incognita to you, I'd recommend The JFreeChart Developer Guide†.
†Disclaimer: Not affiliated with Object Refinery Limited; I'm a satisfied customer and very minor contributor.
这是一个很好的讨论,如果您希望该函数获取用户分配给系列的颜色,则
添加...
之前...
还有其他函数...使用代码完成来查看针对系列还有哪些可用的函数渲染名称从
lookupSeries........(int seriesindex)
This is an excellent discussion, in case you want the function to pick up the color assigned by user to the series
add ...
before ...
there are other functions... use code completion to see what else functions are available against series rendereing with name starting from
lookupSeries........(int seriesindex)
我发现了一种相当奇怪的方法来获取点,而无需任何线连接它们。
我设置了 Stroke 的 渲染器 是一条细线,破折号相位为 0,长度为 1e10:
I found a rather strange way to get the points without any lines connecting them.
I set the Stroke of the renderer to be a thin line, with a dash phase of 0, and length of 1e10: