@@ -38,34 +38,35 @@ export abstract class BarLineChartBase<U extends Entry, D extends IBarLineScatte
38
38
/**
39
39
* flag that indicates if auto scaling on the y axis is enabled
40
40
*/
41
- protected mAutoScaleMinMaxEnabled = false ;
41
+ protected mAutoScaleMinMaxEnabled : boolean ;
42
42
43
43
/**
44
44
* flag that indicates if pinch-zoom is enabled. if true, both x and y axis
45
45
* can be scaled with 2 fingers, if false, x and y axis can be scaled
46
46
* separately
47
47
*/
48
- protected mPinchZoomEnabled = false ;
48
+ protected mPinchZoomEnabled : boolean ;
49
49
50
50
/**
51
51
* flag that indicates if double tap zoom is enabled or not
52
52
*/
53
- protected mDoubleTapToZoomEnabled = false ;
53
+ protected mDoubleTapToZoomEnabled : boolean ;
54
54
55
55
/**
56
56
* flag that indicates if highlighting per dragging over a fully zoomed out
57
57
* chart is enabled
58
58
*/
59
- protected mHighlightPerDragEnabled = false ;
59
+ protected mHighlightPerDragEnabled : boolean ;
60
60
61
61
/**
62
62
* if true, dragging is enabled for the chart
63
63
*/
64
- private mDragXEnabled = false ;
65
- private mDragYEnabled = false ;
64
+ private mDragXEnabled : boolean ;
65
+ private mDragYEnabled : boolean ;
66
+ e ;
66
67
67
- private mScaleXEnabled = false ;
68
- private mScaleYEnabled = false ;
68
+ private mScaleXEnabled : boolean ;
69
+ private mScaleYEnabled : boolean ;
69
70
70
71
/**
71
72
* palet object for the (by default) lightgrey background of the grid
@@ -77,9 +78,9 @@ export abstract class BarLineChartBase<U extends Entry, D extends IBarLineScatte
77
78
/**
78
79
* flag indicating if the grid background should be drawn or not
79
80
*/
80
- protected mDrawGridBackground = false ;
81
+ protected mDrawGridBackground : boolean ;
81
82
82
- protected mDrawBorders = false ;
83
+ protected mDrawBorders : boolean ;
83
84
84
85
protected mClipValuesToContent = true ;
85
86
@@ -95,7 +96,7 @@ export abstract class BarLineChartBase<U extends Entry, D extends IBarLineScatte
95
96
/**
96
97
* flag indicating if the chart should stay at the same position after a rotation. Default is false.
97
98
*/
98
- protected mKeepPositionOnRotation = false ;
99
+ protected mKeepPositionOnRotation : boolean ;
99
100
100
101
/**
101
102
* the listener for user drawing on the chart
@@ -120,8 +121,6 @@ export abstract class BarLineChartBase<U extends Entry, D extends IBarLineScatte
120
121
121
122
protected mXAxisRenderer : XAxisRenderer ;
122
123
123
- protected mOffsetsBuffer : RectF = new RectF ( 0 , 0 , 0 , 0 ) ;
124
-
125
124
// /** the approximator object used for data filtering */
126
125
// private Approximator this.mApproximator;
127
126
@@ -141,18 +140,14 @@ export abstract class BarLineChartBase<U extends Entry, D extends IBarLineScatte
141
140
142
141
get gridBackgroundPaint ( ) {
143
142
if ( ! this . mGridBackgroundPaint ) {
144
- this . mGridBackgroundPaint = new Paint ( ) ;
145
- this . mGridBackgroundPaint . setStyle ( Style . FILL ) ;
143
+ this . mGridBackgroundPaint = Utils . getTemplatePaint ( 'black-fill' ) ;
146
144
this . mGridBackgroundPaint . setColor ( '#F0F0F0' ) ; // light
147
145
}
148
146
return this . mGridBackgroundPaint ;
149
147
}
150
148
get borderPaint ( ) {
151
149
if ( ! this . mBorderPaint ) {
152
- this . mBorderPaint = new Paint ( ) ;
153
- this . mBorderPaint . setStyle ( Style . STROKE ) ;
154
- this . mBorderPaint . setColor ( 'black' ) ;
155
- this . mBorderPaint . setStrokeWidth ( 1 ) ;
150
+ this . mBorderPaint = Utils . getTemplatePaint ( 'black-stroke' ) ;
156
151
}
157
152
return this . mBorderPaint ;
158
153
}
@@ -442,17 +437,13 @@ export abstract class BarLineChartBase<U extends Entry, D extends IBarLineScatte
442
437
}
443
438
this . mOffsetsCalculated = true ;
444
439
if ( ! this . mCustomViewPortEnabled ) {
445
- let offsetLeft = 0 ,
446
- offsetRight = 0 ,
447
- offsetTop = 0 ,
448
- offsetBottom = 0 ;
449
-
450
- this . calculateLegendOffsets ( this . mOffsetsBuffer ) ;
440
+ const offsetBuffer = Utils . getTempRectF ( ) ;
441
+ this . calculateLegendOffsets ( offsetBuffer ) ;
451
442
452
- offsetLeft += this . mOffsetsBuffer . left ;
453
- offsetTop += this . mOffsetsBuffer . top ;
454
- offsetRight += this . mOffsetsBuffer . right ;
455
- offsetBottom += this . mOffsetsBuffer . bottom ;
443
+ let offsetLeft = offsetBuffer . left ;
444
+ let offsetTop = offsetBuffer . top ;
445
+ let offsetRight = offsetBuffer . right ;
446
+ let offsetBottom = offsetBuffer . bottom ;
456
447
457
448
// offsets for y-labels
458
449
if ( this . mAxisLeft && this . mAxisLeft . needsOffset ( ) ) {
@@ -465,7 +456,6 @@ export abstract class BarLineChartBase<U extends Entry, D extends IBarLineScatte
465
456
466
457
if ( this . mXAxis . isEnabled ( ) && this . mXAxis . isDrawLabelsEnabled ( ) ) {
467
458
const xLabelHeight = this . mXAxis . mLabelRotatedHeight + this . mXAxis . getYOffset ( ) ;
468
-
469
459
// offsets for x-labels
470
460
if ( this . mXAxis . getPosition ( ) === XAxisPosition . BOTTOM ) {
471
461
offsetBottom += xLabelHeight ;
@@ -483,7 +473,6 @@ export abstract class BarLineChartBase<U extends Entry, D extends IBarLineScatte
483
473
offsetLeft += this . getExtraLeftOffset ( ) ;
484
474
485
475
const minOffset = this . mMinOffset ;
486
-
487
476
this . mViewPortHandler . restrainViewPort ( Math . max ( minOffset , offsetLeft ) , Math . max ( minOffset , offsetTop ) , Math . max ( minOffset , offsetRight ) , Math . max ( minOffset , offsetBottom ) ) ;
488
477
489
478
if ( Trace . isEnabled ( ) ) {
@@ -926,7 +915,7 @@ export abstract class BarLineChartBase<U extends Entry, D extends IBarLineScatte
926
915
/**
927
916
* flag that indicates if a custom viewport offset has been set
928
917
*/
929
- private mCustomViewPortEnabled = false ;
918
+ private mCustomViewPortEnabled : boolean ;
930
919
931
920
/**
932
921
* Sets custom offsets for the current ViewPort (the offsets on the sides of
@@ -1666,7 +1655,7 @@ export abstract class BarLineChartBase<U extends Entry, D extends IBarLineScatte
1666
1655
return this . mAutoScaleMinMaxEnabled ;
1667
1656
}
1668
1657
1669
- protected mOnSizeChangedBuffer = Utils . createNativeArray ( 2 ) ;
1658
+ protected mOnSizeChangedBuffer = Utils . createArrayBuffer ( 2 ) ;
1670
1659
1671
1660
public onSizeChanged ( w : number , h : number , oldw : number , oldh : number ) {
1672
1661
// Saving current position of chart.
0 commit comments