如何在G. Raphael折线图中访问和设置单独的线条样式

bre*_*ner 4 svg linechart raphael

由于raphael JS库的记录很少,我恳求集体智慧.

我有工作.raphael多线折线图(类似于http://g.raphaeljs.com/linechart.html)

类似于:var lineChart = rglinechart(10,10,300,220,[1,2,3,4,5],[[10,20,15,35,30],[5,10,5,15,20]], {shade:true,"colors":["#44F","#CCC"],nostroke:true});

我想改变其中一行来设置fill = clear和stroke =一种颜色

我被告知这样的事情会起作用,但没有运气 - 有什么建议吗?lineChart.lines [0] .attr({stroke:"#000"}),

为了额外的功劳,我如何将线的填充设置为渐变?

谢谢!

Sam*_*ins 5

我使用Firebug和console.log()列出一行上的属性:

console.log(chart.lines[0].attr());
Run Code Online (Sandbox Code Playgroud)

我点击了日志行来查看详细信息,如下所示:

fill: "none"
path: [ ... ]
stroke: "#ff0000"
stroke-dasharray: ""
stroke-linecap: "round"
stroke-linejoin: "round"
stroke-width: 2
transform: []
Run Code Online (Sandbox Code Playgroud)

对我来说,我想改变笔画宽度.此代码有效:

chart.lines[0].attr({'stroke-width': 8});
Run Code Online (Sandbox Code Playgroud)

line-width属性列在优秀的RaphaelJS文档中.

对于您的问题,我希望您需要这样的代码:

chart.lines[0].attr({'fill': 'none', 'stroke': '#FF00FF'});
Run Code Online (Sandbox Code Playgroud)

我希望这有帮助!