(
dataZoomModel: SliderZoomModel,
extentIdx: 0 | 1,
window: AxisProxyWindow,
scale: Scale
)
| 1128 | } |
| 1129 | |
| 1130 | function formatLabel( |
| 1131 | dataZoomModel: SliderZoomModel, |
| 1132 | extentIdx: 0 | 1, |
| 1133 | window: AxisProxyWindow, |
| 1134 | scale: Scale |
| 1135 | ): string { |
| 1136 | const labelFormatter = dataZoomModel.get('labelFormatter'); |
| 1137 | |
| 1138 | let labelPrecision = dataZoomModel.get('labelPrecision'); |
| 1139 | if (labelPrecision == null || labelPrecision === 'auto') { |
| 1140 | labelPrecision = window.valuePrecision; |
| 1141 | } |
| 1142 | |
| 1143 | // Do not display values out of `SCALE_EXTENT_KIND_EFFECTIVE` - generally they are meaningless. |
| 1144 | // For example, `scaleExtent[0]` is often `0`, and negative values are unlikely to be meaningful. |
| 1145 | // That is, "nice" expansion and `SCALE_EXTENT_KIND_MAPPING` expansion are always not display in labels. |
| 1146 | const value = window.value[extentIdx]; |
| 1147 | |
| 1148 | const valueStr = (value == null || isNaN(value)) |
| 1149 | ? '' |
| 1150 | : (isOrdinalScale(scale) || isTimeScale(scale)) |
| 1151 | ? scale.getLabel({value: Math.round(value)}) |
| 1152 | : isFinite(labelPrecision) |
| 1153 | ? round(value, labelPrecision, true) |
| 1154 | : value + ''; |
| 1155 | |
| 1156 | return isFunction(labelFormatter) |
| 1157 | ? labelFormatter(value, valueStr) |
| 1158 | : isString(labelFormatter) |
| 1159 | ? labelFormatter.replace('{value}', valueStr) |
| 1160 | : valueStr; |
| 1161 | } |
| 1162 | |
| 1163 | function getOtherDim(thisDim: 'x' | 'y' | 'radius' | 'angle' | 'single' | 'z') { |
| 1164 | // FIXME |
no test coverage detected
searching dependent graphs…