1
當我用JavaScript flot庫繪製不同大小和顏色的點時,我無法刪除陰影。Flot:不可能刪除點影
$(function() {
var d2 = [[0, 0], [1, 1], [2, 2], [3, 3],[4, 4], [5, 5], [6, 6], [7, 7],[8, 8], [9, 9], [10, 10], [11, 11]];
var colors = ["#cc4444", "#ff0000", "#0000ff", "#00ff00"];
var radius = [1, 2, 3, 4,5,6,7,8,9,10,11,12];
var rainbow = new Rainbow();
rainbow.setSpectrum('blue','green', 'yellow','red');
rainbow.setNumberRange(1, 12);
function raw(plot, ctx) {
var data = plot.getData();
var axes = plot.getAxes();
var offset = plot.getPlotOffset();
for (var i = 0; i < data.length; i++) {
var series = data[i];
for (var j = 0; j < series.data.length; j++) {
var color = colors[j];
var d = (series.data[j]);
var x = offset.left + axes.xaxis.p2c(d[0]);
var y = offset.top + axes.yaxis.p2c(d[1]);
var r = radius[j];
ctx.lineWidth = 0;
ctx.shadowSize=0;
ctx.beginPath();
ctx.arc(x,y,r,0,Math.PI*2,true);
ctx.closePath();
ctx.fillStyle = "#"+rainbow.colourAt(r);
ctx.fill();
}
}
};
var plot = $.plot(
$("#placeholder"),
[{ data: d2, points: { show: true ,shadowSize:0,lineWidth: 0}}],
{ hooks: { draw : [raw] }}
);
});
我試圖設置不同的shadowSize,但它不工作,而lineWidth正常工作。
有什麼想法?
謝謝!!它現在有效。 –
@IdreesSamim如果答案解決了您的問題,您應該[接受](http://stackoverflow.com/help/accepted-answer)(點擊左邊的複選標記)。 – Raidri