( xValue: XValue, xScale: XScale, timestampUnit: TimestampUnit, [xMin, xMax]: Domain, xCategories: Map<XValue, number>, width: number, kind: Kind, )
| 134 | }; |
| 135 | |
| 136 | const getX = ( |
| 137 | xValue: XValue, |
| 138 | xScale: XScale, |
| 139 | timestampUnit: TimestampUnit, |
| 140 | [xMin, xMax]: Domain, |
| 141 | xCategories: Map<XValue, number>, |
| 142 | width: number, |
| 143 | kind: Kind, |
| 144 | ): number | undefined => { |
| 145 | const continuousValue = getContinuousXValue(xValue, xScale, timestampUnit); |
| 146 | return xScale != CATEGORY |
| 147 | ? isUndefined(continuousValue) |
| 148 | ? undefined |
| 149 | : getScale(continuousValue, xMin, xMax, width) |
| 150 | : kind == BAR |
| 151 | ? (width * ((mapGet(xCategories, xValue) ?? 0) + 0.5)) / |
| 152 | collSize(xCategories) |
| 153 | : getScale( |
| 154 | mapGet(xCategories, xValue) ?? 0, |
| 155 | 0, |
| 156 | collSize(xCategories) - 1, |
| 157 | width, |
| 158 | ); |
| 159 | }; |
| 160 | |
| 161 | export const getScale = ( |
| 162 | value: number, |
no test coverage detected
searching dependent graphs…