MCPcopy Create free account
hub / github.com/chartjs/Chart.js / logarithmic

Function logarithmic

src/core/core.ticks.js:94–103  ·  view source on GitHub ↗

* Formatter for logarithmic ticks * @method Chart.Ticks.formatters.logarithmic * @param tickValue {number} the value to be formatted * @param index {number} the position of the tickValue parameter in the ticks array * @param ticks {object[]} the list of ticks being converted * @return

(tickValue, index, ticks)

Source from the content-addressed store, hash-verified

92 * @return {string} string representation of the tickValue parameter
93 */
94 logarithmic(tickValue, index, ticks) {
95 if (tickValue === 0) {
96 return '0';
97 }
98 const remain = ticks[index].significand || (tickValue / (Math.pow(10, Math.floor(log10(tickValue)))));
99 if ([1, 2, 3, 5, 10, 15].includes(remain) || index > 0.8 * ticks.length) {
100 return formatters.numeric.call(this, tickValue, index, ticks);
101 }
102 return '';
103 }
104
105};
106

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected