【问题标题】:How to display y axis label in multiple lines in RGraph?如何在 RGraph 中多行显示 y 轴标签?
【发布时间】:2021-04-12 07:28:59
【问题描述】:

您好,我在 Angular 7 应用程序中使用 RGraph。在 y 轴上,我正在显示名称。而不是在一行中显示,我想在多行中显示。 yaxisLabelsAngle:25 不起作用。

【问题讨论】:

    标签: rgraph


    【解决方案1】:

    从 3D 样式来看,您拥有一组较旧的库,因此您可能需要更新到最新版本(v6.00,我上周末刚刚发布)。

    您可以使用 \n 在标签中添加换行符,如本示例所示。

    这是一个示例 3D HBar 图表的代码笔:

    https://codepen.io/rgraph/pen/MWJQRvX

    代码是:

    <script>
        new RGraph.HBar({
            id:'cvs',
            data: [[8,2],[6,4], [2, 5]],
            options: {
                grouping: 'stacked',
                marginInner: 10,
                variant: '3d',
                xaxis: false,
                yaxis: false,
                yaxisLabels: ['Richard\nDawkins', 'Neil de-Grasse\nTyson','Bill\nNye'],
                yaxisTitle: 'The Y axis title',
                xaxisTitle: 'The X axis title',
                colors: ['purple', 'gold'],
                key: ['A purple bar','A gold bar'],
                keyPosition: 'margin',
                keyPositionY: 15 // Might need to remove this
            }
        }).draw();
    </script>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-11-29
      相关资源
      最近更新 更多