1- import defaults from './core.defaults' ;
21import Element from './core.element' ;
32import { _alignPixel , _measureText , renderText , clipArea , unclipArea } from '../helpers/helpers.canvas' ;
43import { callback as call , each , finiteOrDefault , isArray , isFinite , isNullOrUndef , isObject } from '../helpers/helpers.core' ;
54import { toDegrees , toRadians , _int16Range , _limitValue , HALF_PI } from '../helpers/helpers.math' ;
65import { _alignStartEnd , _toLeftRightCenter } from '../helpers/helpers.extras' ;
76import { toFont , toPadding } from '../helpers/helpers.options' ;
8- import Ticks from './core.ticks' ;
7+
8+ import './core.scale.defaults' ;
9+
10+
911import { autoSkip } from './core.scale.autoskip' ;
1012
13+
1114const reverseAlign = ( align ) => align === 'left' ? 'right' : align === 'right' ? 'left' : align ;
1215const offsetFromEdge = ( scale , edge , offset ) => edge === 'top' || edge === 'left' ? scale [ edge ] + offset : scale [ edge ] - offset ;
1316
@@ -16,94 +19,6 @@ const offsetFromEdge = (scale, edge, offset) => edge === 'top' || edge === 'left
1619 * @typedef {{value:number | string, label?:string, major?:boolean, $context?:any} } Tick
1720 */
1821
19- defaults . set ( 'scale' , {
20- display : true ,
21- offset : false ,
22- reverse : false ,
23- beginAtZero : false ,
24-
25- /**
26- * Scale boundary strategy (bypassed by min/max time options)
27- * - `data`: make sure data are fully visible, ticks outside are removed
28- * - `ticks`: make sure ticks are fully visible, data outside are truncated
29- * @see https://github.com/chartjs/Chart.js/pull/4556
30- * @since 3.0.0
31- */
32- bounds : 'ticks' ,
33-
34- /**
35- * Addition grace added to max and reduced from min data value.
36- * @since 3.0.0
37- */
38- grace : 0 ,
39-
40- // grid line settings
41- grid : {
42- display : true ,
43- lineWidth : 1 ,
44- drawBorder : true ,
45- drawOnChartArea : true ,
46- drawTicks : true ,
47- tickLength : 8 ,
48- tickWidth : ( _ctx , options ) => options . lineWidth ,
49- tickColor : ( _ctx , options ) => options . color ,
50- offset : false ,
51- borderDash : [ ] ,
52- borderDashOffset : 0.0 ,
53- borderColor : ( _ctx , options ) => options . color ,
54- borderWidth : ( _ctx , options ) => options . lineWidth
55- } ,
56-
57- // scale title
58- title : {
59- // display property
60- display : false ,
61-
62- // actual label
63- text : '' ,
64-
65- // top/bottom padding
66- padding : {
67- top : 4 ,
68- bottom : 4
69- }
70- } ,
71-
72- // label settings
73- ticks : {
74- minRotation : 0 ,
75- maxRotation : 50 ,
76- mirror : false ,
77- textStrokeWidth : 0 ,
78- textStrokeColor : '' ,
79- padding : 3 ,
80- display : true ,
81- autoSkip : true ,
82- autoSkipPadding : 3 ,
83- labelOffset : 0 ,
84- // We pass through arrays to be rendered as multiline labels, we convert Others to strings here.
85- callback : Ticks . formatters . values ,
86- minor : { } ,
87- major : { } ,
88- align : 'center' ,
89- crossAlign : 'near' ,
90- }
91- } ) ;
92-
93- defaults . route ( 'scale.ticks' , 'color' , '' , 'color' ) ;
94- defaults . route ( 'scale.grid' , 'color' , '' , 'borderColor' ) ;
95- defaults . route ( 'scale.title' , 'color' , '' , 'color' ) ;
96-
97- defaults . describe ( 'scale' , {
98- _fallback : false ,
99- _scriptable : ( name ) => ! name . startsWith ( 'before' ) && ! name . startsWith ( 'after' ) && name !== 'callback' && name !== 'parser' ,
100- _indexable : ( name ) => name !== 'borderDash' && name !== 'tickBorderDash' ,
101- } ) ;
102-
103- defaults . describe ( 'scales' , {
104- _fallback : 'scale' ,
105- } ) ;
106-
10722/**
10823 * Returns a new array containing numItems from arr
10924 * @param {any[] } arr
0 commit comments