From f96a698d2bd222ecf3048e4b66e96f2eed16c6ac Mon Sep 17 00:00:00 2001 From: Krishna Teja Reddy Date: Wed, 4 Jul 2018 16:58:34 +0530 Subject: [PATCH] Removed error thrown while rendering Multi Type chart containing Area Data label position is being set to outEnd for Multitype charts that contain an area chart as the other chart type would enable inclusion of that line. Hence either the suggested changes can be made or the entire line checking the condition can be removed. --- dist/pptxgen.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/dist/pptxgen.js b/dist/pptxgen.js index 0ca9f942f..2a82e1761 100644 --- a/dist/pptxgen.js +++ b/dist/pptxgen.js @@ -2469,13 +2469,15 @@ var PptxGenJS = function(){ var options = getMix(rel.opts, type.options); var valAxisId = options.secondaryValAxis ? AXIS_ID_VALUE_SECONDARY : AXIS_ID_VALUE_PRIMARY; var catAxisId = options.secondaryCatAxis ? AXIS_ID_CATEGORY_SECONDARY : AXIS_ID_CATEGORY_PRIMARY; + var isMultiTypeChart = true; usesSecondaryValAxis = usesSecondaryValAxis || options.secondaryValAxis; - strXml += makeChartType(chartType, data, options, valAxisId, catAxisId); + strXml += makeChartType(chartType, data, options, valAxisId, catAxisId, isMultiTypeChart); }); } else { var chartType = rel.opts.type.name; - strXml += makeChartType(chartType, rel.data, rel.opts, AXIS_ID_VALUE_PRIMARY, AXIS_ID_CATEGORY_PRIMARY); + var isMultiTypeChart = false; + strXml += makeChartType(chartType, rel.data, rel.opts, AXIS_ID_VALUE_PRIMARY, AXIS_ID_CATEGORY_PRIMARY, isMultiTypeChart); } // B: Axes ----------------------------------------------------------- @@ -2613,7 +2615,7 @@ var PptxGenJS = function(){ * @param {String} valAxisId * @param {String} catAxisId */ - function makeChartType(chartType, data, opts, valAxisId, catAxisId) { + function makeChartType(chartType, data, opts, valAxisId, catAxisId, isMultiTypeChart) { // NOTE: "Chart Range" (as shown in "select Chart Area dialog") is calculated. // ....: Ensure each X/Y Axis/Col has same row height (esp. applicable to XY Scatter where X can often be larger than Y's) var strXml = ''; @@ -2802,7 +2804,9 @@ var PptxGenJS = function(){ strXml += ' '; strXml += ' '; strXml += ' '; - if ( opts.type.name != 'area' ) strXml += ''; + // NOTE: Throwing an error while creating a multi type chart which contains area chart as the below line appears for the other chart type. + // Either the given change can be made or the below line can be removed to stop the slide containing multi type chart with area to crash. + if ( opts.type.name != 'area' && !isMultiTypeChart) strXml += ''; strXml += ' '; strXml += ' '; strXml += ' ';