Skip to content

Commit 23e9a6e

Browse files
authored
Merge pull request tradingview#1945 from tradingview/feature/conflate-bars
Data conflation
2 parents 6733cba + 382e27a commit 23e9a6e

23 files changed

+2184
-15
lines changed

.size-limit.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export default [
88
{
99
name: 'ESM',
1010
path: 'dist/lightweight-charts.production.mjs',
11-
limit: '47.50 KB',
11+
limit: '49.50 KB',
1212
import: '*',
1313
ignore: ['fancy-canvas'],
1414
brotli: true,
@@ -48,14 +48,14 @@ export default [
4848
{
4949
name: 'Standalone-ESM',
5050
path: 'dist/lightweight-charts.standalone.production.mjs',
51-
limit: '50.00 KB',
51+
limit: '51.00 KB',
5252
import: '*',
5353
brotli: true,
5454
},
5555
{
5656
name: 'Standalone',
5757
path: 'dist/lightweight-charts.standalone.production.js',
58-
limit: '50.00 KB',
58+
limit: '51.00 KB',
5959
brotli: true,
6060
},
6161
{
@@ -87,7 +87,7 @@ export default [
8787
path: 'dist/lightweight-charts.production.mjs',
8888
import: '{ LineSeries }',
8989
ignore: ['fancy-canvas'],
90-
limit: '2.7 KB',
90+
limit: '2.8 KB',
9191
brotli: true,
9292
},
9393
{

src/api/options/time-scale-options-defaults.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,8 @@ export const timeScaleOptionsDefaults: HorzScaleOptions = {
2121
minimumHeight: 0,
2222
allowBoldLabels: true,
2323
ignoreWhitespaceIndices: false,
24+
enableConflation: false,
25+
conflationThresholdFactor: 1,
26+
precomputeConflationOnInit: false,
27+
precomputeConflationPriority: 'background',
2428
};

src/model/conflation/constants.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/**
2+
* Power-of-2 conflation levels supported by the system.
3+
* These represent the number of original data points that get merged into one conflated point.
4+
*/
5+
export const CONFLATION_LEVELS = [2, 4, 8, 16, 32, 64, 128, 256, 512] as const;
6+
7+
/**
8+
* Maximum conflation level supported.
9+
*/
10+
export const MAX_CONFLATION_LEVEL = 512;
11+
12+
/**
13+
* Device pixel ratio threshold for conflation.
14+
* Conflation happens when barSpacing is less than 1.0 / devicePixelRatio.
15+
* This ensures we only conflate when we can't physically display the detail.
16+
*/
17+
export const DPR_CONFLATION_THRESHOLD = 1;
18+
19+
export const CONFLATION_ERROR_MESSAGES = {
20+
missingPriceValueBuilder: 'Custom series with conflation reducer must have a priceValueBuilder method',
21+
} as const;

0 commit comments

Comments
 (0)