我有一个包含 4 条线系列的折线图,其中包含菱形、圆形、方框和三角形作为这 4 条线系列的绘图的项目渲染器。现在我的要求是我想在图表中显示绘图的标签。它应该是这样的:
(来源:infocaptor.com)
我尝试了一些项目渲染但无法正确获取它,因为我想使用圆形和三角形来渲染绘图。这真是消磨我的时间。请帮忙...
干杯,PK
I have a line chart with 4 line series with diamond, circle, box and triangle as item renderer for the plots for these 4 line series. Now my requirement is I want to show labels for the plots in the chart. It should be like this :
(source: infocaptor.com)
I tried with some item renderes but not getting it correctly since I want to use the circles and triangles to render the plots. This is killing my time. Please Help...
Cheers, PK
发布评论
评论(2)
您的问题中示例图像的链接目前已损坏,但如果您希望向绘图添加标签,您可以使用 CartesianDataCanvas 类相对于图表中的数据坐标来定位元素。如果这就是您想要做的,那么第二个示例 这里应该告诉你你需要知道的一切。同样,我看不到您想要实现的目标,但如果您希望所有绘制的值上都有标签,则另一个选项是在图表对象上将
showAllDataTips
设置为 true ,然后为绘图创建自定义dataTipRenderer
。在这种情况下,这个示例应该是使用。The link to the example image in your question is broken at the moment, but if you are looking to add labels to your plot, you can use the
CartesianDataCanvas
class to position elements relative to data coordinates in your chart. If that's what you are looking to do then the second example here should tell you everything you need to know. Again, I can't see the picture of what you are trying to achieve, but it you want the labels on all of your plotted values than another option is to setshowAllDataTips
to true on your chart object and create a customdataTipRenderer
for the plot. In that case this example should be of use.使用 localToContent 和 dataToLocal:
Use localToContent and dataToLocal on the dataProvider: