Float chart eliminates the selected color

I have a well working scoped table using Flot. It fills in colors that are currently being automatically generated.

My question is, is it possible for me to remove the selected colors. Meaning, I don't want the chart to use green, red and orange fill colors.

+3


source to share


1 answer


API

does not provide a way of exclude

some color if it auto-generated

<s> I think you can easily edit the file jquery.colorhelpers.js

and leave a comment / delete auto-colors

that you don't need.

Like for example (untested)

var lookupColors = {
        aqua:[0,255,255],
        azure:[240,255,255],
        beige:[245,245,220],
        black:[0,0,0],
        // blue:[0,0,255], // --> no blue
        brown:[165,42,42],
        cyan:[0,255,255],
        ...
    };

      

Edit:
If you're not manually including the file jquery.colorhelpers.js

, note the author's comment in the jquery.flot.js

file on line 8:

8: // first an inline dependency, jquery.colorhelpers.js, we inline it here
9: // for convenience

      

inline code is on line 32:

32: (function($){$.color={};$.color.make=...

      


Edit 2:



Important clarification

After reading the code and author's comment for a bit jquery.flot.js

, I realize that the above suggestion was completely wrong ... lookupColors

var is used to match the color name given

to the corresponding value RGB

...
Nothing to do with auto-generated colors for the chart.

Now ... In the same reading I found out this color theme

jquery.flot.js declaration line 516

516: // the color theme used for graphs
517: colors: ["#edc240", "#afd8f8", "#cb4b4b", "#4da74d", "#9440ed"],

      

And guess what ... If you change it ... will change the diagram, so I think this would be your best approach.

Example:

colors: [
    // "#edc240", // --> this removes/disabled the dark-yellow
    "#afd8f8",
    "#cb4b4b",
    "#4da74d",
    "#9440ed"
],

      

So now you can not only exclude

add color but also create your own theme

.
nice;)

JsFiddle example: http://jsfiddle.net/gmolop/9u8tsfum/

+4


source







All Articles