带有阴影和圆形节点的JFreeChart [英] JFreeChart with shadow and circle nodes

查看:254
本文介绍了带有阴影和圆形节点的JFreeChart的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个折线图:

但是我希望它看起来像这样。我也不知道这是什么样的图表。我要制作的
也有阴影和圆形节点。就像这样:

But I want it to make it looks like this. I also don't know what kind of chart is this. I want to make also have a shadow and circle nodes in it. Just like this:

我该怎么做?顺便说一下,如果与我的问题相关,我将在图表中以 PNG 图片格式显示图表。

How can I do this? By the way I'm displaying the chart in the webpage as PNG image format if it is relevant to my question. Thanks in advance.

推荐答案

有关信息,您要复制的示例图表包含在JFreeChart演示集合中。 。演示的完整源代码包含在《 JFreeChart开发人员指南》中。通过要求他们购买《 JFreeChart开发人员指南》,您可以节省一些时间,并为您的公司节省一些钱,但它并不那么昂贵。关于答案...

您要查找的阴影效果可以添加到任何 CategoryPlot XYPlot 通过设置阴影生成器:

The shadow effect you are looking for can be added to any CategoryPlot or XYPlot by setting the shadow generator:

plot.setShadowGenerator(new DefaultShadowGenerator());

看起来不错,但是请注意,它需要将图表渲染为位图,因此不会如果要将图表导出为SVG或PDF或其他矢量格式,则播放效果很好。

It looks nice, but be aware that it requires rendering the chart as a bitmap so it won't play so nicely if you are exporting your charts to SVG or PDF or other vector formats.

可以通过更改所使用的渲染器的属性来添加线条的形状(在这种情况下, LineAndShapeRenderer

The shapes on the lines can be added by changing attributes on the renderer you are using (LineAndShapeRenderer in this case).

LineAndShapeRenderer renderer = (LineAndShapeRenderer) plot.getRenderer();
renderer.setBaseShapesVisible(true);

setBaseShapesVisible()方法设置默认值(或基本)标志值用于所有系列。如果需要,您可以按系列覆盖默认值。您可能还需要调整使用的颜色...默认情况下,所有形状都是使用系列颜色绘制和填充的,但是可以设置一些标志,以使渲染器使用系列填充和系列轮廓颜色(

The setBaseShapesVisible() method sets the default (or 'base') flag value for all series. You can override that default on a per-series basis if you want to. You may also want to tweak the colors being used...by default all the shapes are drawn and filled using the series color, but there are flags that can be set to make the renderer use the series fill and series outline colors (which is done in the example to get the white fill in the shapes).

JFreeChart渲染器非常可配置,因此,我建议您花一些时间浏览API文档以了解有什么可能。

The JFreeChart renderers are very configurable, so I suggest you spend some time looking through the API documentation to see what is possible.

这篇关于带有阴影和圆形节点的JFreeChart的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆