Apache Poi图表自定义数据标签

huangapple go评论109阅读模式
英文:

Apache Poi Chart custom Data Labels

问题

我已经创建了一个带有系列和数据点的XDDFScatterChart,并为一些数据系列创建了数据标签。我发现我可以使用包含x和y坐标以及系列名称的标准标签。现在,我想为系列的单个元素设置自定义文本作为标签,但我不知道如何做到这一点。
我想要的是像这样的效果:

dataLabel.setText("我的文本");

我找到了一些关于创建数据标签的方法,但我无法弄清楚如何为任何数据标签设置自定义文本。

英文:

I have created a XDDFScatterChart with series and data points and created data labels for some data series. I found that i can use standard labels consisting of x and y coordinates and series name. Now I want to set a custom text as a label for single elements of a series but i don't know how to do this.
What i want is something like this:

dataLabel.setText("my text");

I found some methods around creating data labels but i can't figure out how to set a custom text to any data label.

答案1

得分: 3

看起来目前对于我的问题还没有解决方案。自定义数据标签可以由Excel自身完成,但仅适用于更新版本的ooxml标准。因此,在这种情况下,POI ooxml库是个问题。这个问题应该可以通过更新版本来解决,但似乎并没有多少人需要这个。也许更新版本的Apache POI可以帮助解决。

我将通过使用Python的xlsxwriter而不是Java的Apache POI来解决我的问题,以获取我所需的内容。

如果有人仍然有关于如何使用Java完成这项工作的想法,请分享出来,那会对我帮助很大。

英文:

It looks like that currently there is no solution for my problem. Custom Data labels can be done by Excel itself but only with newer versions of the ooxml standard. So the POI ooxml library is the problem in this case. A never version of this should fix the problem but it seems that not many people need this. Maybe newer versions of Apache POI can help.
I will solve my problem by using python xlsxwriter instead of java apache poi to get what i need to do.
If anyone has still an idea how to do the job with java please share it it that would help me a lot.

huangapple
  • 本文由 发表于 2020年9月25日 16:09:04
  • 转载请务必保留本文链接:https://go.coder-hub.com/64060274.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定