@baron1996/klinecharts-adapter 0.2.3 → 0.4.0
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/dist/adapter.d.ts +27 -2
- package/dist/adapter.d.ts.map +1 -1
- package/dist/adapter.js +638 -26
- package/dist/conversion/chart-options.d.ts +3 -1
- package/dist/conversion/chart-options.d.ts.map +1 -1
- package/dist/conversion/chart-options.js +71 -0
- package/dist/conversion/overlays.d.ts +2 -1
- package/dist/conversion/overlays.d.ts.map +1 -1
- package/dist/conversion/overlays.js +1 -1
- package/dist/conversion/price.d.ts.map +1 -1
- package/dist/conversion/price.js +10 -39
- package/dist/drawing/engine-port.d.ts +71 -0
- package/dist/drawing/engine-port.d.ts.map +1 -0
- package/dist/drawing/engine-port.js +1 -0
- package/dist/drawing/interaction-normalization.d.ts +18 -0
- package/dist/drawing/interaction-normalization.d.ts.map +1 -0
- package/dist/drawing/interaction-normalization.js +61 -0
- package/dist/drawing/kline-projection-policy.d.ts +8 -0
- package/dist/drawing/kline-projection-policy.d.ts.map +1 -0
- package/dist/drawing/kline-projection-policy.js +69 -0
- package/dist/drawing/overlay-conversion.d.ts +9 -0
- package/dist/drawing/overlay-conversion.d.ts.map +1 -0
- package/dist/drawing/overlay-conversion.js +245 -0
- package/dist/drawing/projection-policy.d.ts +34 -0
- package/dist/drawing/projection-policy.d.ts.map +1 -0
- package/dist/drawing/projection-policy.js +10 -0
- package/dist/drawing/time-series-projection-policy.d.ts +6 -0
- package/dist/drawing/time-series-projection-policy.d.ts.map +1 -0
- package/dist/drawing/time-series-projection-policy.js +28 -0
- package/dist/extensions/price-measurement.d.ts +1 -1
- package/dist/extensions/price-measurement.d.ts.map +1 -1
- package/dist/extensions/price-measurement.js +8 -2
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -0
- package/dist/main-series-presentation.d.ts +35 -0
- package/dist/main-series-presentation.d.ts.map +1 -0
- package/dist/main-series-presentation.js +52 -0
- package/dist/time-series/adapter.d.ts +41 -0
- package/dist/time-series/adapter.d.ts.map +1 -0
- package/dist/time-series/adapter.js +1189 -0
- package/dist/time-series/indicator.d.ts +15 -0
- package/dist/time-series/indicator.d.ts.map +1 -0
- package/dist/time-series/indicator.js +56 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { TimeSeriesDefinition } from '@baron1996/kline-scene-schema';
|
|
2
|
+
import type { IndicatorCreate, IndicatorTemplate } from 'klinecharts';
|
|
3
|
+
export declare const TIME_SERIES_INDICATOR_NAME = "BARON_TIME_SERIES_LINE";
|
|
4
|
+
export declare const TIME_SERIES_PANE_ID = "baron_time_series_pane";
|
|
5
|
+
export declare const TIME_SERIES_Y_AXIS_ID = "baron_time_series_y_axis";
|
|
6
|
+
interface TimeSeriesIndicatorResult {
|
|
7
|
+
readonly value: number | null;
|
|
8
|
+
}
|
|
9
|
+
interface TimeSeriesIndicatorExtendData {
|
|
10
|
+
readonly seriesId: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const timeSeriesIndicatorTemplate: IndicatorTemplate<TimeSeriesIndicatorResult, never, TimeSeriesIndicatorExtendData>;
|
|
13
|
+
export declare function toTimeSeriesIndicatorCreate(series: TimeSeriesDefinition): IndicatorCreate;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=indicator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"indicator.d.ts","sourceRoot":"","sources":["../../src/time-series/indicator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAC1E,OAAO,KAAK,EACX,eAAe,EACf,iBAAiB,EAEjB,MAAM,aAAa,CAAC;AAErB,eAAO,MAAM,0BAA0B,2BAA2B,CAAC;AACnE,eAAO,MAAM,mBAAmB,2BAA2B,CAAC;AAC5D,eAAO,MAAM,qBAAqB,6BAA6B,CAAC;AAMhE,UAAU,yBAAyB;IAClC,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AAED,UAAU,6BAA6B;IACtC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC1B;AAYD,eAAO,MAAM,2BAA2B,EAAE,iBAAiB,CAC1D,yBAAyB,EACzB,KAAK,EACL,6BAA6B,CA2B7B,CAAC;AAEF,wBAAgB,2BAA2B,CAC1C,MAAM,EAAE,oBAAoB,GAC1B,eAAe,CAiBjB"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export const TIME_SERIES_INDICATOR_NAME = 'BARON_TIME_SERIES_LINE';
|
|
2
|
+
export const TIME_SERIES_PANE_ID = 'baron_time_series_pane';
|
|
3
|
+
export const TIME_SERIES_Y_AXIS_ID = 'baron_time_series_y_axis';
|
|
4
|
+
function lineStyle(style) {
|
|
5
|
+
return {
|
|
6
|
+
color: style.color,
|
|
7
|
+
size: style.size,
|
|
8
|
+
style: style.style === 'solid' ? 'solid' : 'dashed',
|
|
9
|
+
dashedValue: style.style === 'dotted' ? [1, 2] : [4, 4],
|
|
10
|
+
smooth: false,
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export const timeSeriesIndicatorTemplate = {
|
|
14
|
+
name: TIME_SERIES_INDICATOR_NAME,
|
|
15
|
+
shortName: '',
|
|
16
|
+
series: 'normal',
|
|
17
|
+
shouldOhlc: false,
|
|
18
|
+
shouldFormatBigNumber: false,
|
|
19
|
+
figures: [{ key: 'value', type: 'line' }],
|
|
20
|
+
shouldUpdate(previous, current) {
|
|
21
|
+
const shouldCalculate = previous.extendData.seriesId !== current.extendData.seriesId ||
|
|
22
|
+
previous.visible !== current.visible;
|
|
23
|
+
return {
|
|
24
|
+
calc: shouldCalculate,
|
|
25
|
+
draw: shouldCalculate || previous.visible !== current.visible,
|
|
26
|
+
};
|
|
27
|
+
},
|
|
28
|
+
calc(dataList, indicator) {
|
|
29
|
+
if (!indicator.visible) {
|
|
30
|
+
return dataList.map(() => ({ value: null }));
|
|
31
|
+
}
|
|
32
|
+
const seriesId = indicator.extendData.seriesId;
|
|
33
|
+
return dataList.map((bar) => {
|
|
34
|
+
const values = bar.__baronTimeSeriesValues;
|
|
35
|
+
return { value: values[seriesId] ?? null };
|
|
36
|
+
});
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
export function toTimeSeriesIndicatorCreate(series) {
|
|
40
|
+
return {
|
|
41
|
+
id: `baron_time_series_${series.id}`,
|
|
42
|
+
name: TIME_SERIES_INDICATOR_NAME,
|
|
43
|
+
shortName: series.name,
|
|
44
|
+
paneId: TIME_SERIES_PANE_ID,
|
|
45
|
+
yAxisId: TIME_SERIES_Y_AXIS_ID,
|
|
46
|
+
precision: series.precision,
|
|
47
|
+
visible: series.visible,
|
|
48
|
+
zLevel: 0,
|
|
49
|
+
extendData: { seriesId: series.id },
|
|
50
|
+
styles: {
|
|
51
|
+
lines: [lineStyle(series.style)],
|
|
52
|
+
lastValueMark: { show: false },
|
|
53
|
+
tooltip: { showRule: 'none' },
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
}
|
package/dist/version.d.ts
CHANGED
package/dist/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@baron1996/klinecharts-adapter",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Controlled ChartScene adapter for KLineCharts.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@baron1996/kline-scene-schema": "0.
|
|
41
|
+
"@baron1996/kline-scene-schema": "0.4.0",
|
|
42
42
|
"klinecharts": "10.0.0"
|
|
43
43
|
}
|
|
44
44
|
}
|