@devexperts/dxcharts-lite 2.7.31 → 2.7.33

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.
Files changed (26) hide show
  1. package/dist/chart/components/chart/price-formatters/__tests__/price.formatter.test.d.ts +6 -0
  2. package/dist/chart/components/chart/price-formatters/__tests__/price.formatter.test.js +150 -0
  3. package/dist/chart/components/chart/price-formatters/price.formatter.d.ts +1 -1
  4. package/dist/chart/components/chart/price-formatters/price.formatter.js +10 -3
  5. package/dist/chart/components/chart/price-formatters/treasury-price.formatter.d.ts +1 -1
  6. package/dist/chart/components/chart/price-formatters/treasury-price.formatter.js +7 -2
  7. package/dist/chart/components/cross_tool/types/cross-and-labels.drawer.js +1 -1
  8. package/dist/chart/components/highlights/highlights.drawer.d.ts +3 -4
  9. package/dist/chart/components/highlights/highlights.drawer.js +38 -29
  10. package/dist/chart/components/pane/extent/y-extent-component.d.ts +7 -2
  11. package/dist/chart/components/pane/extent/y-extent-component.js +9 -5
  12. package/dist/chart/components/pane/pane.component.d.ts +7 -5
  13. package/dist/chart/components/pane/pane.component.js +15 -4
  14. package/dist/chart/components/volumes/separate-volumes.component.d.ts +3 -1
  15. package/dist/chart/components/volumes/separate-volumes.component.js +19 -3
  16. package/dist/chart/components/volumes/volumes.component.d.ts +2 -0
  17. package/dist/chart/components/volumes/volumes.component.js +9 -0
  18. package/dist/chart/components/y_axis/price_labels/data-series-y-axis-labels.provider.js +1 -1
  19. package/dist/chart/components/y_axis/price_labels/last-candle-labels.provider.js +4 -1
  20. package/dist/chart/model/hit-test-canvas.model.d.ts +1 -1
  21. package/dist/chart/model/hit-test-canvas.model.js +1 -0
  22. package/dist/chart/model/scale.model.js +4 -0
  23. package/dist/chart/utils/math.utils.d.ts +2 -0
  24. package/dist/chart/utils/math.utils.js +8 -1
  25. package/dist/dxchart.min.js +4 -4
  26. package/package.json +7 -7
@@ -38,7 +38,7 @@ export class DataSeriesYAxisLabelsProvider {
38
38
  if (!isFinite(lastPointY)) {
39
39
  return [];
40
40
  }
41
- const label = this.series.valueFormatter(lastPoint.close);
41
+ const label = this.series.extentComponent.valueFormatter(lastPoint.close, { formatWithSeparators: true });
42
42
  const drawConfig = this.getLabelDrawConfig();
43
43
  return [
44
44
  {
@@ -68,7 +68,10 @@ export class LastCandleLabelsProvider {
68
68
  return {
69
69
  y,
70
70
  labelWeight: 0,
71
- labelText: this.chartModel.pane.valueFormatter(lastCandle.close, series),
71
+ labelText: this.chartModel.pane.valueFormatter(lastCandle.close, {
72
+ formatWithSeparators: true,
73
+ dataSeries: series,
74
+ }),
72
75
  mode,
73
76
  labelType: appearanceType,
74
77
  description: series.instrument.symbol,
@@ -12,7 +12,7 @@ import EventBus from '../events/event-bus';
12
12
  import { CanvasInputListenerComponent, Point } from '../inputlisteners/canvas-input-listener.component';
13
13
  export declare const bigPrimeNumber = 317;
14
14
  export type HitTestEvents = 'mousedown' | 'hover' | 'touchstart' | 'dblclick' | 'contextmenu' | 'zoom' | 'mouseup';
15
- type HitTestType = 'DRAWINGS' | 'DATA_SERIES' | 'EVENTS' | 'NEWS' | 'EXECUTED_ORDERS';
15
+ type HitTestType = 'DRAWINGS' | 'DATA_SERIES' | 'EVENTS' | 'NEWS' | 'EXECUTED_ORDERS' | 'CUSTOM_STUDY_LABELS';
16
16
  export declare const HIT_TEST_ID_RANGE: Record<HitTestType, [number, number]>;
17
17
  /** HitTestCanvasModel
18
18
  * Canvas layer for testing mouse events over the models such as Charts, Drawings, Volumes and etc.
@@ -15,6 +15,7 @@ export const HIT_TEST_ID_RANGE = {
15
15
  DATA_SERIES: [6000, 9999],
16
16
  EVENTS: [10000, 12999],
17
17
  EXECUTED_ORDERS: [13000, 15999],
18
+ CUSTOM_STUDY_LABELS: [16000, 19999],
18
19
  };
19
20
  /** HitTestCanvasModel
20
21
  * Canvas layer for testing mouse events over the models such as Charts, Drawings, Volumes and etc.
@@ -376,6 +376,7 @@ export class ScaleModel extends ViewportModel {
376
376
  */
377
377
  autoScale(auto = true) {
378
378
  // TODO rework, make this a separate feature toggle, describe in docs; this should be a business-logic level
379
+ const prevAuto = this.state.auto;
379
380
  if (this.config.components.yAxis.type === 'percent') {
380
381
  this.state.auto = true;
381
382
  }
@@ -386,6 +387,9 @@ export class ScaleModel extends ViewportModel {
386
387
  this.clearHistory();
387
388
  this.doAutoScale();
388
389
  }
390
+ else if (prevAuto !== this.state.auto) {
391
+ this.fireChanged();
392
+ }
389
393
  }
390
394
  /**
391
395
  * Sets whether the price-to-bar ratio should be locked or not.
@@ -8,6 +8,8 @@ export declare class MathUtils {
8
8
  static roundToNearest(value: number, precision: number): number;
9
9
  static roundUpToNearest(value: number, precision: number): number;
10
10
  static roundDecimal(x: number): number;
11
+ static readonly THOUSANDS_SEPARATOR_REGEX: RegExp;
12
+ static formatIntegerWithSeparator(integerValue: number, thousandsSeparator: string): string;
11
13
  static makeDecimal(value: number, precision: number, decimal?: string, thousandsSeparator?: string): string;
12
14
  static compare(a: number, b: number, eps: number): number;
13
15
  static isZero(a: number): boolean;
@@ -46,6 +46,12 @@ export class MathUtils {
46
46
  // Mantissa >= 10^14 with fractions -- just round
47
47
  return Math.round(x);
48
48
  }
49
+ static formatIntegerWithSeparator(integerValue, thousandsSeparator) {
50
+ if (Math.abs(integerValue) < 1000) {
51
+ return integerValue.toString();
52
+ }
53
+ return integerValue.toString().replace(MathUtils.THOUSANDS_SEPARATOR_REGEX, `$&${thousandsSeparator}`);
54
+ }
49
55
  static makeDecimal(value, precision, decimal, thousandsSeparator) {
50
56
  if (!isFinite(value)) {
51
57
  return '';
@@ -62,7 +68,7 @@ export class MathUtils {
62
68
  let integerPart = splittedValue[0];
63
69
  const fractionPart = splittedValue[1];
64
70
  if (Math.abs(value) >= 1000) {
65
- integerPart = integerPart.replace(RegExp('\\d(?=(\\d{3})+$)', 'g'), `$&${thousandsSeparator}`);
71
+ integerPart = integerPart.replace(MathUtils.THOUSANDS_SEPARATOR_REGEX, `$&${thousandsSeparator}`);
66
72
  }
67
73
  if (fractionPart) {
68
74
  stringValue = [integerPart, fractionPart].join(decimal);
@@ -99,6 +105,7 @@ export class MathUtils {
99
105
  return /\de(\-|\+)\d/.test(a.toString());
100
106
  }
101
107
  }
108
+ MathUtils.THOUSANDS_SEPARATOR_REGEX = /\d(?=(\d{3})+$)/g;
102
109
  /**
103
110
  * Checks if first and second number are differs by specified times
104
111
  * @param first {number}