@operato/scene-scichart 7.0.2 → 7.0.3

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 (69) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/db.sqlite +0 -0
  3. package/dist/charts/ox-scichart.d.ts +2 -1
  4. package/dist/charts/ox-scichart.js +20 -9
  5. package/dist/charts/ox-scichart.js.map +1 -1
  6. package/dist/index.d.ts +0 -2
  7. package/dist/index.js +0 -2
  8. package/dist/index.js.map +1 -1
  9. package/dist/templates/index.d.ts +51 -0
  10. package/dist/templates/index.js +1 -3
  11. package/dist/templates/index.js.map +1 -1
  12. package/icons/scichart-timeseries.png +0 -0
  13. package/logs/.08636eb59927f12972f6774f5947c8507b3564c2-audit.json +35 -0
  14. package/logs/.5e5d741d8b7784a2fbad65eedc0fd46946aaf6f2-audit.json +15 -0
  15. package/logs/application-2024-07-05-16.log +106 -0
  16. package/logs/application-2024-07-05-19.log +1 -0
  17. package/logs/application-2024-07-05-20.log +5 -0
  18. package/logs/application-2024-07-05-21.log +1 -0
  19. package/logs/application-2024-07-05-22.log +105 -0
  20. package/logs/application-2024-07-05-23.log +1 -0
  21. package/logs/application-2024-07-06-00.log +105 -0
  22. package/logs/connections-2024-07-05-16.log +50 -0
  23. package/logs/connections-2024-07-05-22.log +50 -0
  24. package/logs/connections-2024-07-06-00.log +50 -0
  25. package/logs/system/.ff447eb42e255d0436b200b50a92dc6546166b36-audit.json +25 -0
  26. package/logs/system/scenario-/353/251/224/354/235/270 /354/247/221/354/247/204/352/270/260 /354/204/274/354/213/261 /353/215/260/354/235/264/355/204/260 /354/241/260/355/232/214 - /354/213/244/354/213/234/352/260/204-2024-07-05-16.log" +7 -0
  27. package/logs/system/scenario-/353/251/224/354/235/270 /354/247/221/354/247/204/352/270/260 /354/204/274/354/213/261 /353/215/260/354/235/264/355/204/260 /354/241/260/355/232/214 - /354/213/244/354/213/234/352/260/204-2024-07-05-19.log" +7 -0
  28. package/logs/system/scenario-/353/251/224/354/235/270 /354/247/221/354/247/204/352/270/260 /354/204/274/354/213/261 /353/215/260/354/235/264/355/204/260 /354/241/260/355/232/214 - /354/213/244/354/213/234/352/260/204-2024-07-05-20.log" +35 -0
  29. package/logs/system/scenario-/353/251/224/354/235/270 /354/247/221/354/247/204/352/270/260 /354/204/274/354/213/261 /353/215/260/354/235/264/355/204/260 /354/241/260/355/232/214 - /354/213/244/354/213/234/352/260/204-2024-07-05-21.log" +7 -0
  30. package/logs/system/scenario-/353/251/224/354/235/270 /354/247/221/354/247/204/352/270/260 /354/204/274/354/213/261 /353/215/260/354/235/264/355/204/260 /354/241/260/355/232/214 - /354/213/244/354/213/234/352/260/204-2024-07-05-23.log" +7 -0
  31. package/package.json +2 -2
  32. package/src/charts/ox-scichart.ts +18 -8
  33. package/src/index.ts +0 -2
  34. package/src/templates/index.ts +1 -3
  35. package/tsconfig.tsbuildinfo +1 -1
  36. package/dist/charts/sci-candle-stick-chart.d.ts +0 -19
  37. package/dist/charts/sci-candle-stick-chart.js +0 -249
  38. package/dist/charts/sci-candle-stick-chart.js.map +0 -1
  39. package/dist/charts/volume-pallette-provider.d.ts +0 -12
  40. package/dist/charts/volume-pallette-provider.js +0 -21
  41. package/dist/charts/volume-pallette-provider.js.map +0 -1
  42. package/dist/data/binance-rest-client.d.ts +0 -14
  43. package/dist/data/binance-rest-client.js +0 -53
  44. package/dist/data/binance-rest-client.js.map +0 -1
  45. package/dist/scichart-candle-stick.d.ts +0 -10
  46. package/dist/scichart-candle-stick.js +0 -50
  47. package/dist/scichart-candle-stick.js.map +0 -1
  48. package/dist/scichart.d.ts +0 -21
  49. package/dist/scichart.js +0 -72
  50. package/dist/scichart.js.map +0 -1
  51. package/dist/templates/scichart-candle-stick.d.ts +0 -14
  52. package/dist/templates/scichart-candle-stick.js +0 -16
  53. package/dist/templates/scichart-candle-stick.js.map +0 -1
  54. package/dist/templates/scichart.d.ts +0 -14
  55. package/dist/templates/scichart.js +0 -16
  56. package/dist/templates/scichart.js.map +0 -1
  57. package/dist/themes/app-theme.d.ts +0 -56
  58. package/dist/themes/app-theme.js +0 -35
  59. package/dist/themes/app-theme.js.map +0 -1
  60. package/icons/scichart-candle-stick.png +0 -0
  61. package/icons/scichart.png +0 -0
  62. package/src/charts/sci-candle-stick-chart.ts +0 -306
  63. package/src/charts/volume-pallette-provider.ts +0 -41
  64. package/src/data/binance-rest-client.ts +0 -74
  65. package/src/scichart-candle-stick.ts +0 -60
  66. package/src/scichart.ts +0 -90
  67. package/src/templates/scichart-candle-stick.ts +0 -16
  68. package/src/templates/scichart.ts +0 -16
  69. package/src/themes/app-theme.ts +0 -72
@@ -1,19 +0,0 @@
1
- import { LitElement, PropertyValues, PropertyValueMap } from 'lit';
2
- import { SciChartSurface, FastCandlestickRenderableSeries, SciChartOverview, FastOhlcRenderableSeries } from 'scichart';
3
- export declare class SciCandleStockChart extends LitElement {
4
- static styles: import("lit").CSSResult[];
5
- render(): import("lit-html").TemplateResult<1>;
6
- seriesType: 'candle-stick' | 'ohlc';
7
- candlestickChartSeries: FastCandlestickRenderableSeries;
8
- ohlcChartSeries: FastOhlcRenderableSeries;
9
- sciChartSurface?: SciChartSurface;
10
- sciChartOverview?: SciChartOverview;
11
- chart: HTMLDivElement;
12
- overview: HTMLDivElement;
13
- disconnectedCallback(): void;
14
- protected firstUpdated(_changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): Promise<void>;
15
- updated(changes: PropertyValues<this>): void;
16
- private getOverviewSeries;
17
- private getTooltipLegendTemplate;
18
- private build;
19
- }
@@ -1,249 +0,0 @@
1
- import { __decorate } from "tslib";
2
- import { LitElement, css, html } from 'lit';
3
- import { customElement, property, query, state } from 'lit/decorators.js';
4
- import { SciChartSurface, NumberRange, NumericAxis, OhlcDataSeries, FastCandlestickRenderableSeries, ZoomPanModifier, ZoomExtentsModifier, MouseWheelZoomModifier, ENumericFormat, DateTimeNumericAxis, EAutoRange, FastLineRenderableSeries, XyMovingAverageFilter, SciChartOverview, CursorModifier, EDataSeriesType, ESeriesType, FastMountainRenderableSeries, GradientParams, Point, FastColumnRenderableSeries, XyDataSeries, FastOhlcRenderableSeries } from 'scichart';
5
- import { appTheme } from '../themes/app-theme';
6
- import { VolumePaletteProvider } from './volume-pallette-provider';
7
- import { simpleBinanceRestClient } from '../data/binance-rest-client';
8
- const Y_AXIS_VOLUME_ID = 'Y_AXIS_VOLUME_ID';
9
- SciChartSurface.UseCommunityLicense();
10
- SciChartSurface.configure({
11
- dataUrl: `/node_modules/scichart/_wasm/scichart2d.data`,
12
- wasmUrl: `/node_modules/scichart/_wasm/scichart2d.wasm`
13
- });
14
- let SciCandleStockChart = class SciCandleStockChart extends LitElement {
15
- constructor() {
16
- super(...arguments);
17
- this.seriesType = 'candle-stick';
18
- }
19
- render() {
20
- return html `
21
- <div id="chart"></div>
22
- <div id="overview"></div>
23
- `;
24
- }
25
- disconnectedCallback() {
26
- if (this.sciChartSurface) {
27
- this.sciChartSurface.delete();
28
- this.sciChartOverview.delete();
29
- this.sciChartSurface = undefined;
30
- this.sciChartOverview = undefined;
31
- return;
32
- }
33
- }
34
- async firstUpdated(_changedProperties) {
35
- const { sciChartSurface, overview, candlestickSeries, ohlcSeries } = await this.build();
36
- this.candlestickChartSeries = candlestickSeries;
37
- this.ohlcChartSeries = ohlcSeries;
38
- this.sciChartSurface = sciChartSurface;
39
- this.sciChartOverview = overview;
40
- this.candlestickChartSeries.isVisible = this.seriesType == 'candle-stick';
41
- this.ohlcChartSeries.isVisible = this.seriesType == 'ohlc';
42
- }
43
- updated(changes) {
44
- if (changes.has('seriesType') && this.candlestickChartSeries) {
45
- this.candlestickChartSeries.isVisible = this.seriesType == 'candle-stick';
46
- this.ohlcChartSeries.isVisible = this.seriesType == 'ohlc';
47
- }
48
- }
49
- // Override the Renderableseries to display on the scichart overview
50
- getOverviewSeries(defaultSeries) {
51
- if (defaultSeries.type === ESeriesType.CandlestickSeries) {
52
- // Swap the default candlestick series on the overview chart for a mountain series. Same data
53
- return new FastMountainRenderableSeries(defaultSeries.parentSurface.webAssemblyContext2D, {
54
- dataSeries: defaultSeries.dataSeries,
55
- fillLinearGradient: new GradientParams(new Point(0, 0), new Point(0, 1), [
56
- { color: appTheme.VividSkyBlue + '77', offset: 0 },
57
- { color: 'Transparent', offset: 1 }
58
- ]),
59
- stroke: appTheme.VividSkyBlue
60
- });
61
- }
62
- }
63
- // Override the standard tooltip displayed by CursorModifier
64
- getTooltipLegendTemplate(seriesInfos, svgAnnotation) {
65
- let outputSvgString = '';
66
- // Foreach series there will be a seriesInfo supplied by SciChart. This contains info about the series under the house
67
- seriesInfos.forEach((seriesInfo, index) => {
68
- const y = 20 + index * 20;
69
- const textColor = seriesInfo.stroke;
70
- let legendText = seriesInfo.formattedYValue;
71
- if (seriesInfo.dataSeriesType === EDataSeriesType.Ohlc) {
72
- const o = seriesInfo;
73
- legendText = `Open=${o.formattedOpenValue} High=${o.formattedHighValue} Low=${o.formattedLowValue} Close=${o.formattedCloseValue}`;
74
- }
75
- outputSvgString += `<text x="8" y="${y}" font-size="13" font-family="Verdana" fill="${textColor}">
76
- ${seriesInfo.seriesName}: ${legendText}
77
- </text>`;
78
- });
79
- return `<svg width="100%" height="100%">
80
- ${outputSvgString}
81
- </svg>`;
82
- }
83
- async build() {
84
- // Create a SciChartSurface
85
- const { sciChartSurface, wasmContext } = await SciChartSurface.create(this.chart, {
86
- theme: appTheme.SciChartJsTheme
87
- });
88
- // Add an XAxis of type DateTimeAxis
89
- // Note for crypto data this is fine, but for stocks/forex you will need to use CategoryAxis which collapses gaps at weekends
90
- // In future we have a hybrid IndexDateAxis which 'magically' solves problems of different # of points in stock market datasetd with gaps
91
- const xAxis = new DateTimeNumericAxis(wasmContext, {
92
- // autoRange.never as we're setting visibleRange explicitly below. If you dont do this, leave this flag default
93
- autoRange: EAutoRange.Never
94
- });
95
- sciChartSurface.xAxes.add(xAxis);
96
- // Create a NumericAxis on the YAxis with 2 Decimal Places
97
- sciChartSurface.yAxes.add(new NumericAxis(wasmContext, {
98
- growBy: new NumberRange(0.1, 0.1),
99
- labelFormat: ENumericFormat.Decimal,
100
- labelPrecision: 2,
101
- labelPrefix: '$',
102
- autoRange: EAutoRange.Always
103
- }));
104
- // Create a secondary YAxis to host volume data on its own scale
105
- sciChartSurface.yAxes.add(new NumericAxis(wasmContext, {
106
- id: Y_AXIS_VOLUME_ID,
107
- growBy: new NumberRange(0, 4),
108
- isVisible: false,
109
- autoRange: EAutoRange.Always
110
- }));
111
- // Fetch data from now to 300 1hr candles ago
112
- const endDate = new Date(Date.now());
113
- const startDate = new Date();
114
- startDate.setHours(endDate.getHours() - 300);
115
- const priceBars = await simpleBinanceRestClient.getCandles('BTCUSDT', '1h', startDate, endDate);
116
- // Maps PriceBar { date, open, high, low, close, volume } to structure-of-arrays expected by scichart
117
- const xValues = [];
118
- const openValues = [];
119
- const highValues = [];
120
- const lowValues = [];
121
- const closeValues = [];
122
- const volumeValues = [];
123
- priceBars.forEach((priceBar) => {
124
- xValues.push(priceBar.date);
125
- openValues.push(priceBar.open);
126
- highValues.push(priceBar.high);
127
- lowValues.push(priceBar.low);
128
- closeValues.push(priceBar.close);
129
- volumeValues.push(priceBar.volume);
130
- });
131
- // Zoom to the latest 100 candles
132
- const startViewportRange = new Date();
133
- startViewportRange.setHours(startDate.getHours() - 100);
134
- xAxis.visibleRange = new NumberRange(startViewportRange.getTime() / 1000, endDate.getTime() / 1000);
135
- // Create and add the Candlestick series
136
- // The Candlestick Series requires a special dataseries type called OhlcDataSeries with o,h,l,c and date values
137
- const candleDataSeries = new OhlcDataSeries(wasmContext, {
138
- xValues,
139
- openValues,
140
- highValues,
141
- lowValues,
142
- closeValues,
143
- dataSeriesName: 'BTC/USDT'
144
- });
145
- const candlestickSeries = new FastCandlestickRenderableSeries(wasmContext, {
146
- dataSeries: candleDataSeries,
147
- stroke: appTheme.ForegroundColor, // used by cursorModifier below
148
- strokeThickness: 1,
149
- brushUp: appTheme.VividGreen + '77',
150
- brushDown: appTheme.MutedRed + '77',
151
- strokeUp: appTheme.VividGreen,
152
- strokeDown: appTheme.MutedRed
153
- });
154
- sciChartSurface.renderableSeries.add(candlestickSeries);
155
- // Add an Ohlcseries. this will be invisible to begin with
156
- const ohlcSeries = new FastOhlcRenderableSeries(wasmContext, {
157
- dataSeries: candleDataSeries,
158
- stroke: appTheme.ForegroundColor, // used by cursorModifier below
159
- strokeThickness: 1,
160
- dataPointWidth: 0.9,
161
- strokeUp: appTheme.VividGreen,
162
- strokeDown: appTheme.MutedRed,
163
- isVisible: false
164
- });
165
- sciChartSurface.renderableSeries.add(ohlcSeries);
166
- // Add some moving averages using SciChart's filters/transforms API
167
- // when candleDataSeries updates, XyMovingAverageFilter automatically recomputes
168
- sciChartSurface.renderableSeries.add(new FastLineRenderableSeries(wasmContext, {
169
- dataSeries: new XyMovingAverageFilter(candleDataSeries, {
170
- dataSeriesName: 'Moving Average (20)',
171
- length: 20
172
- }),
173
- stroke: appTheme.VividSkyBlue
174
- }));
175
- sciChartSurface.renderableSeries.add(new FastLineRenderableSeries(wasmContext, {
176
- dataSeries: new XyMovingAverageFilter(candleDataSeries, {
177
- dataSeriesName: 'Moving Average (50)',
178
- length: 50
179
- }),
180
- stroke: appTheme.VividPink
181
- }));
182
- // Add volume data onto the chart
183
- sciChartSurface.renderableSeries.add(new FastColumnRenderableSeries(wasmContext, {
184
- dataSeries: new XyDataSeries(wasmContext, { xValues, yValues: volumeValues, dataSeriesName: 'Volume' }),
185
- strokeThickness: 0,
186
- // This is how we get volume to scale - on a hidden YAxis
187
- yAxisId: Y_AXIS_VOLUME_ID,
188
- // This is how we colour volume bars red or green
189
- paletteProvider: new VolumePaletteProvider(candleDataSeries, appTheme.VividGreen + '77', appTheme.MutedRed + '77')
190
- }));
191
- // Optional: Add some interactivity modifiers
192
- sciChartSurface.chartModifiers.add(new ZoomExtentsModifier(), new ZoomPanModifier(), new MouseWheelZoomModifier(), new CursorModifier({
193
- crosshairStroke: appTheme.VividOrange,
194
- axisLabelFill: appTheme.VividOrange,
195
- tooltipLegendTemplate: this.getTooltipLegendTemplate
196
- }));
197
- // Add Overview chart. This will automatically bind to the parent surface
198
- // displaying its series. Zooming the chart will zoom the overview and vice versa
199
- const overview = await SciChartOverview.create(sciChartSurface, this.overview, {
200
- theme: appTheme.SciChartJsTheme,
201
- transformRenderableSeries: this.getOverviewSeries
202
- });
203
- return { sciChartSurface, overview, candlestickSeries, ohlcSeries };
204
- }
205
- };
206
- SciCandleStockChart.styles = [
207
- css `
208
- :host {
209
- display: flex;
210
- flex-direction: column;
211
-
212
- width: 100%;
213
- }
214
-
215
- #chart {
216
- flex: 8;
217
- }
218
-
219
- #overview {
220
- flex: 2;
221
- }
222
- `
223
- ];
224
- __decorate([
225
- property({ type: String, attribute: 'series-type' })
226
- ], SciCandleStockChart.prototype, "seriesType", void 0);
227
- __decorate([
228
- state()
229
- ], SciCandleStockChart.prototype, "candlestickChartSeries", void 0);
230
- __decorate([
231
- state()
232
- ], SciCandleStockChart.prototype, "ohlcChartSeries", void 0);
233
- __decorate([
234
- state()
235
- ], SciCandleStockChart.prototype, "sciChartSurface", void 0);
236
- __decorate([
237
- state()
238
- ], SciCandleStockChart.prototype, "sciChartOverview", void 0);
239
- __decorate([
240
- query('#chart')
241
- ], SciCandleStockChart.prototype, "chart", void 0);
242
- __decorate([
243
- query('#overview')
244
- ], SciCandleStockChart.prototype, "overview", void 0);
245
- SciCandleStockChart = __decorate([
246
- customElement('sci-candle-stock-chart')
247
- ], SciCandleStockChart);
248
- export { SciCandleStockChart };
249
- //# sourceMappingURL=sci-candle-stick-chart.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sci-candle-stick-chart.js","sourceRoot":"","sources":["../../src/charts/sci-candle-stick-chart.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAoC,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC7E,OAAO,EAAE,aAAa,EAAE,QAAQ,EA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AAa,CAAC,wBAAwB,CAAC;GAC3B,mBAAmB,CAmQ/B","sourcesContent":["import { LitElement, PropertyValues, PropertyValueMap, css, html } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\n\nimport {\n SciChartSurface,\n NumberRange,\n NumericAxis,\n OhlcDataSeries,\n FastCandlestickRenderableSeries,\n ZoomPanModifier,\n ZoomExtentsModifier,\n MouseWheelZoomModifier,\n ENumericFormat,\n DateTimeNumericAxis,\n EAutoRange,\n FastLineRenderableSeries,\n XyMovingAverageFilter,\n SciChartOverview,\n CursorModifier,\n CursorTooltipSvgAnnotation,\n SeriesInfo,\n EDataSeriesType,\n ESeriesType,\n IRenderableSeries,\n FastMountainRenderableSeries,\n GradientParams,\n Point,\n OhlcSeriesInfo,\n FastColumnRenderableSeries,\n XyDataSeries,\n FastOhlcRenderableSeries\n} from 'scichart'\n\nimport { appTheme } from '../themes/app-theme'\nimport { VolumePaletteProvider } from './volume-pallette-provider'\nimport { simpleBinanceRestClient } from '../data/binance-rest-client'\n\nconst Y_AXIS_VOLUME_ID = 'Y_AXIS_VOLUME_ID'\n\nSciChartSurface.UseCommunityLicense()\nSciChartSurface.configure({\n dataUrl: `/node_modules/scichart/_wasm/scichart2d.data`,\n wasmUrl: `/node_modules/scichart/_wasm/scichart2d.wasm`\n})\n\n@customElement('sci-candle-stock-chart')\nexport class SciCandleStockChart extends LitElement {\n static styles = [\n css`\n :host {\n display: flex;\n flex-direction: column;\n\n width: 100%;\n }\n\n #chart {\n flex: 8;\n }\n\n #overview {\n flex: 2;\n }\n `\n ]\n\n render() {\n return html`\n <div id=\"chart\"></div>\n <div id=\"overview\"></div>\n `\n }\n\n @property({ type: String, attribute: 'series-type' }) seriesType: 'candle-stick' | 'ohlc' = 'candle-stick'\n\n @state() candlestickChartSeries!: FastCandlestickRenderableSeries\n @state() ohlcChartSeries!: FastOhlcRenderableSeries\n @state() sciChartSurface?: SciChartSurface\n @state() sciChartOverview?: SciChartOverview\n\n @query('#chart') chart!: HTMLDivElement\n @query('#overview') overview!: HTMLDivElement\n\n disconnectedCallback(): void {\n if (this.sciChartSurface) {\n this.sciChartSurface.delete()\n this.sciChartOverview!.delete()\n this.sciChartSurface = undefined\n this.sciChartOverview = undefined\n return\n }\n }\n\n protected async firstUpdated(_changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): Promise<void> {\n const { sciChartSurface, overview, candlestickSeries, ohlcSeries } = await this.build()\n\n this.candlestickChartSeries = candlestickSeries\n this.ohlcChartSeries = ohlcSeries\n this.sciChartSurface = sciChartSurface\n this.sciChartOverview = overview\n\n this.candlestickChartSeries.isVisible = this.seriesType == 'candle-stick'\n this.ohlcChartSeries.isVisible = this.seriesType == 'ohlc'\n }\n\n updated(changes: PropertyValues<this>) {\n if (changes.has('seriesType') && this.candlestickChartSeries) {\n this.candlestickChartSeries.isVisible = this.seriesType == 'candle-stick'\n this.ohlcChartSeries.isVisible = this.seriesType == 'ohlc'\n }\n }\n\n // Override the Renderableseries to display on the scichart overview\n private getOverviewSeries(defaultSeries: IRenderableSeries) {\n if (defaultSeries.type === ESeriesType.CandlestickSeries) {\n // Swap the default candlestick series on the overview chart for a mountain series. Same data\n return new FastMountainRenderableSeries(defaultSeries.parentSurface.webAssemblyContext2D, {\n dataSeries: defaultSeries.dataSeries,\n fillLinearGradient: new GradientParams(new Point(0, 0), new Point(0, 1), [\n { color: appTheme.VividSkyBlue + '77', offset: 0 },\n { color: 'Transparent', offset: 1 }\n ]),\n stroke: appTheme.VividSkyBlue\n })\n }\n }\n\n // Override the standard tooltip displayed by CursorModifier\n private getTooltipLegendTemplate(seriesInfos: SeriesInfo[], svgAnnotation: CursorTooltipSvgAnnotation) {\n let outputSvgString = ''\n\n // Foreach series there will be a seriesInfo supplied by SciChart. This contains info about the series under the house\n seriesInfos.forEach((seriesInfo, index) => {\n const y = 20 + index * 20\n const textColor = seriesInfo.stroke\n let legendText = seriesInfo.formattedYValue\n if (seriesInfo.dataSeriesType === EDataSeriesType.Ohlc) {\n const o = seriesInfo as OhlcSeriesInfo\n legendText = `Open=${o.formattedOpenValue} High=${o.formattedHighValue} Low=${o.formattedLowValue} Close=${o.formattedCloseValue}`\n }\n outputSvgString += `<text x=\"8\" y=\"${y}\" font-size=\"13\" font-family=\"Verdana\" fill=\"${textColor}\">\n ${seriesInfo.seriesName}: ${legendText}\n </text>`\n })\n\n return `<svg width=\"100%\" height=\"100%\">\n ${outputSvgString}\n </svg>`\n }\n\n private async build() {\n // Create a SciChartSurface\n const { sciChartSurface, wasmContext } = await SciChartSurface.create(this.chart, {\n theme: appTheme.SciChartJsTheme\n })\n\n // Add an XAxis of type DateTimeAxis\n // Note for crypto data this is fine, but for stocks/forex you will need to use CategoryAxis which collapses gaps at weekends\n // In future we have a hybrid IndexDateAxis which 'magically' solves problems of different # of points in stock market datasetd with gaps\n const xAxis = new DateTimeNumericAxis(wasmContext, {\n // autoRange.never as we're setting visibleRange explicitly below. If you dont do this, leave this flag default\n autoRange: EAutoRange.Never\n })\n sciChartSurface.xAxes.add(xAxis)\n\n // Create a NumericAxis on the YAxis with 2 Decimal Places\n sciChartSurface.yAxes.add(\n new NumericAxis(wasmContext, {\n growBy: new NumberRange(0.1, 0.1),\n labelFormat: ENumericFormat.Decimal,\n labelPrecision: 2,\n labelPrefix: '$',\n autoRange: EAutoRange.Always\n })\n )\n\n // Create a secondary YAxis to host volume data on its own scale\n sciChartSurface.yAxes.add(\n new NumericAxis(wasmContext, {\n id: Y_AXIS_VOLUME_ID,\n growBy: new NumberRange(0, 4),\n isVisible: false,\n autoRange: EAutoRange.Always\n })\n )\n\n // Fetch data from now to 300 1hr candles ago\n const endDate = new Date(Date.now())\n const startDate = new Date()\n startDate.setHours(endDate.getHours() - 300)\n const priceBars = await simpleBinanceRestClient.getCandles('BTCUSDT', '1h', startDate, endDate)\n\n // Maps PriceBar { date, open, high, low, close, volume } to structure-of-arrays expected by scichart\n const xValues: number[] = []\n const openValues: number[] = []\n const highValues: number[] = []\n const lowValues: number[] = []\n const closeValues: number[] = []\n const volumeValues: number[] = []\n priceBars.forEach((priceBar: any) => {\n xValues.push(priceBar.date)\n openValues.push(priceBar.open)\n highValues.push(priceBar.high)\n lowValues.push(priceBar.low)\n closeValues.push(priceBar.close)\n volumeValues.push(priceBar.volume)\n })\n\n // Zoom to the latest 100 candles\n const startViewportRange = new Date()\n startViewportRange.setHours(startDate.getHours() - 100)\n xAxis.visibleRange = new NumberRange(startViewportRange.getTime() / 1000, endDate.getTime() / 1000)\n\n // Create and add the Candlestick series\n // The Candlestick Series requires a special dataseries type called OhlcDataSeries with o,h,l,c and date values\n const candleDataSeries = new OhlcDataSeries(wasmContext, {\n xValues,\n openValues,\n highValues,\n lowValues,\n closeValues,\n dataSeriesName: 'BTC/USDT'\n })\n const candlestickSeries = new FastCandlestickRenderableSeries(wasmContext, {\n dataSeries: candleDataSeries,\n stroke: appTheme.ForegroundColor, // used by cursorModifier below\n strokeThickness: 1,\n brushUp: appTheme.VividGreen + '77',\n brushDown: appTheme.MutedRed + '77',\n strokeUp: appTheme.VividGreen,\n strokeDown: appTheme.MutedRed\n })\n sciChartSurface.renderableSeries.add(candlestickSeries)\n\n // Add an Ohlcseries. this will be invisible to begin with\n const ohlcSeries = new FastOhlcRenderableSeries(wasmContext, {\n dataSeries: candleDataSeries,\n stroke: appTheme.ForegroundColor, // used by cursorModifier below\n strokeThickness: 1,\n dataPointWidth: 0.9,\n strokeUp: appTheme.VividGreen,\n strokeDown: appTheme.MutedRed,\n isVisible: false\n })\n sciChartSurface.renderableSeries.add(ohlcSeries)\n\n // Add some moving averages using SciChart's filters/transforms API\n // when candleDataSeries updates, XyMovingAverageFilter automatically recomputes\n sciChartSurface.renderableSeries.add(\n new FastLineRenderableSeries(wasmContext, {\n dataSeries: new XyMovingAverageFilter(candleDataSeries, {\n dataSeriesName: 'Moving Average (20)',\n length: 20\n }),\n stroke: appTheme.VividSkyBlue\n })\n )\n\n sciChartSurface.renderableSeries.add(\n new FastLineRenderableSeries(wasmContext, {\n dataSeries: new XyMovingAverageFilter(candleDataSeries, {\n dataSeriesName: 'Moving Average (50)',\n length: 50\n }),\n stroke: appTheme.VividPink\n })\n )\n\n // Add volume data onto the chart\n sciChartSurface.renderableSeries.add(\n new FastColumnRenderableSeries(wasmContext, {\n dataSeries: new XyDataSeries(wasmContext, { xValues, yValues: volumeValues, dataSeriesName: 'Volume' }),\n strokeThickness: 0,\n // This is how we get volume to scale - on a hidden YAxis\n yAxisId: Y_AXIS_VOLUME_ID,\n // This is how we colour volume bars red or green\n paletteProvider: new VolumePaletteProvider(\n candleDataSeries,\n appTheme.VividGreen + '77',\n appTheme.MutedRed + '77'\n )\n })\n )\n\n // Optional: Add some interactivity modifiers\n sciChartSurface.chartModifiers.add(\n new ZoomExtentsModifier(),\n new ZoomPanModifier(),\n new MouseWheelZoomModifier(),\n new CursorModifier({\n crosshairStroke: appTheme.VividOrange,\n axisLabelFill: appTheme.VividOrange,\n tooltipLegendTemplate: this.getTooltipLegendTemplate\n })\n )\n\n // Add Overview chart. This will automatically bind to the parent surface\n // displaying its series. Zooming the chart will zoom the overview and vice versa\n const overview = await SciChartOverview.create(sciChartSurface, this.overview, {\n theme: appTheme.SciChartJsTheme,\n transformRenderableSeries: this.getOverviewSeries as any\n })\n\n return { sciChartSurface, overview, candlestickSeries, ohlcSeries }\n }\n}\n"]}
@@ -1,12 +0,0 @@
1
- import { OhlcDataSeries, IRenderableSeries, EFillPaletteMode, IFillPaletteProvider, IPointMetadata } from 'scichart';
2
- export declare class VolumePaletteProvider implements IFillPaletteProvider {
3
- fillPaletteMode: EFillPaletteMode;
4
- private ohlcDataSeries;
5
- private upColorArgb;
6
- private downColorArgb;
7
- constructor(masterData: OhlcDataSeries, upColor: string, downColor: string);
8
- onAttached(parentSeries: IRenderableSeries): void;
9
- onDetached(): void;
10
- overrideFillArgb(xValue: number, yValue: number, index: number, opacity?: number, metadata?: IPointMetadata): number;
11
- overrideStrokeArgb(xValue: number, yValue: number, index: number, opacity?: number, metadata?: IPointMetadata): number;
12
- }
@@ -1,21 +0,0 @@
1
- import { EFillPaletteMode, parseColorToUIntArgb } from 'scichart';
2
- export class VolumePaletteProvider {
3
- constructor(masterData, upColor, downColor) {
4
- this.fillPaletteMode = EFillPaletteMode.SOLID;
5
- this.upColorArgb = parseColorToUIntArgb(upColor);
6
- this.downColorArgb = parseColorToUIntArgb(downColor);
7
- this.ohlcDataSeries = masterData;
8
- }
9
- onAttached(parentSeries) { }
10
- onDetached() { }
11
- // Return up or down color for the volume bars depending on Ohlc data
12
- overrideFillArgb(xValue, yValue, index, opacity, metadata) {
13
- const isUpCandle = this.ohlcDataSeries.getNativeOpenValues().get(index) >= this.ohlcDataSeries.getNativeCloseValues().get(index);
14
- return isUpCandle ? this.upColorArgb : this.downColorArgb;
15
- }
16
- // Override stroke as well, even though strokethickness is 0, because stroke is used if column thickness goes to 0.
17
- overrideStrokeArgb(xValue, yValue, index, opacity, metadata) {
18
- return this.overrideFillArgb(xValue, yValue, index, opacity, metadata);
19
- }
20
- }
21
- //# sourceMappingURL=volume-pallette-provider.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"volume-pallette-provider.js","sourceRoot":"","sources":["../../src/charts/volume-pallette-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,gBAAgB,EAGhB,oBAAoB,EACrB,MAAM,UAAU,CAAA;AAEjB,MAAM,OAAO,qBAAqB;IAMhC,YAAY,UAA0B,EAAE,OAAe,EAAE,SAAiB;QAL1E,oBAAe,GAAqB,gBAAgB,CAAC,KAAK,CAAA;QAMxD,IAAI,CAAC,WAAW,GAAG,oBAAoB,CAAC,OAAO,CAAC,CAAA;QAChD,IAAI,CAAC,aAAa,GAAG,oBAAoB,CAAC,SAAS,CAAC,CAAA;QACpD,IAAI,CAAC,cAAc,GAAG,UAAU,CAAA;IAClC,CAAC;IACD,UAAU,CAAC,YAA+B,IAAS,CAAC;IACpD,UAAU,KAAU,CAAC;IAErB,qEAAqE;IACrE,gBAAgB,CAAC,MAAc,EAAE,MAAc,EAAE,KAAa,EAAE,OAAgB,EAAE,QAAyB;QACzG,MAAM,UAAU,GACd,IAAI,CAAC,cAAc,CAAC,mBAAmB,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,cAAc,CAAC,oBAAoB,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;QAC/G,OAAO,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAA;IAC3D,CAAC;IAED,mHAAmH;IACnH,kBAAkB,CAChB,MAAc,EACd,MAAc,EACd,KAAa,EACb,OAAgB,EAChB,QAAyB;QAEzB,OAAO,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAA;IACxE,CAAC;CACF","sourcesContent":["import {\n OhlcDataSeries,\n IRenderableSeries,\n EFillPaletteMode,\n IFillPaletteProvider,\n IPointMetadata,\n parseColorToUIntArgb\n} from 'scichart'\n\nexport class VolumePaletteProvider implements IFillPaletteProvider {\n fillPaletteMode: EFillPaletteMode = EFillPaletteMode.SOLID\n private ohlcDataSeries: OhlcDataSeries\n private upColorArgb: number\n private downColorArgb: number\n\n constructor(masterData: OhlcDataSeries, upColor: string, downColor: string) {\n this.upColorArgb = parseColorToUIntArgb(upColor)\n this.downColorArgb = parseColorToUIntArgb(downColor)\n this.ohlcDataSeries = masterData\n }\n onAttached(parentSeries: IRenderableSeries): void {}\n onDetached(): void {}\n\n // Return up or down color for the volume bars depending on Ohlc data\n overrideFillArgb(xValue: number, yValue: number, index: number, opacity?: number, metadata?: IPointMetadata): number {\n const isUpCandle =\n this.ohlcDataSeries.getNativeOpenValues().get(index) >= this.ohlcDataSeries.getNativeCloseValues().get(index)\n return isUpCandle ? this.upColorArgb : this.downColorArgb\n }\n\n // Override stroke as well, even though strokethickness is 0, because stroke is used if column thickness goes to 0.\n overrideStrokeArgb(\n xValue: number,\n yValue: number,\n index: number,\n opacity?: number,\n metadata?: IPointMetadata\n ): number {\n return this.overrideFillArgb(xValue, yValue, index, opacity, metadata)\n }\n}\n"]}
@@ -1,14 +0,0 @@
1
- /**
2
- * Defines a price bar with Open, High, Low, Close and Date encoded as number
3
- */
4
- export type TPriceBar = {
5
- date: number;
6
- open: number;
7
- high: number;
8
- low: number;
9
- close: number;
10
- volume: number;
11
- };
12
- export declare const simpleBinanceRestClient: {
13
- getCandles: (symbol: string, interval: string, startTime?: Date, endTime?: Date, limit?: number) => Promise<TPriceBar[]>;
14
- };
@@ -1,53 +0,0 @@
1
- /**
2
- * Parses JSON candles into TPriceBar array
3
- * @param candles
4
- */
5
- const parseCandles = (candles) => {
6
- const priceBars = [];
7
- candles.forEach((candle) => {
8
- const [timestamp, open, high, low, close, volume] = candle;
9
- const openValue = parseFloat(open);
10
- const highValue = parseFloat(high);
11
- const lowValue = parseFloat(low);
12
- const closeValue = parseFloat(close);
13
- const volumeValue = parseFloat(volume);
14
- priceBars.push({
15
- date: timestamp / 1000,
16
- open: openValue,
17
- high: highValue,
18
- low: lowValue,
19
- close: closeValue,
20
- volume: volumeValue
21
- });
22
- });
23
- return priceBars;
24
- };
25
- /**
26
- * Fetches candles from Binance Rest API
27
- */
28
- const getCandles = async (symbol, interval, startTime, endTime, limit = 500) => {
29
- let url = `https://api.binance.us/api/v3/klines?symbol=${symbol}&interval=${interval}`;
30
- if (startTime) {
31
- url += `&startTime=${startTime.getTime()}`;
32
- }
33
- if (endTime) {
34
- url += `&endTime=${endTime.getTime()}`;
35
- }
36
- if (limit) {
37
- url += `&limit=${limit}`;
38
- }
39
- try {
40
- console.log(`SimpleBinanceClient: Fetching ${symbol} ${interval} from ${startTime} to ${endTime}`);
41
- const response = await fetch(url);
42
- const data = await response.json();
43
- return parseCandles(data);
44
- }
45
- catch (err) {
46
- console.error(err);
47
- return [];
48
- }
49
- };
50
- export const simpleBinanceRestClient = {
51
- getCandles
52
- };
53
- //# sourceMappingURL=binance-rest-client.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"binance-rest-client.js","sourceRoot":"","sources":["../../src/data/binance-rest-client.ts"],"names":[],"mappings":"AAYA;;;GAGG;AACH,MAAM,YAAY,GAAG,CAAC,OAAc,EAAe,EAAE;IACnD,MAAM,SAAS,GAAgB,EAAE,CAAA;IAEjC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAW,EAAE,EAAE;QAC9B,MAAM,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,CAAC,GAAG,MAAM,CAAA;QAC1D,MAAM,SAAS,GAAG,UAAU,CAAC,IAAI,CAAC,CAAA;QAClC,MAAM,SAAS,GAAG,UAAU,CAAC,IAAI,CAAC,CAAA;QAClC,MAAM,QAAQ,GAAG,UAAU,CAAC,GAAG,CAAC,CAAA;QAChC,MAAM,UAAU,GAAG,UAAU,CAAC,KAAK,CAAC,CAAA;QACpC,MAAM,WAAW,GAAG,UAAU,CAAC,MAAM,CAAC,CAAA;QAEtC,SAAS,CAAC,IAAI,CAAC;YACb,IAAI,EAAE,SAAS,GAAG,IAAI;YACtB,IAAI,EAAE,SAAS;YACf,IAAI,EAAE,SAAS;YACf,GAAG,EAAE,QAAQ;YACb,KAAK,EAAE,UAAU;YACjB,MAAM,EAAE,WAAW;SACpB,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;IAEF,OAAO,SAAS,CAAA;AAClB,CAAC,CAAA;AAED;;GAEG;AACH,MAAM,UAAU,GAAG,KAAK,EACtB,MAAc,EACd,QAAgB,EAChB,SAAgB,EAChB,OAAc,EACd,QAAgB,GAAG,EACG,EAAE;IACxB,IAAI,GAAG,GAAG,+CAA+C,MAAM,aAAa,QAAQ,EAAE,CAAA;IACtF,IAAI,SAAS,EAAE,CAAC;QACd,GAAG,IAAI,cAAc,SAAS,CAAC,OAAO,EAAE,EAAE,CAAA;IAC5C,CAAC;IACD,IAAI,OAAO,EAAE,CAAC;QACZ,GAAG,IAAI,YAAY,OAAO,CAAC,OAAO,EAAE,EAAE,CAAA;IACxC,CAAC;IACD,IAAI,KAAK,EAAE,CAAC;QACV,GAAG,IAAI,UAAU,KAAK,EAAE,CAAA;IAC1B,CAAC;IACD,IAAI,CAAC;QACH,OAAO,CAAC,GAAG,CAAC,iCAAiC,MAAM,IAAI,QAAQ,SAAS,SAAS,OAAO,OAAO,EAAE,CAAC,CAAA;QAClG,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,CAAA;QACjC,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;QAClC,OAAO,YAAY,CAAC,IAAI,CAAC,CAAA;IAC3B,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;QAClB,OAAO,EAAE,CAAA;IACX,CAAC;AACH,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,UAAU;CACX,CAAA","sourcesContent":["/**\n * Defines a price bar with Open, High, Low, Close and Date encoded as number\n */\nexport type TPriceBar = {\n date: number\n open: number\n high: number\n low: number\n close: number\n volume: number\n}\n\n/**\n * Parses JSON candles into TPriceBar array\n * @param candles\n */\nconst parseCandles = (candles: any[]): TPriceBar[] => {\n const priceBars: TPriceBar[] = []\n\n candles.forEach((candle: any) => {\n const [timestamp, open, high, low, close, volume] = candle\n const openValue = parseFloat(open)\n const highValue = parseFloat(high)\n const lowValue = parseFloat(low)\n const closeValue = parseFloat(close)\n const volumeValue = parseFloat(volume)\n\n priceBars.push({\n date: timestamp / 1000,\n open: openValue,\n high: highValue,\n low: lowValue,\n close: closeValue,\n volume: volumeValue\n })\n })\n\n return priceBars\n}\n\n/**\n * Fetches candles from Binance Rest API\n */\nconst getCandles = async (\n symbol: string,\n interval: string,\n startTime?: Date,\n endTime?: Date,\n limit: number = 500\n): Promise<TPriceBar[]> => {\n let url = `https://api.binance.us/api/v3/klines?symbol=${symbol}&interval=${interval}`\n if (startTime) {\n url += `&startTime=${startTime.getTime()}`\n }\n if (endTime) {\n url += `&endTime=${endTime.getTime()}`\n }\n if (limit) {\n url += `&limit=${limit}`\n }\n try {\n console.log(`SimpleBinanceClient: Fetching ${symbol} ${interval} from ${startTime} to ${endTime}`)\n const response = await fetch(url)\n const data = await response.json()\n return parseCandles(data)\n } catch (err) {\n console.error(err)\n return []\n }\n}\n\nexport const simpleBinanceRestClient = {\n getCandles\n}\n"]}
@@ -1,10 +0,0 @@
1
- import './charts/sci-candle-stick-chart';
2
- import { HTMLOverlayContainer, ComponentNature } from '@hatiolab/things-scene';
3
- import { SciCandleStockChart } from './charts/sci-candle-stick-chart';
4
- export default class ScichartCandleStick extends HTMLOverlayContainer {
5
- static get nature(): ComponentNature;
6
- dispose(): void;
7
- setElementProperties(chart: SciCandleStockChart): void;
8
- reposition(): void;
9
- get tagName(): string;
10
- }
@@ -1,50 +0,0 @@
1
- /*
2
- * Copyright © HatioLab Inc. All rights reserved.
3
- */
4
- const NATURE = {
5
- mutable: false,
6
- resizable: true,
7
- rotatable: true,
8
- properties: [
9
- {
10
- type: 'select',
11
- label: 'series',
12
- name: 'series',
13
- property: {
14
- options: ['', 'candle-stick', 'ohlc']
15
- }
16
- }
17
- ]
18
- };
19
- import './charts/sci-candle-stick-chart';
20
- import { Component, HTMLOverlayContainer } from '@hatiolab/things-scene';
21
- export default class ScichartCandleStick extends HTMLOverlayContainer {
22
- static get nature() {
23
- return NATURE;
24
- }
25
- dispose() {
26
- super.dispose();
27
- }
28
- /*
29
- * 컴포넌트의 생성 또는 속성 변화 시에 호출되며,
30
- * 그에 따른 html element의 반영이 필요한 부분을 구현한다.
31
- *
32
- * ThingsComponent state => HTML element properties
33
- */
34
- setElementProperties(chart) {
35
- const { series = 'candle-stick' } = this.state;
36
- chart.seriesType = series;
37
- }
38
- /*
39
- * 컴포넌트가 ready 상태가 되거나, 컴포넌트의 속성이 변화될 시 setElementProperties 뒤에 호출된다.
40
- * 변화에 따른 기본적인 html 속성이 super.reposition()에서 진행되고, 그 밖의 작업이 필요할 때, 오버라이드 한다.
41
- */
42
- reposition() {
43
- super.reposition();
44
- }
45
- get tagName() {
46
- return 'sci-candle-stock-chart';
47
- }
48
- }
49
- Component.register('scichart-candle-stick', ScichartCandleStick);
50
- //# sourceMappingURL=scichart-candle-stick.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"scichart-candle-stick.js","sourceRoot":"","sources":["../src/scichart-candle-stick.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,MAAM,GAAG;IACb,OAAO,EAAE,KAAK;IACd,SAAS,EAAE,IAAI;IACf,SAAS,EAAE,IAAI;IACf,UAAU,EAAE;QACV;YACE,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,QAAQ;YACf,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE;gBACR,OAAO,EAAE,CAAC,EAAE,EAAE,cAAc,EAAE,MAAM,CAAC;aACtC;SACF;KACF;CACF,CAAA;AAED,OAAO,iCAAiC,CAAA;AACxC,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAAsC,MAAM,wBAAwB,CAAA;AAI5G,MAAM,CAAC,OAAO,OAAO,mBAAoB,SAAQ,oBAAoB;IACnE,MAAM,KAAK,MAAM;QACf,OAAO,MAAM,CAAA;IACf,CAAC;IAED,OAAO;QACL,KAAK,CAAC,OAAO,EAAE,CAAA;IACjB,CAAC;IAED;;;;;OAKG;IACH,oBAAoB,CAAC,KAA0B;QAC7C,MAAM,EAAE,MAAM,GAAG,cAAc,EAAE,GAAG,IAAI,CAAC,KAAK,CAAA;QAE9C,KAAK,CAAC,UAAU,GAAG,MAAM,CAAA;IAC3B,CAAC;IAED;;;OAGG;IACH,UAAU;QACR,KAAK,CAAC,UAAU,EAAE,CAAA;IACpB,CAAC;IAED,IAAI,OAAO;QACT,OAAO,wBAAwB,CAAA;IACjC,CAAC;CACF;AAED,SAAS,CAAC,QAAQ,CAAC,uBAAuB,EAAE,mBAAmB,CAAC,CAAA","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\n\nconst NATURE = {\n mutable: false,\n resizable: true,\n rotatable: true,\n properties: [\n {\n type: 'select',\n label: 'series',\n name: 'series',\n property: {\n options: ['', 'candle-stick', 'ohlc']\n }\n }\n ]\n}\n\nimport './charts/sci-candle-stick-chart'\nimport { Component, HTMLOverlayContainer, Properties, ComponentNature, error } from '@hatiolab/things-scene'\n\nimport { SciCandleStockChart } from './charts/sci-candle-stick-chart'\n\nexport default class ScichartCandleStick extends HTMLOverlayContainer {\n static get nature(): ComponentNature {\n return NATURE\n }\n\n dispose() {\n super.dispose()\n }\n\n /*\n * 컴포넌트의 생성 또는 속성 변화 시에 호출되며,\n * 그에 따른 html element의 반영이 필요한 부분을 구현한다.\n *\n * ThingsComponent state => HTML element properties\n */\n setElementProperties(chart: SciCandleStockChart) {\n const { series = 'candle-stick' } = this.state\n\n chart.seriesType = series\n }\n\n /*\n * 컴포넌트가 ready 상태가 되거나, 컴포넌트의 속성이 변화될 시 setElementProperties 뒤에 호출된다.\n * 변화에 따른 기본적인 html 속성이 super.reposition()에서 진행되고, 그 밖의 작업이 필요할 때, 오버라이드 한다.\n */\n reposition() {\n super.reposition()\n }\n\n get tagName() {\n return 'sci-candle-stock-chart'\n }\n}\n\nComponent.register('scichart-candle-stick', ScichartCandleStick)\n"]}
@@ -1,21 +0,0 @@
1
- import 'ses';
2
- import { HTMLOverlayContainer } from '@hatiolab/things-scene';
3
- export default class Scichart extends HTMLOverlayContainer {
4
- static get nature(): {
5
- mutable: boolean;
6
- resizable: boolean;
7
- rotatable: boolean;
8
- properties: {
9
- type: string;
10
- label: string;
11
- name: string;
12
- }[];
13
- };
14
- _anchor?: HTMLDivElement;
15
- oncreate_element(div: HTMLDivElement): Promise<void>;
16
- dispose(): void;
17
- setElementProperties(div: HTMLDivElement): void;
18
- reposition(): void;
19
- get config(): any;
20
- get tagName(): string;
21
- }
package/dist/scichart.js DELETED
@@ -1,72 +0,0 @@
1
- /*
2
- * Copyright © HatioLab Inc. All rights reserved.
3
- */
4
- import 'ses';
5
- const NATURE = {
6
- mutable: false,
7
- resizable: true,
8
- rotatable: true,
9
- properties: [
10
- {
11
- type: 'textarea',
12
- label: 'config',
13
- name: 'config'
14
- }
15
- ]
16
- };
17
- import { Component, HTMLOverlayContainer, error } from '@hatiolab/things-scene';
18
- import { SciChartSurface } from 'scichart/Charting/Visuals/SciChartSurface';
19
- import { NumericAxis } from 'scichart/Charting/Visuals/Axis/NumericAxis';
20
- SciChartSurface.UseCommunityLicense();
21
- SciChartSurface.configure({
22
- dataUrl: `/node_modules/scichart/_wasm/scichart2d.data`,
23
- wasmUrl: `/node_modules/scichart/_wasm/scichart2d.wasm`
24
- });
25
- export default class Scichart extends HTMLOverlayContainer {
26
- static get nature() {
27
- return NATURE;
28
- }
29
- async oncreate_element(div) {
30
- const { sciChartSurface, wasmContext } = await SciChartSurface.create(div);
31
- const xAxis = new NumericAxis(wasmContext);
32
- const yAxis = new NumericAxis(wasmContext);
33
- sciChartSurface.xAxes.add(xAxis);
34
- sciChartSurface.yAxes.add(yAxis);
35
- }
36
- dispose() {
37
- super.dispose();
38
- delete this._anchor;
39
- }
40
- /*
41
- * 컴포넌트의 생성 또는 속성 변화 시에 호출되며,
42
- * 그에 따른 html element의 반영이 필요한 부분을 구현한다.
43
- *
44
- * ThingsComponent state => HTML element properties
45
- */
46
- setElementProperties(div) { }
47
- /*
48
- * 컴포넌트가 ready 상태가 되거나, 컴포넌트의 속성이 변화될 시 setElementProperties 뒤에 호출된다.
49
- * 변화에 따른 기본적인 html 속성이 super.reposition()에서 진행되고, 그 밖의 작업이 필요할 때, 오버라이드 한다.
50
- */
51
- reposition() {
52
- super.reposition();
53
- }
54
- get config() {
55
- var { config, data } = this.state;
56
- if (typeof config !== 'object') {
57
- try {
58
- const c = new Compartment();
59
- return c.evaluate(`(${config})`);
60
- }
61
- catch (e) {
62
- error(e);
63
- }
64
- }
65
- return config;
66
- }
67
- get tagName() {
68
- return 'div';
69
- }
70
- }
71
- Component.register('scichart', Scichart);
72
- //# sourceMappingURL=scichart.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"scichart.js","sourceRoot":"","sources":["../src/scichart.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,CAAA;AAEZ,MAAM,MAAM,GAAG;IACb,OAAO,EAAE,KAAK;IACd,SAAS,EAAE,IAAI;IACf,SAAS,EAAE,IAAI;IACf,UAAU,EAAE;QACV;YACE,IAAI,EAAE,UAAU;YAChB,KAAK,EAAE,QAAQ;YACf,IAAI,EAAE,QAAQ;SACf;KACF;CACF,CAAA;AAED,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAA+B,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAE5G,OAAO,EAAE,eAAe,EAAE,MAAM,2CAA2C,CAAA;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,4CAA4C,CAAA;AAExE,eAAe,CAAC,mBAAmB,EAAE,CAAA;AACrC,eAAe,CAAC,SAAS,CAAC;IACxB,OAAO,EAAE,8CAA8C;IACvD,OAAO,EAAE,8CAA8C;CACxD,CAAC,CAAA;AAEF,MAAM,CAAC,OAAO,OAAO,QAAS,SAAQ,oBAAoB;IACxD,MAAM,KAAK,MAAM;QACf,OAAO,MAAM,CAAA;IACf,CAAC;IAID,KAAK,CAAC,gBAAgB,CAAC,GAAmB;QACxC,MAAM,EAAE,eAAe,EAAE,WAAW,EAAE,GAAG,MAAM,eAAe,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;QAE1E,MAAM,KAAK,GAAG,IAAI,WAAW,CAAC,WAAW,CAAC,CAAA;QAC1C,MAAM,KAAK,GAAG,IAAI,WAAW,CAAC,WAAW,CAAC,CAAA;QAE1C,eAAe,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;QAChC,eAAe,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;IAClC,CAAC;IAED,OAAO;QACL,KAAK,CAAC,OAAO,EAAE,CAAA;QAEf,OAAO,IAAI,CAAC,OAAO,CAAA;IACrB,CAAC;IAED;;;;;OAKG;IACH,oBAAoB,CAAC,GAAmB,IAAG,CAAC;IAE5C;;;OAGG;IACH,UAAU;QACR,KAAK,CAAC,UAAU,EAAE,CAAA;IACpB,CAAC;IAED,IAAI,MAAM;QACR,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC,KAAK,CAAA;QAEjC,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;YAC/B,IAAI,CAAC;gBACH,MAAM,CAAC,GAAG,IAAI,WAAW,EAAE,CAAA;gBAE3B,OAAO,CAAC,CAAC,QAAQ,CAAC,IAAI,MAAM,GAAG,CAAC,CAAA;YAClC,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACX,KAAK,CAAC,CAAC,CAAC,CAAA;YACV,CAAC;QACH,CAAC;QAED,OAAO,MAAM,CAAA;IACf,CAAC;IAED,IAAI,OAAO;QACT,OAAO,KAAK,CAAA;IACd,CAAC;CACF;AAED,SAAS,CAAC,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAA","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\nimport 'ses'\n\nconst NATURE = {\n mutable: false,\n resizable: true,\n rotatable: true,\n properties: [\n {\n type: 'textarea',\n label: 'config',\n name: 'config'\n }\n ]\n}\n\nimport { Component, HTMLOverlayContainer, Properties, ComponentNature, error } from '@hatiolab/things-scene'\n\nimport { SciChartSurface } from 'scichart/Charting/Visuals/SciChartSurface'\nimport { NumericAxis } from 'scichart/Charting/Visuals/Axis/NumericAxis'\n\nSciChartSurface.UseCommunityLicense()\nSciChartSurface.configure({\n dataUrl: `/node_modules/scichart/_wasm/scichart2d.data`,\n wasmUrl: `/node_modules/scichart/_wasm/scichart2d.wasm`\n})\n\nexport default class Scichart extends HTMLOverlayContainer {\n static get nature() {\n return NATURE\n }\n\n _anchor?: HTMLDivElement\n\n async oncreate_element(div: HTMLDivElement) {\n const { sciChartSurface, wasmContext } = await SciChartSurface.create(div)\n\n const xAxis = new NumericAxis(wasmContext)\n const yAxis = new NumericAxis(wasmContext)\n\n sciChartSurface.xAxes.add(xAxis)\n sciChartSurface.yAxes.add(yAxis)\n }\n\n dispose() {\n super.dispose()\n\n delete this._anchor\n }\n\n /*\n * 컴포넌트의 생성 또는 속성 변화 시에 호출되며,\n * 그에 따른 html element의 반영이 필요한 부분을 구현한다.\n *\n * ThingsComponent state => HTML element properties\n */\n setElementProperties(div: HTMLDivElement) {}\n\n /*\n * 컴포넌트가 ready 상태가 되거나, 컴포넌트의 속성이 변화될 시 setElementProperties 뒤에 호출된다.\n * 변화에 따른 기본적인 html 속성이 super.reposition()에서 진행되고, 그 밖의 작업이 필요할 때, 오버라이드 한다.\n */\n reposition() {\n super.reposition()\n }\n\n get config() {\n var { config, data } = this.state\n\n if (typeof config !== 'object') {\n try {\n const c = new Compartment()\n\n return c.evaluate(`(${config})`)\n } catch (e) {\n error(e)\n }\n }\n\n return config\n }\n\n get tagName() {\n return 'div'\n }\n}\n\nComponent.register('scichart', Scichart)\n"]}
@@ -1,14 +0,0 @@
1
- declare const _default: {
2
- type: string;
3
- description: string;
4
- group: string;
5
- icon: string;
6
- model: {
7
- type: string;
8
- left: number;
9
- top: number;
10
- width: number;
11
- height: number;
12
- };
13
- };
14
- export default _default;
@@ -1,16 +0,0 @@
1
- const icon = new URL('../../icons/scichart-candle-stick.png', import.meta.url).href;
2
- export default {
3
- type: 'scichart-candle-stick',
4
- description: 'scichart-candle-stick',
5
- /* line|shape|textAndMedia|chartAndGauge|table|container|dataSource|IoT|3D|warehouse|form|etc */
6
- group: 'chartAndGauge',
7
- icon,
8
- model: {
9
- type: 'scichart-candle-stick',
10
- left: 10,
11
- top: 10,
12
- width: 400,
13
- height: 300
14
- }
15
- };
16
- //# sourceMappingURL=scichart-candle-stick.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"scichart-candle-stick.js","sourceRoot":"","sources":["../../src/templates/scichart-candle-stick.ts"],"names":[],"mappings":"AAAA,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,uCAAuC,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAA;AAEnF,eAAe;IACb,IAAI,EAAE,uBAAuB;IAC7B,WAAW,EAAE,uBAAuB;IACpC,gGAAgG;IAChG,KAAK,EAAE,eAAe;IACtB,IAAI;IACJ,KAAK,EAAE;QACL,IAAI,EAAE,uBAAuB;QAC7B,IAAI,EAAE,EAAE;QACR,GAAG,EAAE,EAAE;QACP,KAAK,EAAE,GAAG;QACV,MAAM,EAAE,GAAG;KACZ;CACF,CAAA","sourcesContent":["const icon = new URL('../../icons/scichart-candle-stick.png', import.meta.url).href\n\nexport default {\n type: 'scichart-candle-stick',\n description: 'scichart-candle-stick',\n /* line|shape|textAndMedia|chartAndGauge|table|container|dataSource|IoT|3D|warehouse|form|etc */\n group: 'chartAndGauge',\n icon,\n model: {\n type: 'scichart-candle-stick',\n left: 10,\n top: 10,\n width: 400,\n height: 300\n }\n}\n"]}