gpt4 book ai didi

javascript - 如何管理 RGraph 玫瑰图中 Canvas 的高度?

转载 作者:行者123 更新时间:2023-12-02 14:55:41 24 4
gpt4 key购买 nike

I am using RGraph library for my assessment site. It is working well but canvas height is creating an issue with the layout of graph.

See the image below, it results in a good output but gets cropped from the bottom and that's why the fourth category name is not being displayed.

enter image description here

My Rose Chart Script is as below.

<script>
var catnames = <?php print json_encode(array_keys($values));?>;
var results = <?php print json_encode(array_values($str_val));?>;
var tooltipval = <?php print json_encode(array_values($values));?>;
window.onload = function ()
{
var canvas = document.getElementById("cvs");

RGraph.Reset(canvas);

canvas.width = jQuery(window).width() * 0.6;
canvas.height = jQuery(window).width() * 0.25;
var text_size = Math.min(12, (jQuery(window).width() / 1000) * 10 );
var linewidth = jQuery(window).width() > 500 ? 2 : 1;
linewidth = jQuery(window).width() > 750 ? 3 : linewidth;

var rose = new RGraph.Rose({
id: 'cvs',
data: results,
options: {
variant: 'stacked',
labelsAxes: '',
margin: 2.5,
/* anglesStart: -(RGraph.HALFPI/2), */

key:catnames,
keyBackground:'#fff',
keyColorShape: 'circle',
strokestyle: 'rgba(0,0,0,0)',
labels: catnames,
tooltips: tooltipval,
linewidth:linewidth,
colorsSequential: true
}
}).implode();

};

In the script given above catnames is the array of categories those are displayed as labels in the graph.

最佳答案

代码本身会生成一个带有标签的图表。

您可以尝试使用 radius: 配置属性来减小半径,并使用 radius 配置属性查看标签是否出现:

...半径:100,...

关于javascript - 如何管理 RGraph 玫瑰图中 Canvas 的高度?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35811496/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com