PHP Classes

File: vendors/chart.js/src/core/core.scaleService.js

Recommend this page to a friend!
  Classes of Jorge Castro   Gentelella BladeOne   vendors/chart.js/src/core/core.scaleService.js   Download  
File: vendors/chart.js/src/core/core.scaleService.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Gentelella BladeOne
Render templates using Bootstrap for presentation
Author: By
Last change:
Date: 3 years ago
Size: 1,457 bytes
 

Contents

Class file image Download
"use strict"; module.exports = function(Chart) { var helpers = Chart.helpers; Chart.scaleService = { // Scale registration object. Extensions can register new scale types (such as log or DB scales) and then // use the new chart options to grab the correct scale constructors: {}, // Use a registration function so that we can move to an ES6 map when we no longer need to support // old browsers // Scale config defaults defaults: {}, registerScaleType: function(type, scaleConstructor, defaults) { this.constructors[type] = scaleConstructor; this.defaults[type] = helpers.clone(defaults); }, getScaleConstructor: function(type) { return this.constructors.hasOwnProperty(type) ? this.constructors[type] : undefined; }, getScaleDefaults: function(type) { // Return the scale defaults merged with the global settings so that we always use the latest ones return this.defaults.hasOwnProperty(type) ? helpers.scaleMerge(Chart.defaults.scale, this.defaults[type]) : {}; }, updateScaleDefaults: function(type, additions) { var defaults = this.defaults; if (defaults.hasOwnProperty(type)) { defaults[type] = helpers.extend(defaults[type], additions); } }, addScalesToLayout: function(chartInstance) { // Adds each scale to the chart.boxes array to be sized accordingly helpers.each(chartInstance.scales, function(scale) { Chart.layoutService.addBox(chartInstance, scale); }); } }; };