MCPcopy
hub / github.com/apache/echarts / clampData

Method clampData

src/coord/cartesian/Cartesian2D.ts:154–172  ·  view source on GitHub ↗
(data: ScaleDataValue[], out?: number[])

Source from the content-addressed store, hash-verified

152 }
153
154 clampData(data: ScaleDataValue[], out?: number[]): number[] {
155 const xScale = this.getAxis('x').scale;
156 const yScale = this.getAxis('y').scale;
157 const xAxisExtent = xScale.getExtent();
158 const yAxisExtent = yScale.getExtent();
159 const x = xScale.parse(data[0]);
160 const y = yScale.parse(data[1]);
161 out = out || [];
162 out[0] = Math.min(
163 Math.max(Math.min(xAxisExtent[0], xAxisExtent[1]), x),
164 Math.max(xAxisExtent[0], xAxisExtent[1])
165 );
166 out[1] = Math.min(
167 Math.max(Math.min(yAxisExtent[0], yAxisExtent[1]), y),
168 Math.max(yAxisExtent[0], yAxisExtent[1])
169 );
170
171 return out;
172 }
173
174 pointToData(point: number[], clamp?: boolean, out?: number[]): number[] {
175 out = out || [];

Callers 2

getMarkerPositionMethod · 0.80
getSingleMarkerEndPointFunction · 0.80

Calls 3

getExtentMethod · 0.65
getAxisMethod · 0.45
parseMethod · 0.45

Tested by

no test coverage detected