Skip to content

Commit 28c1af0

Browse files
committed
Use store loop for sampling extent count
Copilot flagged that SeriesData.each still adds callback binding overhead in the visible-window count path. This keeps the existing scale containment semantics but reads parsed values through the underlying DataStore with a precomputed dimension index. Constraint: direct min/max checks from scale.getExtent did not preserve the filterMode none regression case Confidence: high Scope-risk: narrow Tested: npm run checktype -- --pretty false Tested: npm run lint -- --quiet src/processor/dataSample.ts Tested: git diff --check -- src/processor/dataSample.ts Tested: test/line-sampling-dataZoom-filterMode.html via Chrome, PASS with store-loop count Not-tested: Full visual regression suite
1 parent 8d34ed8 commit 28c1af0

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

src/processor/dataSample.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,14 @@ const indexSampler = function (frame: ArrayLike<number>) {
7777
function countDataInAxisExtent(data: SeriesData, baseAxis: Axis, baseDim: string) {
7878
let count = 0;
7979
const scale = baseAxis.scale;
80-
data.each(baseDim, function (value: number) {
80+
const store = data.getStore();
81+
const dimIdx = data.getDimensionIndex(baseDim);
82+
for (let i = 0, len = data.count(); i < len; i++) {
83+
const value = store.get(dimIdx, i) as number;
8184
if (scale.contain(value)) {
8285
count++;
8386
}
84-
});
87+
}
8588
return count;
8689
}
8790

0 commit comments

Comments
 (0)