File tree Expand file tree Collapse file tree 2 files changed +6
-17
lines changed Expand file tree Collapse file tree 2 files changed +6
-17
lines changed Original file line number Diff line number Diff line change @@ -138,7 +138,7 @@ export default class Helpers {
138
138
139
139
x =
140
140
w . globals . padHorizontal +
141
- ( xDivision - barWidth * this . barCtx . seriesLen ) / 2
141
+ Utils . noExponents ( xDivision - barWidth * this . barCtx . seriesLen ) / 2
142
142
}
143
143
144
144
w . globals . barHeight = barHeight
Original file line number Diff line number Diff line change @@ -148,23 +148,12 @@ class Utils {
148
148
return ( Math . random ( ) + 1 ) . toString ( 36 ) . substring ( 4 )
149
149
}
150
150
151
- static noExponents ( val ) {
152
- let data = String ( val ) . split ( / [ e E ] / )
153
- if ( data . length === 1 ) return data [ 0 ]
154
-
155
- let z = '' ,
156
- sign = val < 0 ? '-' : '' ,
157
- str = data [ 0 ] . replace ( '.' , '' ) ,
158
- mag = Number ( data [ 1 ] ) + 1
159
-
160
- if ( mag < 0 ) {
161
- z = sign + '0.'
162
- while ( mag ++ ) z += '0'
163
- return z + str . replace ( / ^ - / , '' )
151
+ static noExponents ( num ) {
152
+ // Check if the number contains 'e' (exponential notation)
153
+ if ( num . toString ( ) . includes ( 'e' ) ) {
154
+ return Math . round ( num ) // Round the number
164
155
}
165
- mag -= str . length
166
- while ( mag -- ) z += '0'
167
- return str + z
156
+ return num // Return as-is if no exponential notation
168
157
}
169
158
170
159
static elementExists ( element ) {
You can’t perform that action at this time.
0 commit comments