Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flot pie chart change position of legends

Tags:

legend

flot

Can we change the position of legends from default left side to right or bottom?

How can we implement hover on mouse pointer that is the content should be shown on the mouse pointer and not in other DIV

like image 719
Hardik Dobariya Avatar asked Aug 14 '12 11:08

Hardik Dobariya


2 Answers

The legend option takes a "position" attribute to specify it's location:

  legend: {
    position: "ne" or "nw" or "se" or "sw"
  }

What do you mean by "on the mouse pointer". Would you like the "content" to follow the pointer?

like image 163
Mark Avatar answered Jan 06 '23 02:01

Mark


Here's the documentation of the library you're using:

https://github.com/flot/flot/blob/master/API.md#customizing-the-legend

legend: {
    show: boolean
    labelFormatter: null or (fn: string, series object -> string)
    labelBoxBorderColor: color
    noColumns: number
    position: "ne" or "nw" or "se" or "sw"
    margin: number of pixels or [x margin, y margin]
    backgroundColor: null or color
    backgroundOpacity: number between 0 and 1
    container: null or jQuery object/DOM element/jQuery expression
    sorted: null/false, true, "ascending", "descending", "reverse", or a comparator
}
like image 43
Ondra Žižka Avatar answered Jan 06 '23 02:01

Ondra Žižka