Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/component/dataZoom/SliderZoomView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -400,8 +400,10 @@ class SliderZoomView extends DataZoomView {
const areaPoints = [[size[0], 0], [0, 0]];
const linePoints: number[][] = [];
const step = thisShadowExtent[1] / (Math.max(1, data.count() - 1));
const normalizationConstant = size[0] / (thisDataExtent[1] - thisDataExtent[0]);
const isTimeAxis = info.thisAxis.type === 'time';
const thisDataExtentSpan = thisDataExtent[1] - thisDataExtent[0];
const useTimeAxisCoord = isTimeAxis && isFinite(thisDataExtentSpan) && thisDataExtentSpan > 0;
const normalizationConstant = useTimeAxisCoord ? size[0] / thisDataExtentSpan : 0;
let thisCoord = -step;

// Optimize for large data shadow
Expand All @@ -410,13 +412,13 @@ class SliderZoomView extends DataZoomView {

data.each([info.thisDim, otherDim], function (thisValue: ParsedValue, otherValue: ParsedValue, index) {
if (stride > 0 && (index % stride)) {
if (!isTimeAxis) {
if (!useTimeAxisCoord) {
thisCoord += step;
}
return;
}

thisCoord = isTimeAxis
thisCoord = useTimeAxisCoord
? (+thisValue - thisDataExtent[0]) * normalizationConstant
: thisCoord + step;

Expand Down
81 changes: 81 additions & 0 deletions test/ut/spec/component/dataZoom/SliderZoomView.test.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.