Monsieur Bonhomme
Monsieur Bonhomme

Reputation: 31

Use several symbols on a serie FlotJS

I'm using FlotJS library and I'd like to display some points on a serie with several symbol types. I'd like having lines displayed and several selected points but not all. Is there any way to do this ?

EDIT :

I've just found jquery flot, varying size and color for each point who helped me understanding how it works but, I'd like keep

grid : {hoverable : true}

And it creates a display bug cause of modulo, is there a way to override that ? The associated JSFiddle Example

Upvotes: 0

Views: 68

Answers (1)

Mark
Mark

Reputation: 108512

To draw the highlights, flot is still calling the someFunc function and someFunc.calls is still incrementing and controling how the hightlights are drawn. So, after the $.plot I'd just "turn if off":

someFunc.calls = 0;     
somePlot = $.plot($("#placeholder"), [ d1 ], options);
someFunc.calls = false;

Where someFunc is:

function someFunc(ctx, x, y, radius, shadow) 
{
    if (someFunc.calls === false) {
        // we are highlighting, draw it normal
        ctx.arc(x, y, radius, 0, shadow ? Math.PI : Math.PI * 2, false);
    } else {
       // intial draw, do fancy points...
       someFunc.calls++;
       if (someFunc.calls % 2 == 0)
       {
            ctx.arc(x, y, radius, 0, shadow ? Math.PI : Math.PI * 2, false);
       }
       else
       {
           ctx.arc(x, y, 0, 0, shadow ? Math.PI : Math.PI * 2, false);
       }
    }
 }

Updated fiddle.

Upvotes: 2

Related Questions