javascript - RGraph瀑布图: Get rid of lines connecting bars

标签 javascript charts rgraph

我使用 RGraph 创建了一个瀑布,如下图所示。除了连接每个条形的细线之外,一切看起来都很棒。我在图中用红色圈出了它们。我怎样才能摆脱这些细连接线?我在文档中找不到它。

参见my jsfiddle here对于工作版本。

Waterfall image with lines circled in red

代码:

html:

<html>
    <body>
        <canvas id="cvs" width="800px" height="300px"></canvas>
    </body>
</html>

JavaScript:

    var waterfallChart = new RGraph.Waterfall({
        id: 'cvs',
        data: [570.00, -7.39, -26.61, -18.69, -4.24],
        options: {
            linewidth: 0,
            colors: ["#b3b3b3", "#afe5ed", "#afe5ed", "#afe5ed", "#afe5ed", "#6f2e92"],
            colorsStroke: "#ffffff",
            colorsSequential: true,
            title: "The Title Of My Chart",
            titleColor: "#727272",
            titleSize: 15,
            labelsAbove: true,
            labelsAboveDecimals: 2,
            labelsAboveUnitsPre: "$",
            axes: false,
            backgroundGrid: false,
            backgroundBarsCount: 0,
            yaxisLabels: false,
            yaxisTickmarksCount: 0,
            xaxisTickmarksCount: 0,
            yaxisScaleMin: 450,
            xaxisLabelsSize: 10,
            xaxisLabels: ['Plan 3',
                          'This is\na label',
                          'This is \nanother label',
                          'This is\na thing',
                          'This is\nyet another thing',
                          'blah'],
            xaxisLabelsOffsety: 50,
            xaxisLabelsColor: "#9f9f9f"
        }
    });
    // waterfallChart.Set('chart.gutter.bottom',35);
    waterfallChart.draw();

感谢您的帮助!

最佳答案

它们只是连接线 - 没有选项可以将它们关闭,但您可以通过执行以下操作来更改源以隐藏它们:

在 RGraph.waterfall.js 的第 1318 行(或附近),您会发现以下几行:

co.lineWidth   = 1;
co.strokeStyle = '#666';

将它们改为:

co.lineWidth   = 0.00001; // Don't zet to zero
co.strokeStyle = 'rgba(0,0,0,0)'; // transparent

关于javascript - RGraph瀑布图: Get rid of lines connecting bars,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56798580/

相关文章:

javascript - 如何使用 JavaScript 将数据发送到具有特定 ID 的元素?

javascript - 同一 View 中 map 和图表的剑道 UI 中的数据拉伸(stretch)真/假

javascript - shieldui日期选择器格式化

javascript - 不使用全局变量将数据发送到JS文件

javascript - 为什么我的 JS 代码在运行,而 DOM 操作还没有完成

javascript - HighCharts 列上的多个系列数据

donut-chart - 增加圆环图的内半径以及如何在圆环图中写入

ios - 向 UIView 添加多个 subview

javascript - 如何使用 csv 文件中的数据在选择更改时更新 highcharts.js 图表?

javascript - RGraph 通过单击关键元素隐藏线和标签