JasperReports:如何在图表轴上屏蔽或过滤标签 [英] JasperReports: How to mask or filter the labels at the chart's axis

查看:115
本文介绍了JasperReports:如何在图表轴上屏蔽或过滤标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用基于简单数据集的简单区域图,如下所示:

I´m using a simple area chart based on a simple Dataset like this:

DateTime(sql.timestamp) |Value(Integer)
2012-02-17 00:02:02     |100
2012-02-17 00:02:08     |110
2012-02-17 00:02:20     |90
2012-02-17 00:02:35     |10
2012-02-17 00:02:40     |130
2012-02-17 00:04:22     |14
2012-02-17 00:04:33     |45
2012-02-17 00:05:02     |60
...

DateTime由Category Axis使用,Value由Range Axis使用。

在数据集中是~1000记录
在类别的标签中Axis将显示每个DateTime值。

但是,如果记录太多,则类别标签将显示为黑线。

这是我的问题。

我试图(联合国)检查所有图表属性。没有结果。

我是否需要掩盖或过滤标签?

我试图更改以下值:

类别刻度标签面具

类别轴垂直刻度标签

(此复选框无效)


类别轴的标签表达


所有这些都有多种方式。
但它不起作用。
每个数据集都将创建一个自己的标签。

DateTime is used by Category Axis, Value is used by Range Axis.
In the Dataset are ~1000 Records
In the Labels of the Category Axis will every DateTime Value be shown.
But that is with 1000 records too much, the Category Labels will be shown as Black Line.
And that is my problem.
I´d tried to (un)check all "Chart Properties". With no results.
Did i have to Mask or filter the labels?
I´d tried to change the values of:
Category Tick Label Mask
Category Axis Vertical Tick Labels
(This checkbox doesn´t takes effect)

Label Expression of the Category Axis

All in Several ways. But it won´t work. Each dataset will create an own Label.

我使用过的其他报表引擎已计算出Cat。 Axis动态。

但JasperReports?

Other report engines that i have used has calculated the Cat. Axis dynamic.
But JasperReports?

我正在使用 iReport 4.5.0 with(actual) jfreechart 1.0.14

I´m using iReport 4.5.0 with (actual) jfreechart 1.0.14

EDIT

如果我使用时间序列图表,JasperReports将按Intervall(年,月,...)对数据进行分组,而不是动态

If i use a timeseries Chart, JasperReports will group the data by Intervall (Year, month,...) and that not Dynamicly

但是图表的外观非常好,所以这就是我想要的。
只有标签必须彼此远离。

But the look of the chart is quite good, so it is that what i want. Only the Labels has to be located far from each other.

这里有一个很好的例子(advsoft phpChartdirector)

Here a fine Example (advsoft phpChartdirector)

这里是JasperReports / IReport示例:

Here the JasperReports / IReport example:

不行。看看猫。 Axis

not OK. Take a look to the cat. Axis

那么......怎么办?

So.. What´s to do ?

结束编辑

亲切的问候
Christian

Kind Regards Christian

推荐答案

使用时间序列图表而不是折线图。你应该得到你正在寻找的那种方式。

Use a Timeseries chart instead of a Line chart. You should get exactly what you're looking for that way.

编辑:我用你提供的.jrxml和数据测试过。效果很好:

I tested with your supplied .jrxml and data. It works well:

但是...... iReport中似乎有一个错误。您无法在iReport GUI中设置时间段。也许这就是导致你出现问题的原因。这让我非常困惑。无论您尝试选择什么时间段,iReport都会生成此信息:

But... there seems to be a bug in iReport. You cannot set the time period in the iReport GUI. Perhaps this is what is causing you problems. It was very confusing to me. iReport generates this regardless of what time period you attempt to choose:

<timeSeriesDataset>

但您需要手动将JRXML更改为:

But you need to manually change the JRXML to this:

<timeSeriesDataset timePeriod="Second">

一旦你这样做,你就会得到一张漂亮的图表。至少iReport没有删除正确的timePeriod信息...所以你只需要做一次。

Once you do that, then you'll get a nice chart. At least iReport doesn't remove the correct timePeriod info... so you only have to do it once.

注意:如果你担心像获取你的日期信息显示在2行,这也是可能的。我讨厌被困在一条线上。去年我写了一篇关于这篇文章的文章。查找多行类别标签部分。

Note: If you're concerned about details like getting your date info to display on 2 lines, this is possible as well. I hate being stuck with a single line. I wrote an article about that last year. Look for the section Category Labels on multiple lines.

这篇关于JasperReports:如何在图表轴上屏蔽或过滤标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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