Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Published by Scroll Versions from this space and version 1.7.4

SINCE VERSION 1.7.2 We have upgraded our xCharts C3.js dependency to version 0.7.8 (from 0.4.11) for newer features, improvements and bug fixes. This version of C3 depends on D3.js version 5.11.0 (from 3.5.6).This in-turn could lead to broken scripted charts due to few methods deprecated in D3 library. We are unaware of any breaking changes in the C3 library itself. 


For an exhaustive list of changes please check the official notes from D3.

It is highly recommended that you change your scripts that rely on D3 deprecated methods to use the newer ones. Generally, it only requires method call changes. However, if you want a quick workaround, the following snippets (for two widely used D3 methods: d3.round() and d3.time.format()) can help you while you migrate to the newer D3 methods.


You need to insert the snippets at the beginning of the Javascript layout file. You can follow this workaround pattern to add any deprecated methods by following through D3 source code. We do not provide support as this is not a recommended approach. See further below for a proper D3 version 5 approach.

Code Block
    // Put this at the beginning of your Layout Script Code

		if (typeof (d3.round) === "undefined")
			d3.round = function (x, n)
				return n
					? Math.round(x * Math.pow(10, n)) * Math.pow(10, -n)
					: Math.round(x);

		if (typeof (d3.time && d3.time.format) === "undefined")
			d3.time = {};
			d3.time.format = d3.timeFormat;

    //.... Your Layout Script Code continues below ...

New methods

The corresponding D3 version 5 equivalent and recommended approaches are:

Code Block
// for d3.round(val)

// for d3.round(val, 2);

// for d3.time.format("%Y")(date)