dajavinator
dajavinator

Reputation: 81

Flot - Is it possible to add line coloring in the data?

I want every series to have their own individual coloring, so I can't set it through the options. I tried setting it through the data however it wouldn't work. When I checked in the debugger the line had the color property however the line being drawn still wasn't the color I wanted. I wondered if this problem was exclusive to color and I discovered that it does work for lineWidth. So I really have no idea what the problem is now.

Here's the code

data.push({
           data: xLine,
           editable: false,
           lines: {show: showBool, lineWidth:5, color:#000000},
           points: {show: false}
          });

The line width'll show up but the color won't.

Upvotes: 0

Views: 79

Answers (1)

mechenbier
mechenbier

Reputation: 3067

Two things:

  1. You need to surround your specified color code with quotes (" ") for the color to work
  2. The color option is not part of the lines option

Here is a JSFiddle example

data.push({
    data: xLine,
    editable: false,
    lines: {show: showBool, lineWidth:5 },
    color: "#000000",
    points: {show: false}
});

Upvotes: 3

Related Questions