text: /**
   * @fileoverview  Plugin factory play role register rendering plugin.
   *                Also, you can get plugin from this factory.
   * @author NHN Ent.
   *         FE Development Lab <dl_javascript@nhnent.com>
   */
  
  'use strict';
  
  var chartConst = require('../const');
  
  var plugins = {},
      factory = {
          /**
           * Get graph renderer.
           * @param {string} libType type of graph library
           * @param {string} chartType chart type
           * @returns {object} renderer instance
           */
          get: function(libType, chartType) {
              var plugin = plugins[libType || chartConst.DEFAULT_PLUGIN],
                  Renderer, renderer;
  
              if (!plugin) {
                  throw new Error('Not exist ' + libType + ' plugin.');
              }
  
              Renderer = plugin[chartType];
              if (!Renderer) {
                  throw new Error('Not exist ' + chartType + ' chart renderer.');
              }
  
              renderer = new Renderer();
  
              return renderer;
          },
          /**
           * Plugin register.
           * @param {string} libType type of graph library
           * @param {object} plugin plugin to control library
           */
          register: function(libType, plugin) {
              plugins[libType] = plugin;
          }
      };
  
  module.exports = factory;
  