code: function (chart, options) {
  
              var legend = this,
                itemStyle = options.itemStyle,
                padding = pick(options.padding, 8),
                itemMarginTop = options.itemMarginTop || 0;
  
              this.options = options;
  
              if (!options.enabled) {
                  return;
              }
  
              legend.itemStyle = itemStyle;
              legend.itemHiddenStyle = merge(itemStyle, options.itemHiddenStyle);
              legend.itemMarginTop = itemMarginTop;
              legend.padding = padding;
              legend.initialItemX = padding;
              legend.initialItemY = padding - 5; // 5 is the number of pixels above the text
              legend.maxItemWidth = 0;
              legend.chart = chart;
              legend.itemHeight = 0;
              legend.lastLineHeight = 0;
              legend.symbolWidth = pick(options.symbolWidth, 16);
              legend.pages = [];
  
  
              // Render it
              legend.render();
  
              // move checkboxes
              addEvent(legend.chart, 'endResize', function () {
                  legend.positionCheckboxes();
              });
  
          }
docs: Initialize the legend