docs/a.js
function() {
			var me = this;
			var options = me.options;
			var scales = me.scales = {};
			var items = [];

			if (options.scales) {
				items = items.concat(
					(options.scales.xAxes || []).map(function(xAxisOptions) {
						return {options: xAxisOptions, dtype: 'category'};
					}),
					(options.scales.yAxes || []).map(function(yAxisOptions) {
						return {options: yAxisOptions, dtype: 'linear'};
					})
				);
			}

			if (options.scale) {
				items.push({options: options.scale, dtype: 'radialLinear', isDefault: true});
			}

			helpers.each(items, function(item) {
				var scaleOptions = item.options;
				var scaleType = helpers.getValueOrDefault(scaleOptions.type, item.dtype);
				var scaleClass = Chart.scaleService.getScaleConstructor(scaleType);
				if (!scaleClass) {
					return;
				}

				var scale = new scaleClass({
					id: scaleOptions.id,
					options: scaleOptions,
					ctx: me.chart.ctx,
					chart: me
				});

				scales[scale.id] = scale;

				// TODO(SB): I think we should be able to remove this custom case (options.scale)
				// and consider it as a regular scale part of the "scales"" map only! This would
				// make the logic easier and remove some useless? custom code.
				if (item.isDefault) {
					me.scale = scale;
				}
			});

			Chart.scaleService.addScalesToLayout(this);
		}
function() {
			var me = this;
			var options = me.options;
			var scales = me.scales = {};
			var items = [];

			if (options.scales) {
				items = items.concat(
					(options.scales.xAxes || []).map(function(xAxisOptions) {
						return {options: xAxisOptions, dtype: 'category'};
					}),
					(options.scales.yAxes || []).map(function(yAxisOptions) {
						return {options: yAxisOptions, dtype: 'linear'};
					})
				);
			}

			if (options.scale) {
				items.push({options: options.scale, dtype: 'radialLinear', isDefault: true});
			}

			helpers.each(items, function(item) {
				var scaleOptions = item.options;
				var scaleType = helpers.getValueOrDefault(scaleOptions.type, item.dtype);
				var scaleClass = Chart.scaleService.getScaleConstructor(scaleType);
				if (!scaleClass) {
					return;
				}

				var scale = new scaleClass({
					id: scaleOptions.id,
					options: scaleOptions,
					ctx: me.chart.ctx,
					chart: me
				});

				scales[scale.id] = scale;

				// TODO(SB): I think we should be able to remove this custom case (options.scale)
				// and consider it as a regular scale part of the "scales"" map only! This would
				// make the logic easier and remove some useless? custom code.
				if (item.isDefault) {
					me.scale = scale;
				}
			});

			Chart.scaleService.addScalesToLayout(this);
		}
function ( ) { var me = this ; var options = me . options ; var scales = me . scales = { } ; var items = [ ] ; if ( options . scales ) { items = items . concat ( ( options . scales . xAxes || [ ] ) . map ( function ( xAxisOptions ) { return { options : xAxisOptions , dtype : 'category' } ; } ) , ( options . scales . yAxes || [ ] ) . map ( function ( yAxisOptions ) { return { options : yAxisOptions , dtype : 'linear' } ; } ) ) ; } if ( options . scale ) { items . push ( { options : options . scale , dtype : 'radialLinear' , isDefault : true } ) ; } helpers . each ( items , function ( item ) { var scaleOptions = item . options ; var scaleType = helpers . getValueOrDefault ( scaleOptions . type , item . dtype ) ; var scaleClass = Chart . scaleService . getScaleConstructor ( scaleType ) ; if ( ! scaleClass ) { return ; } var scale = new scaleClass ( { id : scaleOptions . id , options : scaleOptions , ctx : me . chart . ctx , chart : me } ) ; scales [ scale . id ] = scale ; // TODO(SB): I think we should be able to remove this custom case (options.scale) // and consider it as a regular scale part of the "scales"" map only! This would // make the logic easier and remove some useless? custom code. if ( item . isDefault ) { me . scale = scale ; } } ) ; Chart . scaleService . addScalesToLayout ( this ) ; }
Builds a map of scale ID to scale object for future lookup.
Builds a map of scale ID to scale object for future lookup .