在 raphael.js 中更改线宽和颜色

Changing line width and color in raphael.js

请耐心等待我刚开始使用 raphael.js 库,我需要更改线条的宽度和颜色。
我查看了此处的文档和其他答案,但我完全迷路了。
目前它太薄了,我也需要它是另一种颜色。

代码

function Line(startX, startY, endX, endY, raphael) {
            var start = {
                x: startX,
                y: startY
            };
            var end = {
                x: endX,
                y: endY
            };
            var getPath = function() {
                return "M" + start.x + " " + start.y + " L" + end.x + " " + end.y;
            };
            var redraw = function() {
                node.attr("path", getPath());
            }

            var node = raphael.path(getPath());
            return {
                updateStart: function(x, y) {
                    start.x = x;
                    start.y = y;
                    redraw();
                    return this;
                },
                updateEnd: function(x, y) {
                    end.x = x;
                    end.y = y;
                    redraw();
                    return this;
                }
            };
        };



        $(document).ready(function() {
            var paper = Raphael("raphaelContainer",1280,470, 0, 0);
            $("#raphaelContainer").mousedown(

                    function(e) {
                        x = e.offsetX;
                        y = e.offsetY;
                        line = Line(x, y, x, y, paper);
                        $("#raphaelContainer").bind('mousemove', function(e) {
                            x = e.offsetX;
                            y = e.offsetY;
                            line.updateEnd(x, y);
                        });
                    });

            $("#raphaelContainer").mouseup(

                    function(e) {
                        $("#raphaelContainer").unbind('mousemove');
                    });
        });

有什么帮助吗?

你可以看看stroke-width和中风。

element.attr({ stroke-width: 3, stroke: 'red' }); for example

'attr'here

的文档