Name

sn_ppt_export.DrawChart

Description

Content-Generation The purpose of this script include is to provide the chart template. Warning Customers should not modify this file.

Script

var DrawChart = Class.create();
DrawChart.prototype = {
  initialize: function() {},

  createChart: function(slideNumber, x, y, w, h, reportTypeSysID, uniqueIdentifier, params) {
      var data = {
          "slideNumber": slideNumber,
          "xAxisPosition": x,
          "yAxisPosition": y,
          "width": w,
          "height": h
      };
      var chartData = '{}';
      var chartType = 'LINE';
  	data["chartType"] = "LINE";
      var stepMethodCallObject = {};
      var stepActionObject = {};
      try {
          var scriptedElementGr = new GlideRecord(GeneratePPTConstants.SCRIPTED_ELEMENT_TABLENAME);
          scriptedElementGr.addQuery(GeneratePPTConstants.SCRIPTED_ELEMENT_TABLE_REFERENCED_REPORT_TYPE_FIELD_NAME, reportTypeSysID);
          scriptedElementGr.addQuery("sys_id", uniqueIdentifier);
          scriptedElementGr.setLimit(1);
          scriptedElementGr.query();
          if (scriptedElementGr.next()) {
              var evaluator = new GlideScopedEvaluator();
              if (scriptedElementGr.getValue('type') === '3069a2cd77230110c974206acd5a993f')
                  chartType = 'LINE';
              else if (scriptedElementGr.getValue('type') === '9479aa8d77230110c974206acd5a99a3')
                  chartType = 'BAR';
              chartData = evaluator.evaluateScript(scriptedElementGr, "data_script", params);
          }
          for (key in chartData)
              data[key] = chartData[key];
      } catch (e) {
          gs.info("LOG: DrawChart " + e.message);
      } finally {
  		if (!chartData)
              data["chartType"] = chartType;
          stepMethodCallObject = {
              'methodName': 'addChart',
              'parameterJSON': JSON.stringify(data)
          };
          stepActionObject = {
              'actionName': 'chart',
              'methodCalls': []
          };
          stepActionObject["methodCalls"].push(stepMethodCallObject);
      }
      return stepActionObject;
  },

  type: 'DrawChart'
};

Sys ID

beeb0e5253710110b595ddeeff7b120c

Offical Documentation

Official Docs: