@antv/g2 4.1.36 → 4.1.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/g2.min.js +3 -3
- package/dist/g2.min.js.map +1 -1
- package/esm/chart/controller/scrollbar.js +3 -1
- package/esm/chart/controller/scrollbar.js.map +1 -1
- package/esm/chart/controller/slider.js +7 -1
- package/esm/chart/controller/slider.js.map +1 -1
- package/esm/core.d.ts +1 -1
- package/esm/core.js +1 -1
- package/esm/core.js.map +1 -1
- package/lib/chart/controller/scrollbar.js +3 -1
- package/lib/chart/controller/scrollbar.js.map +1 -1
- package/lib/chart/controller/slider.js +7 -1
- package/lib/chart/controller/slider.js.map +1 -1
- package/lib/core.d.ts +1 -1
- package/lib/core.js +1 -1
- package/lib/core.js.map +1 -1
- package/package.json +1 -1
- package/src/chart/controller/scrollbar.ts +17 -13
- package/src/chart/controller/slider.ts +12 -2
- package/src/core.ts +1 -1
package/package.json
CHANGED
|
@@ -55,7 +55,7 @@ export default class Scrollbar extends Controller<ScrollbarOption> {
|
|
|
55
55
|
this.view.off(VIEW_LIFE_CIRCLE.BEFORE_CHANGE_SIZE, this.resetMeasure);
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
public init() {}
|
|
58
|
+
public init() { }
|
|
59
59
|
|
|
60
60
|
/**
|
|
61
61
|
* 渲染
|
|
@@ -240,7 +240,11 @@ export default class Scrollbar extends Controller<ScrollbarOption> {
|
|
|
240
240
|
const { type } = this.getValidScrollbarCfg();
|
|
241
241
|
const isHorizontal = type !== 'vertical';
|
|
242
242
|
const values = valuesOfKey(this.data, this.xScaleCfg.field);
|
|
243
|
-
|
|
243
|
+
|
|
244
|
+
// 如果是 xScale 数值类型,则进行排序
|
|
245
|
+
const xScaleValues = this.view.getXScale().isLinear ? values.sort() : values;
|
|
246
|
+
|
|
247
|
+
const xValues = isHorizontal ? xScaleValues : xScaleValues.reverse();
|
|
244
248
|
this.yScalesCfg.forEach((cfg) => {
|
|
245
249
|
this.view.scale(cfg.field, {
|
|
246
250
|
formatter: cfg.formatter,
|
|
@@ -281,11 +285,11 @@ export default class Scrollbar extends Controller<ScrollbarOption> {
|
|
|
281
285
|
const config = this.getScrollbarComponentCfg();
|
|
282
286
|
const realConfig = this.trackLen
|
|
283
287
|
? {
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
288
|
+
...config,
|
|
289
|
+
trackLen: this.trackLen,
|
|
290
|
+
thumbLen: this.thumbLen,
|
|
291
|
+
thumbOffset: (this.trackLen - this.thumbLen) * this.ratio,
|
|
292
|
+
}
|
|
289
293
|
: { ...config };
|
|
290
294
|
this.scrollbar.component.update(realConfig);
|
|
291
295
|
|
|
@@ -320,13 +324,13 @@ export default class Scrollbar extends Controller<ScrollbarOption> {
|
|
|
320
324
|
const [paddingTop, paddingRight, paddingBottom, paddingLeft] = padding;
|
|
321
325
|
const position = isHorizontal
|
|
322
326
|
? {
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
327
|
+
x: coordinateBBox.minX + paddingLeft,
|
|
328
|
+
y: viewBBox.maxY - height - paddingBottom,
|
|
329
|
+
}
|
|
326
330
|
: {
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
331
|
+
x: viewBBox.maxX - width - paddingRight,
|
|
332
|
+
y: coordinateBBox.minY + paddingTop,
|
|
333
|
+
};
|
|
330
334
|
const step = this.getStep();
|
|
331
335
|
const cnt = this.getCnt();
|
|
332
336
|
const trackLen = isHorizontal
|
|
@@ -272,7 +272,13 @@ export default class Slider extends Controller<SliderOption> {
|
|
|
272
272
|
const data = this.view.getOptions().data;
|
|
273
273
|
const xScale = this.view.getXScale();
|
|
274
274
|
const isHorizontal = true;
|
|
275
|
-
|
|
275
|
+
let values = valuesOfKey(data, xScale.field);
|
|
276
|
+
|
|
277
|
+
// 如果是 xScale 数值类型,则进行排序
|
|
278
|
+
if (xScale.isLinear) {
|
|
279
|
+
values = values.sort();
|
|
280
|
+
}
|
|
281
|
+
|
|
276
282
|
const xValues = isHorizontal ? values : values.reverse();
|
|
277
283
|
const dataSize = size(data);
|
|
278
284
|
|
|
@@ -314,7 +320,11 @@ export default class Slider extends Controller<SliderOption> {
|
|
|
314
320
|
}
|
|
315
321
|
const isHorizontal = true;
|
|
316
322
|
const values = valuesOfKey(data, xScale.field);
|
|
317
|
-
|
|
323
|
+
|
|
324
|
+
// 如果是 xScale 数值类型,则进行排序
|
|
325
|
+
const xScaleValues = this.view.getXScale().isLinear ? values.sort() : values;
|
|
326
|
+
|
|
327
|
+
const xValues = isHorizontal ? xScaleValues : xScaleValues.reverse();
|
|
318
328
|
const xTickCount = size(xValues);
|
|
319
329
|
|
|
320
330
|
const minIndex = Math.floor(min * (xTickCount - 1));
|