code: function (legendType, elems, scale) {
              var self = this;
              var legendsOptions = self.options.legend[legendType];
  
              if (!$.isArray(self.options.legend[legendType])) {
                  legendsOptions = [self.options.legend[legendType]];
              }
  
              self.legends[legendType] = {};
              for (var j = 0; j < legendsOptions.length; ++j) {
                  if (legendsOptions[j].display === true  && $.isArray(legendsOptions[j].slices) && legendsOptions[j].slices.length > 0 &&
                      legendsOptions[j].cssClass !== "" && $("." + legendsOptions[j].cssClass, self.$container).length !== 0
                  ) {
                      self.legends[legendType][j] = self.drawLegend(legendsOptions[j], legendType, elems, scale, j);
                  }
              }
          }
docs: /*
  Create all legends for a specified type (area or plot)
  @param legendType the type of the legend : "area" or "plot"
  @param elems collection of plots or areas displayed on the map
  @param scale scale ratio of the map