jqDataVisualization for jQuery Documentation

Chart.Legend


Defines a chart legend. It contains visual appearance, position and content properties.

Sample configuration:

var legendConfig = {
   visible: true,
   title: {
       text: 'Legend Title',
       font: '14px sans-serif',
       fillStyle: 'red'
   },
   border: {
       lineWidth: 2,
       strokeStyle: 'green'
   },
   font: '12px sans-serif',
   textFillStyle: '#418CF0',
   background: '#eeeeee',
   margin: 10
}

Example usage:

$(document).ready(function () {
      $('#selector').jqChart({
          title: { text: 'Chart Legend' },
          legend: {
              visible: true,
              allowHideSeries: true,
              location : 'right',
              title: {
                  text: 'Legend Title',
                  font: '14px sans-serif',
                  fillStyle: 'red'
              },
              border: {
                  lineWidth: 2,
                  strokeStyle: 'green'
              },
              font: '12px sans-serif',
              textFillStyle: '#418CF0',
              background: '#eeeeee',
              margin: 10
          },
          series: [
             {
                 title: 'Series Title 1',
                 type: 'column',
                 data: [['A', 70], ['B', 40], ['C', 85],
                        ['D', 50], ['E', 25], ['F', 40]]
             },
             {
                 title: 'Series Title 2',
                 type: 'column',
                 data: [['A', 67], ['B', 25], ['C', 11],
                        ['D', 18], ['E', 44], ['F', 14]]
             }
          ]
      }
    }
Defined By

Config options

Chart.Legend
: Boolean
Specifies whether or not the series can be hide from the legend. ...

Specifies whether or not the series can be hide from the legend.

Defaults to: true

Specifies the background fill style of the legend.

Specifies the background fill style of the legend.

Chart.Legend
: Common.Border
Specifies the legend border. ...

Specifies the legend border.

Defaults to: {padding: 2, strokeStyle: 'gray', cornerRadius: 6}

Specifies an array of custom legend items.

Specifies an array of custom legend items.

Chart.Legend
: String
Specifies the legend font. ...

Specifies the legend font.

Defaults to: '12px sans-serif'

Specifies legend items fill style. ...

Specifies legend items fill style.

Defaults to: 'gray'

Specifies legend items fill style. ...

Specifies legend items fill style.

Defaults to: 'gray'

Specifies legend items text color. ...

Specifies legend items text color.

Defaults to: 'gray'

Specifies legend items text border line width. ...

Specifies legend items text border line width.

Defaults to: 0

Specifies legend items text border color.

Specifies legend items text border color.

Chart.Legend
: String

Specifies legend items cursor.

Specifies legend items cursor.

Chart.Legend
: Number
Specifies the horizontal margin between legend items. ...

Specifies the horizontal margin between legend items.

Defaults to: 4

Chart.Legend
: Number
Specifies the vertical margin between legend items. ...

Specifies the vertical margin between legend items.

Defaults to: 0

Chart.Legend
: String
Specifies the legend location - 'right', 'bottom', 'left' or 'top'. ...

Specifies the legend location - 'right', 'bottom', 'left' or 'top'.

Defaults to: 'right'

Chart.Legend
: Number
Specifies the legend margin. ...

Specifies the legend margin.

Defaults to: 4

Chart.Legend
: String

Specifies legend items text color.

Specifies legend items text color.

Chart.Legend
: Number
Specifies legend items text border line width. ...

Specifies legend items text border line width.

Defaults to: 0

Chart.Legend
: String

Specifies legend items text border color.

Specifies legend items text border color.

Chart.Legend
: String/Common.Title

Specifies the legend title.

Specifies the legend title.

Chart.Legend
: Boolean
Specifies whether or not the legend should be displayed. ...

Specifies whether or not the legend should be displayed.

Defaults to: true