src/js/extensions/chart/chart.js
function setDefaultOptions(chartOptions, extensionOptions, chartContainer) {
  // chart options scaffolding
  chartOptions = util.extend({
    editorChart: {},
    chart: {},
    chartExportMenu: {},
    usageStatistics: extensionOptions.usageStatistics
  }, chartOptions);

  // set default extension options
  extensionOptions = util.extend(DEFAULT_CHART_OPTIONS, extensionOptions);

  // determine width, height
  let {width, height} = chartOptions.chart;
  const isWidthUndefined = util.isUndefined(width);
  const isHeightUndefined = util.isUndefined(height);
  if (isWidthUndefined || isHeightUndefined) {
    // if no width or height specified, set width and height to container width
    const {
      width: containerWidth
    } = chartContainer.getBoundingClientRect();

    width = isWidthUndefined ? extensionOptions.width : width;
    height = isHeightUndefined ? extensionOptions.height : height;
    width = width === 'auto' ? containerWidth : width;
    height = height === 'auto' ? containerWidth : height;
  }
  width = Math.min(extensionOptions.maxWidth, width);
  height = Math.min(extensionOptions.maxHeight, height);
  chartOptions.chart.width = Math.max(extensionOptions.minWidth, width);
  chartOptions.chart.height = Math.max(extensionOptions.minHeight, height);

  // default chart type
  chartOptions.editorChart.type = chartOptions.editorChart.type ? `${chartOptions.editorChart.type}Chart` : 'columnChart';
  // default visibility of export menu
  chartOptions.chartExportMenu.visible = chartOptions.chartExportMenu.visible || false;

  return chartOptions;
}
function setDefaultOptions(chartOptions, extensionOptions, chartContainer) {
  // chart options scaffolding
  chartOptions = util.extend({
    editorChart: {},
    chart: {},
    chartExportMenu: {},
    usageStatistics: extensionOptions.usageStatistics
  }, chartOptions);

  // set default extension options
  extensionOptions = util.extend(DEFAULT_CHART_OPTIONS, extensionOptions);

  // determine width, height
  let {width, height} = chartOptions.chart;
  const isWidthUndefined = util.isUndefined(width);
  const isHeightUndefined = util.isUndefined(height);
  if (isWidthUndefined || isHeightUndefined) {
    // if no width or height specified, set width and height to container width
    const {
      width: containerWidth
    } = chartContainer.getBoundingClientRect();

    width = isWidthUndefined ? extensionOptions.width : width;
    height = isHeightUndefined ? extensionOptions.height : height;
    width = width === 'auto' ? containerWidth : width;
    height = height === 'auto' ? containerWidth : height;
  }
  width = Math.min(extensionOptions.maxWidth, width);
  height = Math.min(extensionOptions.maxHeight, height);
  chartOptions.chart.width = Math.max(extensionOptions.minWidth, width);
  chartOptions.chart.height = Math.max(extensionOptions.minHeight, height);

  // default chart type
  chartOptions.editorChart.type = chartOptions.editorChart.type ? `${chartOptions.editorChart.type}Chart` : 'columnChart';
  // default visibility of export menu
  chartOptions.chartExportMenu.visible = chartOptions.chartExportMenu.visible || false;

  return chartOptions;
}
function setDefaultOptions ( chartOptions , extensionOptions , chartContainer ) { // chart options scaffolding chartOptions = util . extend ( { editorChart : { } , chart : { } , chartExportMenu : { } , usageStatistics : extensionOptions . usageStatistics } , chartOptions ) ; // set default extension options extensionOptions = util . extend ( DEFAULT_CHART_OPTIONS , extensionOptions ) ; // determine width, height let { width , height } = chartOptions . chart ; const isWidthUndefined = util . isUndefined ( width ) ; const isHeightUndefined = util . isUndefined ( height ) ; if ( isWidthUndefined || isHeightUndefined ) { // if no width or height specified, set width and height to container width const { width : containerWidth } = chartContainer . getBoundingClientRect ( ) ; width = isWidthUndefined ? extensionOptions . width : width ; height = isHeightUndefined ? extensionOptions . height : height ; width = width === 'auto' ? containerWidth : width ; height = height === 'auto' ? containerWidth : height ; } width = Math . min ( extensionOptions . maxWidth , width ) ; height = Math . min ( extensionOptions . maxHeight , height ) ; chartOptions . chart . width = Math . max ( extensionOptions . minWidth , width ) ; chartOptions . chart . height = Math . max ( extensionOptions . minHeight , height ) ; // default chart type chartOptions . editorChart . type = chartOptions . editorChart . type ? ` ${ chartOptions . editorChart . type } ` : 'columnChart' ; // default visibility of export menu chartOptions . chartExportMenu . visible = chartOptions . chartExportMenu . visible || false ; return chartOptions ; }
set default options
@param {Object} chartOptions - tui.chart options
@param {Object} extensionOptions - extension options
@param {HTMLElement} chartContainer - chart container
@returns {Object} - options
@see https://nhn.github.io/tui.chart/latest/tui.chart.html
@ignore
set default options