Pompey
Pompey

Reputation: 606

changing the color of individual data points flotr2

I was wondering if it was possible to change the color of individual data points. I have tried writing my own function into it like in tickFormatter, but it doesn't seem to be working. This is kinda what I'm talking about:

graph = Flotr.draw(container, [ 
            { data : dataset, label : 'Scores1', lines:{show:true}, 
                points: {
                    show: true,
                    color: function(o){
                        return 'yellow';
                    }
                }},
            { data : patient_average, label : 'Scores2',  lines:{show:true}, points: {show:true}},
            { data : overall_average, label : "Scores3", lines : {show:true, color:'#FFCD00'}, points: {show:true, color: '#FFCD00'}}
            ], {

Right now I was just trying to get it to show yellow so that I knew that the function would work. If that works I basically want it so that depending on what the value of the data point is I would color it into a certain color. But with the code above it just displays the points as grey meaning that it doesn't understand my code. Is this even possible? Thanks for any help.

Upvotes: 0

Views: 2098

Answers (2)

Ying Style
Ying Style

Reputation: 750

Please try to use: lines:{show: true, fill: true, fillColor:'#000000'} instead of your code.

It should work well. Same for points.

Upvotes: 2

ILog
ILog

Reputation: 371

Seems to me there should be 'fillColor' instead of 'color'. Also check another property: 'fill: true'.

Upvotes: 0

Related Questions