(
seriesModel: SeriesModel,
item: MarkerPositionOption
)
| 103 | * 2. Convert `item.xAxis`, `item.yAxis` to `item.coord` array |
| 104 | */ |
| 105 | export function dataTransform( |
| 106 | seriesModel: SeriesModel, |
| 107 | item: MarkerPositionOption |
| 108 | ) { |
| 109 | if (!item) { |
| 110 | return; |
| 111 | } |
| 112 | |
| 113 | const data = seriesModel.getData(); |
| 114 | const coordSys = seriesModel.coordinateSystem; |
| 115 | const dims = coordSys && coordSys.dimensions; |
| 116 | |
| 117 | // 1. If not specify the position with pixel directly |
| 118 | // 2. If `coord` is not a data array. Which uses `xAxis`, |
| 119 | // `yAxis` to specify the coord on each dimension |
| 120 | |
| 121 | // parseFloat first because item.x and item.y can be percent string like '20%' |
| 122 | if (!hasXAndY(item) && !isArray(item.coord) && isArray(dims)) { |
| 123 | const axisInfo = getAxisInfo(item, data, coordSys, seriesModel); |
| 124 | |
| 125 | // Clone the option |
| 126 | // Transform the properties xAxis, yAxis, radiusAxis, angleAxis, geoCoord to value |
| 127 | item = clone(item); |
| 128 | |
| 129 | if (item.type |
| 130 | && markerTypeCalculator[item.type] |
| 131 | && axisInfo.baseAxis && axisInfo.valueAxis |
| 132 | ) { |
| 133 | const otherCoordIndex = indexOf(dims, axisInfo.baseAxis.dim); |
| 134 | const targetCoordIndex = indexOf(dims, axisInfo.valueAxis.dim); |
| 135 | |
| 136 | const coordInfo = markerTypeCalculator[item.type]( |
| 137 | data, axisInfo.valueAxis.dim, axisInfo.baseDataDim, axisInfo.valueDataDim, |
| 138 | otherCoordIndex, targetCoordIndex |
| 139 | ); |
| 140 | item.coord = coordInfo[0]; |
| 141 | // Force to use the value of calculated value. |
| 142 | // let item use the value without stack. |
| 143 | item.value = coordInfo[1]; |
| 144 | } |
| 145 | else { |
| 146 | // FIXME Only has one of xAxis and yAxis. |
| 147 | item.coord = [ |
| 148 | item.xAxis != null ? item.xAxis : item.radiusAxis, |
| 149 | item.yAxis != null ? item.yAxis : item.angleAxis |
| 150 | ]; |
| 151 | } |
| 152 | } |
| 153 | // x y is provided |
| 154 | if (item.coord == null || !isArray(dims)) { |
| 155 | item.coord = []; |
| 156 | const baseAxis = seriesModel.getBaseAxis(); |
| 157 | if (baseAxis && item.type && markerTypeCalculator[item.type]) { |
| 158 | const otherAxis = coordSys.getOtherAxis(baseAxis); |
| 159 | if (otherAxis) { |
| 160 | item.value = numCalculate(data, data.mapDimension(otherAxis.dim), item.type); |
| 161 | } |
| 162 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…