text: import legendChart from 'britecharts/dist/umd/legend.min';
  import {select} from 'd3-selection';
  import {validateConfiguration, validateContainer} from '../helpers/validation';
  import {applyConfiguration} from '../helpers/configuration';
  
  const legend = {};
  
  legend.create = (el, data, configuration = {}) => {
      let container = select(el);
      let chart = legendChart();
  
      validateContainer(container);
      validateConfiguration(chart, configuration);
  
      // Calls the chart with the container and dataset
      container.datum(data).call(applyConfiguration(chart, configuration));
  
      return chart;
  };
  
  legend.update = (el, data, configuration = {}, chart) => {
      let container = select(el);
  
      validateContainer(container);
      validateConfiguration(chart, configuration);
      applyConfiguration(chart, configuration);
  
      // Calls the chart with the container and dataset
      if (data && data.length) {
          container.datum(data).call(chart);
      } else {
          container.call(chart);
      }
  
      return chart;
  };
  
  legend.destroy = () => {};
  
  export default legend;
  