RGraph瀑布图:摆脱连接线的线条

时间:2019-06-27 21:18:51

标签: 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();

谢谢您的帮助!

1 个答案:

答案 0 :(得分:1)

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

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

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

改为将其更改为此:

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