SpreadJS 13
SpreadJS Documentation / Developer's Guide / Features / Manage Data Visualization and Objects / Charts / Preserve Unsupported Charts
In This Topic
    Preserve Unsupported Charts
    In This Topic

    SpreadJS provides you with the ability to preserve unsupported charts when imported from other file formats. The preserveUnsupportedChart flag can be set to true which preserves the chart and its properties. The unsupported chart can also be exported to other file formats.

    The below image displays unsupported chart type in SpreadJS with default text "Unsupported Chart Type":

    The default value of preserveUnsupportedChart is false which converts the unsupported chart to column chart when imported in SpreadJS.

    Using Code

    This example preserves the unsupported chart in SpreadJS after importing it from Excel using code.

    JavaScript
    Copy Code
    var sheet = workbook.getSheet(1);
    sheet.charts.preserveUnsupportedChart(true);
    

    Note: The preserveUnsupportedChart flag is applied at worksheet level and hence, it needs to be called again when the active sheet is changed.

    This example defines customized text over the unsupported chart using code.

    JavaScript
    Copy Code
    sheet.charts.preserveUnsupportedChart(true, function (chart, chartHost) {
    var paintElement = document.createElement('div');
    paintElement.innerHTML = 'Chart display not supported';
    chartHost.appendChild(paintElement);
    });
    

    Note: The text displayed over the chart cannot be serialized to json data.

    The following chart types are currently not supported in SpreadJS: