如何管理 Graph Rose 图表中 canvas 的高度?

How to manage hight of canvas in RGraph Rose chart?

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.

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, ...