Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed error thrown while rendering Multi Type chart containing Area #371

Merged
merged 2 commits into from
Sep 11, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions dist/pptxgen.js
Original file line number Diff line number Diff line change
Expand Up @@ -2533,13 +2533,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 -----------------------------------------------------------
Expand Down Expand Up @@ -2677,7 +2679,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 = '';
Expand Down Expand Up @@ -2872,7 +2874,9 @@ var PptxGenJS = function(){
strXml += ' </a:defRPr>';
strXml += ' </a:pPr></a:p>';
strXml += ' </c:txPr>';
if ( opts.type.name != 'area' && opts.type.name != 'radar') strXml += '<c:dLblPos val="'+ (opts.dataLabelPosition || 'outEnd') +'"/>';
// 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' && opts.type.name != 'radar' && !isMultiTypeChart) strXml += '<c:dLblPos val="'+ (opts.dataLabelPosition || 'outEnd') +'"/>';
strXml += ' <c:showLegendKey val="0"/>';
strXml += ' <c:showVal val="'+ (opts.showValue ? '1' : '0') +'"/>';
strXml += ' <c:showCatName val="0"/>';
Expand Down