trueChart Help

Client API

In the latest version of TRUECHART (>=2020.11.1) the already existing HiCo.API.trueChart namespace was extended to provide more flexibility and control over TRUECHARTs internals.

When TRUECHART gets loaded into the browser, it will check for existence and extend the already existing API namespace, so you also have the possibility to have some control by injecting JavaScript even before TRUECHART was loaded.

Overrides: define before TRUECHART was loaded

You can apply some customizations even before TRUECHART code was loaded into the browser (like in a QlikSense mashup, where you have the full control when this is going to happen).

Inject JavaScript before loading of TRUECHART
// Define overrides before TRUECHART was loaded
HiCo = {
  API: {
	trueChart: {
      /**
       * Can be used to explicitly overwrite some TRUECHART internals and customize the rendered output.
       */
      overrides: {
        /**
         * Must be set to true, to enable additional rendering of the SVG based table (1.0) as HTML table (as export table)
         */
        renderTableExport: true,
        /**
         * If set to true, TRUECHART will add some extra meta information to the rendered DOM elements (currently only for the table 2.0 and the table export)
         * 
         * Following attributes will be rendered additionally depending on the data type:
         *  data-type="text|number|date|comment|flag"
         *
         * Following attributes will be rendered for data type "number" (i.e. 123.5TEUR):
         *  data-value="123456.789"  The original value.
         *  data-factor="0.001"      The factor which was used to calculate the formatted value.
         *  data-decimals="1"        The number of decimals which was used (Math.round) to modify the precision of the value.
         *  data-unit="TEUR"         The unit which will be rendered only, when an explicit unit was used.
         */
        renderMetaData: true,
        /**
         * List of chart names (or ids) and the corresponding dimensions to be used as preferred size
         */
        preferredSize: {
          'chart123': {height: 300, width: 400},
          'Custom Cell Name': {height: 500; width: 500}
        }
      }
    }
  }
}

Overrides: define after TRUECHART was loaded

If you want to apply some customizations it is also possible after TRUECHART was loaded. Make sure you reuse the existing namespace!

Inject JavaScript after loading of TRUECHART
// Define overrides after TRUECHART was loaded
HiCo.API.trueChart.overrides = {
  renderTableExport: true,
  renderMetaData: true,
  preferredSize: {
    'chart123': {height: 300, width: 400},
    'Custom Cell Name': {height: 500; width: 500}
  }
};

Overrides: reset after TRUECHART was loaded

If you want to clear your modifications, you can do it one by one, or by setting the overrides property to an empty object.

Clearing overrides after loading of TRUECHART
// Clear the properties one by one
delete HiCo.API.trueChart.overrides.renderTableExport;
delete HiCo.API.trueChart.overrides.renderMetaData;
delete HiCo.API.trueChart.overrides.preferredSize;

// Clear all properties
HiCo.API.trueChart.overrides = {};

Repaint TRUECHART objects

If you need to repaint TRUECHART (i.e. after you changed some overrides properties), you can do it like like following.

Clearing overrides after loading of TRUECHART
// Repaint all active TRUECHART instances
HiCo.API.trueChart.repaint();