wenay-react2 1.0.20 → 1.0.22
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/README.md +383 -382
- package/lib/common/api.d.ts +28 -0
- package/lib/common/api.js +41 -16
- package/lib/common/src/components/Buttons/MiniButton.d.ts +1 -0
- package/lib/common/src/components/Buttons/MiniButton.js +2 -2
- package/lib/common/src/components/Dnd/DraggableOutlineDiv.d.ts +1 -0
- package/lib/common/src/components/Dnd/DraggableOutlineDiv.js +7 -6
- package/lib/common/src/components/Dnd/RNDFunc.js +28 -17
- package/lib/common/src/components/Dnd/RNDFunc3.d.ts +27 -17
- package/lib/common/src/components/Dnd/RNDFunc3.js +107 -105
- package/lib/common/src/components/Dnd/Resizable.js +3 -3
- package/lib/common/src/components/Menu/RightMenu.js +11 -17
- package/lib/common/src/components/Menu/StickerMenu.js +42 -28
- package/lib/common/src/components/Menu/index.d.ts +1 -1
- package/lib/common/src/components/Menu/index.js +1 -1
- package/lib/common/src/components/Modal/LeftModal.d.ts +14 -12
- package/lib/common/src/components/Modal/LeftModal.js +30 -16
- package/lib/common/src/components/Modal/Modal.d.ts +26 -12
- package/lib/common/src/components/Modal/Modal.js +66 -89
- package/lib/common/src/components/Modal/ModalContextProvider.d.ts +20 -3
- package/lib/common/src/components/Modal/ModalContextProvider.js +35 -8
- package/lib/common/src/components/MyResizeObserver.js +15 -18
- package/lib/common/src/components/Other.js +3 -2
- package/lib/common/src/components/Parameters.js +7 -6
- package/lib/common/src/components/ParametersEngine.js +25 -54
- package/lib/common/src/grid/agGrid4/agGrid4.d.ts +53 -0
- package/lib/common/src/grid/agGrid4/agGrid4.js +132 -0
- package/lib/common/src/grid/agGrid4/core.d.ts +56 -0
- package/lib/common/src/grid/agGrid4/core.js +127 -0
- package/lib/common/src/grid/agGrid4/index.d.ts +6 -0
- package/lib/common/src/grid/agGrid4/index.js +3 -0
- package/lib/common/src/grid/agGrid4/theme.d.ts +7 -0
- package/lib/common/src/grid/agGrid4/theme.js +18 -0
- package/lib/common/src/hooks/useAddDownAnyKey.d.ts +21 -2
- package/lib/common/src/hooks/useAddDownAnyKey.js +46 -8
- package/lib/common/src/hooks/useDraggable.d.ts +20 -2
- package/lib/common/src/hooks/useDraggable.js +146 -115
- package/lib/common/src/hooks/useOutside.d.ts +24 -4
- package/lib/common/src/hooks/useOutside.js +76 -27
- package/lib/common/src/logs/logs.d.ts +5 -2
- package/lib/common/src/logs/logs.js +15 -31
- package/lib/common/src/logs/logs3.d.ts +9 -9
- package/lib/common/src/logs/logs3.js +47 -38
- package/lib/common/src/logs/miniLogs.d.ts +3 -3
- package/lib/common/src/logs/miniLogs.js +28 -36
- package/lib/common/src/menu/menu.d.ts +18 -18
- package/lib/common/src/menu/menu.js +48 -24
- package/lib/common/src/menu/menuMouse.js +4 -1
- package/lib/common/src/menu/menuR.d.ts +2 -2
- package/lib/common/src/menu/menuR.js +34 -34
- package/lib/common/src/myChart/1/myChart.d.ts +5 -5
- package/lib/common/src/myChart/1/myChart.js +58 -47
- package/lib/common/src/myChart/1/myChartTest.js +8 -4
- package/lib/common/src/myChart/chartEngine/chartEngineReact.d.ts +24 -27
- package/lib/common/src/myChart/chartEngine/chartEngineReact.js +166 -117
- package/lib/common/src/styles/styleGrid.d.ts +2 -1
- package/lib/common/src/styles/styleGrid.js +10 -12
- package/lib/common/src/styles/tokens.d.ts +39 -0
- package/lib/common/src/styles/tokens.js +40 -0
- package/lib/common/src/utils/applyTransactionAsyncUpdate.d.ts +7 -0
- package/lib/common/src/utils/applyTransactionAsyncUpdate.js +19 -12
- package/lib/common/src/utils/arrayPromise.d.ts +6 -0
- package/lib/common/src/utils/arrayPromise.js +7 -1
- package/lib/common/src/utils/cache.js +24 -21
- package/lib/common/src/utils/inputAutoStep.d.ts +1 -1
- package/lib/common/src/utils/inputAutoStep.js +30 -19
- package/lib/common/src/utils/mapMemory.js +9 -10
- package/lib/common/updateBy.d.ts +21 -2
- package/lib/common/updateBy.js +66 -31
- package/lib/index.js +0 -2
- package/lib/style/menuRight.css +13 -26
- package/lib/style/style.css +51 -39
- package/lib/style/tokens.css +34 -0
- package/package.json +2 -2
|
@@ -1,17 +1,21 @@
|
|
|
1
|
+
// Chart margins and line color (same values, extracted from the render body)
|
|
2
|
+
const CHART_MARGIN_TOP = 20;
|
|
3
|
+
const CHART_MARGIN_BOTTOM = 20;
|
|
4
|
+
const CHART_LINE_COLOR = "rgb(0,180,0)";
|
|
1
5
|
/**
|
|
2
|
-
*
|
|
6
|
+
* Creates a functional canvas with wheel zoom support.
|
|
3
7
|
*/
|
|
4
8
|
export function createChartCanvas(config) {
|
|
5
|
-
//
|
|
9
|
+
// Create <canvas> and insert it into container
|
|
6
10
|
const canvas = document.createElement("canvas");
|
|
7
11
|
config.container.appendChild(canvas);
|
|
8
|
-
//
|
|
12
|
+
// State captured in the closure
|
|
9
13
|
let state = {
|
|
10
14
|
width: (config.width ?? config.container.offsetWidth) || 800,
|
|
11
15
|
height: (config.height ?? config.container.offsetHeight) || 400,
|
|
12
16
|
data: [],
|
|
13
17
|
offsetX: 0,
|
|
14
|
-
scaleX: 5, //
|
|
18
|
+
scaleX: 5, // pixels per step (point index)
|
|
15
19
|
autoScaleY: config.autoScaleY ?? true,
|
|
16
20
|
showTimeAxis: config.showTimeAxis ?? true,
|
|
17
21
|
showPriceAxis: config.showPriceAxis ?? true,
|
|
@@ -28,7 +32,7 @@ export function createChartCanvas(config) {
|
|
|
28
32
|
state.needsRender = true;
|
|
29
33
|
}
|
|
30
34
|
resizeCanvas();
|
|
31
|
-
// ~~~
|
|
35
|
+
// ~~~ Rendering ~~~
|
|
32
36
|
function draw() {
|
|
33
37
|
if (!state.needsRender)
|
|
34
38
|
return;
|
|
@@ -38,7 +42,7 @@ export function createChartCanvas(config) {
|
|
|
38
42
|
drawAxes();
|
|
39
43
|
return;
|
|
40
44
|
}
|
|
41
|
-
//
|
|
45
|
+
// Calculate which data indexes are visible on screen
|
|
42
46
|
const minIndex = Math.floor(-state.offsetX / state.scaleX);
|
|
43
47
|
const maxIndex = Math.ceil((state.width - state.offsetX) / state.scaleX);
|
|
44
48
|
const startIndex = Math.max(0, minIndex);
|
|
@@ -47,29 +51,23 @@ export function createChartCanvas(config) {
|
|
|
47
51
|
drawAxes();
|
|
48
52
|
return;
|
|
49
53
|
}
|
|
50
|
-
//
|
|
51
|
-
let minY =
|
|
52
|
-
let maxY =
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
if (!state.autoScaleY) {
|
|
66
|
-
// Допустим, зафиксируем 0..100, если не хотим авто
|
|
67
|
-
minY = 0;
|
|
68
|
-
maxY = 100;
|
|
54
|
+
// Fixed 0..100 range unless auto scaling; the scan runs only when its result is used
|
|
55
|
+
let minY = 0;
|
|
56
|
+
let maxY = 100;
|
|
57
|
+
if (state.autoScaleY) {
|
|
58
|
+
minY = Infinity;
|
|
59
|
+
maxY = -Infinity;
|
|
60
|
+
for (let i = startIndex; i <= endIndex; i++) {
|
|
61
|
+
const p = state.data[i];
|
|
62
|
+
if (p.price < minY)
|
|
63
|
+
minY = p.price;
|
|
64
|
+
if (p.price > maxY)
|
|
65
|
+
maxY = p.price;
|
|
66
|
+
}
|
|
69
67
|
}
|
|
70
68
|
const rangeY = maxY - minY || 1;
|
|
71
|
-
const marginTop =
|
|
72
|
-
const marginBottom = state.showTimeAxis ?
|
|
69
|
+
const marginTop = CHART_MARGIN_TOP;
|
|
70
|
+
const marginBottom = state.showTimeAxis ? CHART_MARGIN_BOTTOM : 0;
|
|
73
71
|
const chartHeight = state.height - marginTop - marginBottom;
|
|
74
72
|
function toScreenX(i) {
|
|
75
73
|
return i * state.scaleX + state.offsetX;
|
|
@@ -77,7 +75,7 @@ export function createChartCanvas(config) {
|
|
|
77
75
|
function toScreenY(price) {
|
|
78
76
|
return marginTop + chartHeight - ((price - minY) / rangeY) * chartHeight;
|
|
79
77
|
}
|
|
80
|
-
//
|
|
78
|
+
// Draw the line
|
|
81
79
|
ctx.beginPath();
|
|
82
80
|
let first = true;
|
|
83
81
|
for (let i = startIndex; i <= endIndex; i++) {
|
|
@@ -92,10 +90,10 @@ export function createChartCanvas(config) {
|
|
|
92
90
|
ctx.lineTo(x, y);
|
|
93
91
|
}
|
|
94
92
|
}
|
|
95
|
-
ctx.strokeStyle =
|
|
93
|
+
ctx.strokeStyle = CHART_LINE_COLOR;
|
|
96
94
|
ctx.lineWidth = 2;
|
|
97
95
|
ctx.stroke();
|
|
98
|
-
//
|
|
96
|
+
// Draw axes and labels
|
|
99
97
|
drawAxes(minY, maxY, startIndex, endIndex, toScreenX, toScreenY);
|
|
100
98
|
}
|
|
101
99
|
function drawAxes(minY, maxY, startIndex, endIndex, toX, toY) {
|
|
@@ -103,13 +101,13 @@ export function createChartCanvas(config) {
|
|
|
103
101
|
ctx.strokeStyle = "rgba(0,0,0,0.4)";
|
|
104
102
|
ctx.fillStyle = "rgba(0,0,0,0.6)";
|
|
105
103
|
ctx.font = "12px sans-serif";
|
|
106
|
-
//
|
|
104
|
+
// X axis (bottom)
|
|
107
105
|
if (state.showTimeAxis) {
|
|
108
106
|
ctx.beginPath();
|
|
109
107
|
ctx.moveTo(0, state.height - 0.5);
|
|
110
108
|
ctx.lineTo(state.width, state.height - 0.5);
|
|
111
109
|
ctx.stroke();
|
|
112
|
-
//
|
|
110
|
+
// Time labels
|
|
113
111
|
if (startIndex != null && endIndex != null && toX) {
|
|
114
112
|
const step = Math.max(1, Math.floor((endIndex - startIndex) / 5));
|
|
115
113
|
for (let i = startIndex; i <= endIndex; i += step) {
|
|
@@ -126,7 +124,7 @@ export function createChartCanvas(config) {
|
|
|
126
124
|
}
|
|
127
125
|
}
|
|
128
126
|
}
|
|
129
|
-
//
|
|
127
|
+
// Y axis (left)
|
|
130
128
|
if (state.showPriceAxis) {
|
|
131
129
|
ctx.beginPath();
|
|
132
130
|
ctx.moveTo(0.5, 0);
|
|
@@ -135,12 +133,12 @@ export function createChartCanvas(config) {
|
|
|
135
133
|
if (minY !== undefined && maxY !== undefined && toY) {
|
|
136
134
|
const yMin = toY(minY);
|
|
137
135
|
const yMax = toY(maxY);
|
|
138
|
-
ctx.fillText(
|
|
136
|
+
ctx.fillText(minY.toFixed(2), 5, yMin - 2);
|
|
139
137
|
ctx.beginPath();
|
|
140
138
|
ctx.moveTo(0, yMin);
|
|
141
139
|
ctx.lineTo(5, yMin);
|
|
142
140
|
ctx.stroke();
|
|
143
|
-
ctx.fillText(
|
|
141
|
+
ctx.fillText(maxY.toFixed(2), 5, yMax - 2);
|
|
144
142
|
ctx.beginPath();
|
|
145
143
|
ctx.moveTo(0, yMax);
|
|
146
144
|
ctx.lineTo(5, yMax);
|
|
@@ -152,20 +150,33 @@ export function createChartCanvas(config) {
|
|
|
152
150
|
let animationFrameId = null;
|
|
153
151
|
let destroyed = false;
|
|
154
152
|
let docListenersActive = false;
|
|
153
|
+
// temp-detach (portal, node move) is not a reason to self-destroy: wait for reconnect
|
|
154
|
+
// with a grace period; a real unmount without destroy() is handled by timeout auto-cleanup
|
|
155
|
+
const DETACH_DESTROY_MS = 10_000;
|
|
156
|
+
let disconnectedSince = null;
|
|
155
157
|
function animate() {
|
|
156
158
|
if (destroyed)
|
|
157
159
|
return;
|
|
158
160
|
if (!canvas.isConnected) {
|
|
159
|
-
|
|
161
|
+
disconnectedSince ??= performance.now();
|
|
162
|
+
if (performance.now() - disconnectedSince > DETACH_DESTROY_MS) {
|
|
163
|
+
destroy();
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
animationFrameId = requestAnimationFrame(animate);
|
|
160
167
|
return;
|
|
161
168
|
}
|
|
169
|
+
if (disconnectedSince != null) {
|
|
170
|
+
disconnectedSince = null;
|
|
171
|
+
state.needsRender = true; // force redraw after reconnect
|
|
172
|
+
}
|
|
162
173
|
if (state.needsRender) {
|
|
163
174
|
draw();
|
|
164
175
|
}
|
|
165
176
|
animationFrameId = requestAnimationFrame(animate);
|
|
166
177
|
}
|
|
167
178
|
animate();
|
|
168
|
-
// ~~~
|
|
179
|
+
// ~~~ API methods ~~~
|
|
169
180
|
function appendData(points) {
|
|
170
181
|
if (!Array.isArray(points))
|
|
171
182
|
points = [points];
|
|
@@ -182,15 +193,15 @@ export function createChartCanvas(config) {
|
|
|
182
193
|
state.needsRender = true;
|
|
183
194
|
}
|
|
184
195
|
function zoomX(factor, centerPx = state.width / 2) {
|
|
185
|
-
//
|
|
196
|
+
// Determine which index is currently under centerPx
|
|
186
197
|
const i = (centerPx - state.offsetX) / state.scaleX;
|
|
187
198
|
state.scaleX *= factor;
|
|
188
|
-
//
|
|
199
|
+
// Clamp scale
|
|
189
200
|
if (state.scaleX < 0.1)
|
|
190
201
|
state.scaleX = 0.1;
|
|
191
202
|
if (state.scaleX > 2000)
|
|
192
203
|
state.scaleX = 2000;
|
|
193
|
-
//
|
|
204
|
+
// Shift offsetX so the same point stays under the cursor
|
|
194
205
|
state.offsetX = centerPx - i * state.scaleX;
|
|
195
206
|
state.needsRender = true;
|
|
196
207
|
}
|
|
@@ -226,11 +237,11 @@ export function createChartCanvas(config) {
|
|
|
226
237
|
state.needsRender = true;
|
|
227
238
|
}
|
|
228
239
|
function drawManually() {
|
|
229
|
-
//
|
|
240
|
+
// Force render call
|
|
230
241
|
state.needsRender = true;
|
|
231
242
|
draw();
|
|
232
243
|
}
|
|
233
|
-
// ~~~
|
|
244
|
+
// ~~~ Mouse events ~~~
|
|
234
245
|
const addDocListeners = () => {
|
|
235
246
|
if (docListenersActive)
|
|
236
247
|
return;
|
|
@@ -254,18 +265,18 @@ export function createChartCanvas(config) {
|
|
|
254
265
|
if (state.isDragging) {
|
|
255
266
|
const dx = e.clientX - state.lastDragX;
|
|
256
267
|
state.lastDragX = e.clientX;
|
|
257
|
-
scrollX(dx); //
|
|
268
|
+
scrollX(dx); // drag the chart
|
|
258
269
|
}
|
|
259
270
|
};
|
|
260
271
|
const onMouseUp = () => {
|
|
261
272
|
state.isDragging = false;
|
|
262
273
|
removeDocListeners();
|
|
263
274
|
};
|
|
264
|
-
// ===>
|
|
275
|
+
// ===> Bind zoom to mouse wheel <===
|
|
265
276
|
const onWheel = (e) => {
|
|
266
277
|
e.preventDefault();
|
|
267
|
-
// e.deltaY > 0 =>
|
|
268
|
-
// e.deltaY < 0 =>
|
|
278
|
+
// e.deltaY > 0 => wheel down => factor < 1 => zoom out
|
|
279
|
+
// e.deltaY < 0 => wheel up => factor > 1 => zoom in
|
|
269
280
|
const factor = e.deltaY < 0 ? 1.1 : 0.9;
|
|
270
281
|
const rect = canvas.getBoundingClientRect();
|
|
271
282
|
const mouseX = e.clientX - rect.left;
|
|
@@ -288,7 +299,7 @@ export function createChartCanvas(config) {
|
|
|
288
299
|
canvas.parentElement.removeChild(canvas);
|
|
289
300
|
}
|
|
290
301
|
}
|
|
291
|
-
//
|
|
302
|
+
// Build and return API
|
|
292
303
|
return {
|
|
293
304
|
appendData,
|
|
294
305
|
clearData,
|
|
@@ -7,7 +7,7 @@ export function ChartDemo() {
|
|
|
7
7
|
useEffect(() => {
|
|
8
8
|
if (!containerRef.current)
|
|
9
9
|
return;
|
|
10
|
-
//
|
|
10
|
+
// Create chart
|
|
11
11
|
const chart = createChartCanvas({
|
|
12
12
|
container: containerRef.current,
|
|
13
13
|
width: 600,
|
|
@@ -17,7 +17,7 @@ export function ChartDemo() {
|
|
|
17
17
|
showPriceAxis: true,
|
|
18
18
|
});
|
|
19
19
|
chartRef.current = chart;
|
|
20
|
-
//
|
|
20
|
+
// Add test data
|
|
21
21
|
const now = Date.now();
|
|
22
22
|
const demoData = [];
|
|
23
23
|
for (let i = 0; i < 50; i++) {
|
|
@@ -28,7 +28,7 @@ export function ChartDemo() {
|
|
|
28
28
|
}
|
|
29
29
|
chart.appendData(demoData);
|
|
30
30
|
chart.jumpToEnd();
|
|
31
|
-
//
|
|
31
|
+
// Example of streaming new points
|
|
32
32
|
const timer = setInterval(() => {
|
|
33
33
|
const last = demoData[demoData.length - 1];
|
|
34
34
|
const newPoint = {
|
|
@@ -39,7 +39,11 @@ export function ChartDemo() {
|
|
|
39
39
|
chart.appendData(newPoint);
|
|
40
40
|
// optional: chart.jumpToEnd();
|
|
41
41
|
}, 2000);
|
|
42
|
-
return () =>
|
|
42
|
+
return () => {
|
|
43
|
+
clearInterval(timer);
|
|
44
|
+
chart.destroy();
|
|
45
|
+
chartRef.current = null;
|
|
46
|
+
};
|
|
43
47
|
}, []);
|
|
44
48
|
return (_jsxs("div", { style: { padding: 20 }, children: [_jsx("h2", { children: "Chart with Wheel Zoom" }), _jsx("div", { ref: containerRef, style: { border: "1px solid black", width: 620, height: 320 } }), _jsxs("div", { style: { marginTop: 10 }, children: [_jsx("button", { onClick: () => chartRef.current?.zoomX(1.1), children: "Zoom In" }), _jsx("button", { onClick: () => chartRef.current?.zoomX(0.9), children: "Zoom Out" }), _jsx("button", { onClick: () => chartRef.current?.scrollX(50), children: "Scroll Left" }), _jsx("button", { onClick: () => chartRef.current?.scrollX(-50), children: "Scroll Right" }), _jsx("button", { onClick: () => chartRef.current?.jumpToStart(), children: "Start" }), _jsx("button", { onClick: () => chartRef.current?.jumpToEnd(), children: "End" })] })] }));
|
|
45
49
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/*************************************************************
|
|
2
2
|
* chartEngine.tsx
|
|
3
|
-
*
|
|
4
|
-
* -
|
|
5
|
-
* -
|
|
6
|
-
* -
|
|
3
|
+
* Updated example where:
|
|
4
|
+
* - Panel width = 100% of Canvas
|
|
5
|
+
* - Panel height is defined in percent (heightPct)
|
|
6
|
+
* - The last panel always fills up to 100%
|
|
7
7
|
*************************************************************/
|
|
8
8
|
import React from 'react';
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
10
|
+
* Base data types
|
|
11
11
|
*/
|
|
12
12
|
export interface DataPoint {
|
|
13
13
|
x: number;
|
|
@@ -48,7 +48,7 @@ export interface CreateDataSetParams {
|
|
|
48
48
|
chunkSize?: number;
|
|
49
49
|
}
|
|
50
50
|
/**
|
|
51
|
-
*
|
|
51
|
+
* DataSet factory
|
|
52
52
|
*/
|
|
53
53
|
export declare function createDataSet(params: CreateDataSetParams): DataSet;
|
|
54
54
|
/**
|
|
@@ -65,7 +65,7 @@ export interface DataModel {
|
|
|
65
65
|
export declare function createDataModel(): DataModel;
|
|
66
66
|
/**
|
|
67
67
|
* PanelManager
|
|
68
|
-
*
|
|
68
|
+
* Use heightPct (percent) instead of pixel height.
|
|
69
69
|
*/
|
|
70
70
|
export interface Panel {
|
|
71
71
|
id: string;
|
|
@@ -82,22 +82,23 @@ export interface Panel {
|
|
|
82
82
|
autoFocusY: boolean;
|
|
83
83
|
resizable?: boolean;
|
|
84
84
|
}
|
|
85
|
+
export interface PanelConfig {
|
|
86
|
+
id: string;
|
|
87
|
+
/** Height percent: 0..100; the last panel fills the remainder */
|
|
88
|
+
heightPct?: number;
|
|
89
|
+
dataSets: DataSet[];
|
|
90
|
+
autoFocusY?: boolean;
|
|
91
|
+
resizable?: boolean;
|
|
92
|
+
}
|
|
85
93
|
export interface PanelManager {
|
|
86
94
|
panels: Panel[];
|
|
87
|
-
addPanel(config:
|
|
88
|
-
id: string;
|
|
89
|
-
/** Процент высоты: 0..100, последняя панель добирает остаток */
|
|
90
|
-
heightPct?: number;
|
|
91
|
-
dataSets: DataSet[];
|
|
92
|
-
autoFocusY?: boolean;
|
|
93
|
-
resizable?: boolean;
|
|
94
|
-
}): void;
|
|
95
|
+
addPanel(config: PanelConfig): void;
|
|
95
96
|
layoutPanels(containerWidth: number, containerHeight: number): void;
|
|
96
97
|
resizePanel(panelId: string, deltaPx: number, containerHeight: number): void;
|
|
97
98
|
}
|
|
98
99
|
export declare function createPanelManager(): PanelManager;
|
|
99
100
|
/**
|
|
100
|
-
* Renderer (
|
|
101
|
+
* Renderer (right Y axis, LOD for lines)
|
|
101
102
|
*/
|
|
102
103
|
export interface Renderer {
|
|
103
104
|
drawPanel(ctx: CanvasRenderingContext2D, panel: Panel, transform: Transform, globalTimeRange: {
|
|
@@ -138,27 +139,23 @@ export interface ChartEngine {
|
|
|
138
139
|
destroy(): void;
|
|
139
140
|
attachToContainer(container: HTMLElement): void;
|
|
140
141
|
createDataSet(params: CreateDataSetParams): DataSet;
|
|
141
|
-
addPanel(config:
|
|
142
|
-
id: string;
|
|
143
|
-
dataSets: DataSet[];
|
|
144
|
-
heightPct?: number;
|
|
145
|
-
autoFocusY?: boolean;
|
|
146
|
-
resizable?: boolean;
|
|
147
|
-
}): void;
|
|
142
|
+
addPanel(config: PanelConfig): void;
|
|
148
143
|
canvas: HTMLCanvasElement;
|
|
149
144
|
dataModel: DataModel;
|
|
150
145
|
panelManager: PanelManager;
|
|
151
146
|
renderer: Renderer;
|
|
152
147
|
}
|
|
153
148
|
/**
|
|
154
|
-
*
|
|
149
|
+
* Engine factory function
|
|
155
150
|
*/
|
|
156
151
|
export declare function createChartEngine(canvas: HTMLCanvasElement): ChartEngine;
|
|
157
152
|
/**
|
|
158
|
-
*
|
|
153
|
+
* Data generation example
|
|
159
154
|
*/
|
|
160
155
|
export declare function generateIncrementalData(startX: number, count: number, startY: number, maxDelta: number): DataPoint[];
|
|
161
156
|
/**
|
|
162
|
-
*
|
|
157
|
+
* MyChart React component example
|
|
163
158
|
*/
|
|
164
|
-
export declare const MyChartEngine: React.FC
|
|
159
|
+
export declare const MyChartEngine: React.FC<{
|
|
160
|
+
style?: React.CSSProperties;
|
|
161
|
+
}>;
|