iReport折线图类别标签
我正在使用折线图组件根据建筑物的消耗生成图表。 想象一个可能的图表,该图表基于一个月内建筑物的消耗量和一天的分辨率。 30天对应30点消费。 问题出在类别轴标签上。由于点数量相当多,标签变得难以辨认。我怎样才能标记一些点?
我最诚挚的问候
i'm using the Line Chart component to generate a chart based on the consumption of a building.
Imagine a possible chart based on the consumption of a building in a period of a month and a resolution of a day. It will have 30 points of consumption corresponding to 30 days.
The problem is with the category axis labels. With a considerable amount of points, the labels becomes unreadable. How can i just label some points?
My best regards
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不要使用“折线”图表。相反,请使用“时间序列”图表。
它自动处理围绕绘制所有点但仅标记可读数量的点的问题。它还可以处理由不均匀分布的数据点产生的问题。
编辑:如果您传入的数据是字符串而不是日期,那么您就有额外的工作。时间序列图表需要时间(好吧,日期)。您需要将 DateString 转换为真正的 Date。但工作虽小,效益却很大。使用如下变量:
new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse($F{MyDateString})
。Don't use a "Line" chart. Instead use a "Time Series" chart.
It automatically handles the issues around charting all points but only labeling a readable number of them. It also handles problems created by data points that are not uniformly spaced.
EDIT: If your incoming data is a String instead of a Date, then you have extra work. Time Series charts expect Times (well, Dates). You'll need to cast your DateString into a real Date. But the work is small, and the benefits are large. Use a variable like this:
new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse($F{MyDateString})
.使用此代码在 JASPER 报告中的折线图上生成标签
Use this code to generate a label on the line chart in JASPER report