Vinu Yours
Vinu Yours

Reputation: 23

Control legends display on flot chart

I was trying to implement flot chart (http://www.flotcharts.org/) for my reporting tool. I came across a situation for which i am not able to find a solution. Can some one help me.

I have a multi chart system with two sets of data, say

[ { label: "Foo", data: [ [10, 1], [17, -14], [30, 5] ] },
    { label: "Bar", data: [ [11, 13], [19, 11], [30, -7] ] } ]

The requirement is , I want to display only one legend. Say legend "Foo", and want to hide the legend "Bar". But I dont wan't to make the label blank. I want to hide only legend, but keep label as it is.

Did somebody have done this before, any help is really appreciated.

Upvotes: 2

Views: 839

Answers (1)

DNS
DNS

Reputation: 38199

This isn't documented - though it should be - but if you provide a legend labelFormatter function, and that function returns null instead of a string, no legend entry will be created for that series.

This isn't quite perfect, since it requires that you be able to identify the hidden series based on its label or data, but it usually works well enough.

Upvotes: 2

Related Questions