@@ -21,7 +21,6 @@ import { Domains, IDomainSex } from '../interfaces/Domains';
21
21
22
22
import { IPlottedCentileMeasurement , Reference , ICentile } from '../interfaces/CentilesObject' ;
23
23
import deepCopy from './deepCopy' ;
24
- import { ClientMeasurementObject } from '../interfaces/ClientMeasurementObject' ;
25
24
import { trisomy21HeightMaleCentileData } from '../chartdata/trisomy21_height_male_centile_data' ;
26
25
import { trisomy21HeightFemaleCentileData } from '../chartdata/trisomy21_height_female_centile_data' ;
27
26
import { trisomy21BMIFemaleCentileData } from '../chartdata/trisomy21_bmi_female_centile_data' ;
@@ -31,7 +30,6 @@ import { trisomy21WeightFemaleCentileData } from '../chartdata/trisomy21_weight_
31
30
import { trisomy21OFCMaleCentileData } from '../chartdata/trisomy21_ofc_male_centile_data' ;
32
31
import { trisomy21OFCFemaleCentileData } from '../chartdata/trisomy21_ofc_female_centile_data' ;
33
32
import { turnerHeightFemaleCentileData } from '../chartdata/turner_height_female_centile_data' ;
34
- import { LineSegment } from 'victory' ;
35
33
36
34
type CentileLabelValues = {
37
35
0.4 : { value : number ; workingX : number } ;
@@ -267,11 +265,8 @@ function childMeasurementRanges(
267
265
let chronologicalX = measurement . plottable_data . centile_data . chronological_decimal_age_data . x ;
268
266
let correctedY = measurement . plottable_data . centile_data . corrected_decimal_age_data . y ;
269
267
let chronologicalY = measurement . plottable_data . centile_data . chronological_decimal_age_data . y ;
268
+ const boneAgeX = measurement . bone_age . bone_age ;
270
269
const errorsPresent = false ;
271
- // measurement.measurement_calculated_values.corrected_measurement_error ||
272
- // measurement.measurement_calculated_values.chronological_measurement_error
273
- // ? true
274
- // : false;
275
270
276
271
if ( ! errorsPresent ) {
277
272
if ( showCorrected && ! showChronological ) {
@@ -299,6 +294,15 @@ function childMeasurementRanges(
299
294
lowestChildY = coord ;
300
295
}
301
296
}
297
+ // if bone age is present and value is more extreme than the highest or lowest x, update:
298
+ if ( boneAgeX ) {
299
+ if ( highestChildX < boneAgeX ) {
300
+ highestChildX = boneAgeX ;
301
+ }
302
+ if ( lowestChildX > boneAgeX ) {
303
+ lowestChildX = boneAgeX ;
304
+ }
305
+ }
302
306
} else {
303
307
console . warn ( 'Measurements considered invalid by the API given to the chart. The chart will ignore them.' ) ;
304
308
}
@@ -596,6 +600,7 @@ function getDomainsAndData(
596
600
}
597
601
if ( errorFree ) {
598
602
const { lowestChildX, highestChildX, lowestChildY, highestChildY } = childCoordinates ;
603
+
599
604
lowestYFromMeasurements = lowestChildY ;
600
605
highestYFromMeasurements = highestChildY ;
601
606
const difference = highestChildX - lowestChildX ;
0 commit comments