Re: Does Flot support different color between points and lines?

316 views
Skip to first unread message

DNS

unread,
Oct 8, 2012, 9:19:46 PM10/8/12
to flot-...@googlegroups.com
The series options aren't exclusive, so you can specify options for both lines and points like this:

{
...
    points: {
        fillColor: "#ff0000"
    },
    lines: {
        fillColor: "#0000ff"
    }
}

Salvatore Campanella

unread,
Oct 9, 2012, 6:36:42 AM10/9/12
to flot-...@googlegroups.com
Thanks for the reply.

Trying your code I wrote this:

$(function () {
    var d1 = [];
    for (var i = 0; i < 14; i += 0.5)
        d1.push([i, Math.sin(i)]);

   var options = {
    series: {
color:"red",
        lines: 
show: true, 
fill: true, 
fillColor: "blue",
},
        points: 
show: true, 
fill: true,
fillColor: "black" 
}
    }
};

    // a null signifies separate line segments
    
    $.plot($("#placeholder"), [ d1], options);
});

As you can see in the image, the points are blacks, but are surrounded by the color of the line (red). I would not have this contouring or having the same color of the point.

DNS

unread,
Oct 9, 2012, 9:43:35 AM10/9/12
to flot-...@googlegroups.com
I was going to suggest that you set lineWidth to zero in the points options, but while that does help (it makes the outline thinner) it does not get rid of it entirely, as I'd expect.  This seems like a bug; could you please open a new issue for this?

Michael Wood

unread,
Oct 9, 2012, 10:07:00 AM10/9/12
to flot-...@googlegroups.com
As a workaround, couldn't you just have two series with the same data
and the second one would be points only?

--
Michael Wood <esio...@gmail.com>

Salvatore Campanella

unread,
Oct 10, 2012, 4:26:13 AM10/10/12
to flot-...@googlegroups.com
 
 
This might be a good idea, just that I have a lot of data to display and the graph is 'full' of effects and functions. Honestly, the idea of ​​doubling the data shown does not make me crazy.

I also noticed that the points can not be colored. The fillColor only fills the interior points. Using instead of the traditional circle or square an 'X', the fillColor not clearly effect and the 'X' takes on the color of the line. 
 
p.s. @DNS I've just opened a new issue for lineWidth: 0.
 
Reply all
Reply to author
Forward
0 new messages