Morris.JS X轴标签高度 [英] Morris.JS X-Axis Label Height

查看:186
本文介绍了Morris.JS X轴标签高度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一张用Morris.JS生成的图表,但x轴上的标签很长并且由于显示标签的区域的高度有限而被切断。

I have a chart generated with Morris.JS but the labels on the x-axis are to long and being cut off due to the limited height of the area showing the labels.

下面的代码将呈现一个仅显示COUNTY PARK ROAD ELEM部分标签的图表。如何调整标签区域的高度以显示整个文本?

The code below would render a graph that only shows the partial label for "COUNTY PARK ROAD ELEM.". How can I adjust the height of the label area to show the entire text?

代码如下

if ($('#IP1').length){ 

    Morris.Bar({
      element: 'IP1',
      data: [           
            {x: 'COUNTY PARK ROAD ELEM.', yIndex: 376.92}                   
      ],
      xkey: 'x',
      ykeys: ['yIndex'],
      labels: ['Index Points'],
      ymax: 500,
      barRatio: 0.2,
      xLabelAngle: 45,
      hideHover: 'auto'
    });
}


推荐答案

对我有用的解决方案是为了增加svg标签的大小

The solution that worked for me was to increase the size of the svg tag

$('svg').height(700);

这篇关于Morris.JS X轴标签高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆