简体   繁体   English

使用 chart.js 版本 3,如何创建带链接的自定义标签?

[英]Using chart.js version 3, How do create Custom Labels with Links?

I'm using Charts JS and I'd like to create some custom Labels on a Stacked Bar Chart.我正在使用 Charts JS,我想在堆叠条形图上创建一些自定义标签。 I'm trying to recreate this following chart:我正在尝试重新创建以下图表: 在此处输入图像描述

How do I create custom labels as circled in Red above?如何创建上面红色圈出的自定义标签? I'd like to link to other pages with these labels.我想链接到带有这些标签的其他页面。 Actually the bolded text would link to one page and the normal text would link to another page.实际上,粗体文本将链接到一个页面,而普通文本将链接到另一页。

Also How would you label each bar in a way that the values drop down off the bar when there is not enough room to display it on the bar?另外,当没有足够的空间在栏上显示时,您将如何 label 每个栏的值从栏上掉下来? See the "4%" or "6%" on the right side of the graph.请参见图表右侧的“4%”或“6%”。

I also want to know how to put a margin spacing between each stacked bar.我还想知道如何在每个堆叠条之间放置边距。 See the vertical white space between each bar on the image above.查看上图中每个条形之间的垂直空白。

Any help with the issues above would be greatly appreciated.对上述问题的任何帮助将不胜感激。 Thanks.谢谢。

I ended up creating my own chart using div and widths.我最终使用 div 和宽度创建了自己的图表。 Sometime you have more control over look and feel if you build it your self.如果您自己构建,有时您可以更好地控制外观。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM