scichart 2.1.2261 → 2.1.2267
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/Charting/ChartModifiers/LegendModifier.d.ts +2 -2
- package/Charting/Visuals/Legend/SciChartLegend.d.ts +6 -0
- package/Charting/Visuals/Legend/SciChartLegend.js +30 -13
- package/Charting/Visuals/Legend/SciChartLegendBase.d.ts +20 -6
- package/Charting/Visuals/Legend/SciChartLegendBase.js +22 -4
- package/Charting/Visuals/Legend/SciChartPieLegend.d.ts +2 -0
- package/Charting/Visuals/Legend/SciChartPieLegend.js +17 -6
- package/Charting/Visuals/SciChartPieSurface/SciChartPieSurface.d.ts +3 -2
- package/Charting/Visuals/SciChartPieSurface/SciChartPieSurface.js +39 -30
- package/Core/BuildStamp.d.ts +1 -1
- package/Core/BuildStamp.js +2 -2
- package/README.md +223 -1
- package/_wasm/scichart.browser.js +1 -1
- package/_wasm/scichart2d.js +95 -95
- package/_wasm/scichart2d.wasm +0 -0
- package/_wasm/scichart3d.js +1 -1
- package/_wasm/scichart3d.wasm +0 -0
- package/package.json +1 -1
|
@@ -34,9 +34,9 @@ export interface ILegendModifierOptions extends IChartModifierBaseOptions {
|
|
|
34
34
|
*/
|
|
35
35
|
margin?: number;
|
|
36
36
|
/**
|
|
37
|
-
* The parent div element Id, the Legend will be appended to this element
|
|
37
|
+
* The parent div element Id or reference, the Legend will be appended to this element
|
|
38
38
|
*/
|
|
39
|
-
placementDivId?: string;
|
|
39
|
+
placementDivId?: string | HTMLDivElement;
|
|
40
40
|
}
|
|
41
41
|
/**
|
|
42
42
|
* The LegendModifier provides interactive legend behavior on a 2D {@link SciChartSurface}
|
|
@@ -35,5 +35,11 @@ export declare class SciChartLegend extends SciChartLegendBase {
|
|
|
35
35
|
/** @inheritDoc */
|
|
36
36
|
protected addEventListeners(): void;
|
|
37
37
|
/** @inheritDoc */
|
|
38
|
+
protected removeEventListeners(): void;
|
|
39
|
+
/**
|
|
40
|
+
* adds event listeners to a specific {@link IRenderableSeries} series
|
|
41
|
+
*/
|
|
42
|
+
protected addEventListenerToSeries(rs: IRenderableSeries): void;
|
|
43
|
+
/** @inheritDoc */
|
|
38
44
|
protected getInnerHTML(): string;
|
|
39
45
|
}
|
|
@@ -79,7 +79,36 @@ var SciChartLegend = /** @class */ (function (_super) {
|
|
|
79
79
|
};
|
|
80
80
|
/** @inheritDoc */
|
|
81
81
|
SciChartLegend.prototype.addEventListeners = function () {
|
|
82
|
-
|
|
82
|
+
var _this = this;
|
|
83
|
+
this.renderableSeriesArray.forEach(function (rs) { return _this.addEventListenerToSeries(rs); });
|
|
84
|
+
};
|
|
85
|
+
/** @inheritDoc */
|
|
86
|
+
SciChartLegend.prototype.removeEventListeners = function () {
|
|
87
|
+
var _this = this;
|
|
88
|
+
this.renderableSeriesArray.forEach(function (rs) { return _this.removeEventListenerFromSeries(rs.id); });
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* adds event listeners to a specific {@link IRenderableSeries} series
|
|
92
|
+
*/
|
|
93
|
+
SciChartLegend.prototype.addEventListenerToSeries = function (rs) {
|
|
94
|
+
var el = this.getParentDiv().querySelector("[id='".concat(rs.id, "']"));
|
|
95
|
+
if (el) {
|
|
96
|
+
var onChangeEventListener_1 = function (e) { return (rs.isVisible = e.target.checked); };
|
|
97
|
+
el.addEventListener("change", onChangeEventListener_1);
|
|
98
|
+
var eventSubscriptionItem = {
|
|
99
|
+
element: el,
|
|
100
|
+
eventType: "change",
|
|
101
|
+
eventListener: onChangeEventListener_1,
|
|
102
|
+
delete: function () { return el.removeEventListener("change", onChangeEventListener_1); }
|
|
103
|
+
};
|
|
104
|
+
var eventListenersForRenderableSeries = this.eventListenersCollection.get(rs.id);
|
|
105
|
+
if (eventListenersForRenderableSeries) {
|
|
106
|
+
eventListenersForRenderableSeries.push(eventSubscriptionItem);
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
this.eventListenersCollection.set(rs.id, [eventSubscriptionItem]);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
83
112
|
};
|
|
84
113
|
/** @inheritDoc */
|
|
85
114
|
SciChartLegend.prototype.getInnerHTML = function () {
|
|
@@ -104,15 +133,3 @@ var SciChartLegend = /** @class */ (function (_super) {
|
|
|
104
133
|
return SciChartLegend;
|
|
105
134
|
}(SciChartLegendBase_1.SciChartLegendBase));
|
|
106
135
|
exports.SciChartLegend = SciChartLegend;
|
|
107
|
-
/** @ignore */
|
|
108
|
-
var addEventListenerToSeries = function (rs) {
|
|
109
|
-
var el = document.getElementById(rs.id);
|
|
110
|
-
if (el) {
|
|
111
|
-
// @ts-ignore
|
|
112
|
-
el.addEventListener("change", function (e) { return (rs.isVisible = e.target.checked); });
|
|
113
|
-
}
|
|
114
|
-
};
|
|
115
|
-
/** @ignore */
|
|
116
|
-
var removeEventListenerFromSeries = function (renderableSeriesId) {
|
|
117
|
-
// TODO: to think about how to remove event listeners when removing series
|
|
118
|
-
};
|
|
@@ -10,6 +10,11 @@ export declare type TLegendItem = {
|
|
|
10
10
|
checked: boolean;
|
|
11
11
|
gradient?: GradientParams;
|
|
12
12
|
};
|
|
13
|
+
export interface IEventSubscriptionItem extends IDeletable {
|
|
14
|
+
element: HTMLElement;
|
|
15
|
+
eventType: string;
|
|
16
|
+
eventListener: EventListener;
|
|
17
|
+
}
|
|
13
18
|
/**
|
|
14
19
|
* Enumeration constants to define legend orientation
|
|
15
20
|
*/
|
|
@@ -48,7 +53,8 @@ export declare abstract class SciChartLegendBase implements IDeletable {
|
|
|
48
53
|
protected marginProperty: number;
|
|
49
54
|
protected isDirty: boolean;
|
|
50
55
|
protected parentSurfaceProperty: ISciChartSurfaceBase;
|
|
51
|
-
protected placementDivIdProperty: string;
|
|
56
|
+
protected placementDivIdProperty: string | HTMLDivElement;
|
|
57
|
+
protected eventListenersCollection: Map<string, IEventSubscriptionItem[]>;
|
|
52
58
|
/** @inheritDoc */
|
|
53
59
|
abstract applyTheme(): void;
|
|
54
60
|
setInvalidateParentSurface(value: () => void): void;
|
|
@@ -107,13 +113,13 @@ export declare abstract class SciChartLegendBase implements IDeletable {
|
|
|
107
113
|
*/
|
|
108
114
|
set margin(value: number);
|
|
109
115
|
/**
|
|
110
|
-
* Gets or sets the parent div element for the Legend
|
|
116
|
+
* Gets or sets the parent div element reference or id for the Legend
|
|
111
117
|
*/
|
|
112
|
-
get placementDivId(): string;
|
|
118
|
+
get placementDivId(): string | HTMLDivElement;
|
|
113
119
|
/**
|
|
114
|
-
* Gets or sets the parent div element for the Legend
|
|
120
|
+
* Gets or sets the parent div element reference or id for the Legend
|
|
115
121
|
*/
|
|
116
|
-
set placementDivId(value: string);
|
|
122
|
+
set placementDivId(value: string | HTMLDivElement);
|
|
117
123
|
/** @inheritDoc */
|
|
118
124
|
delete(): void;
|
|
119
125
|
/**
|
|
@@ -156,7 +162,15 @@ export declare abstract class SciChartLegendBase implements IDeletable {
|
|
|
156
162
|
* When overridden in a derived class, will be called when its time to add event listeners to series
|
|
157
163
|
*/
|
|
158
164
|
protected abstract addEventListeners(): void;
|
|
159
|
-
|
|
165
|
+
/**
|
|
166
|
+
* When overridden in a derived class, will be called when its time to remove event listeners from series
|
|
167
|
+
*/
|
|
168
|
+
protected abstract removeEventListeners(): void;
|
|
169
|
+
/**
|
|
170
|
+
* removes event listeners from a specific {@link IRenderableSeries} series
|
|
171
|
+
*/
|
|
172
|
+
protected removeEventListenerFromSeries: (renderableSeriesId: string) => void;
|
|
173
|
+
protected getParentDiv(): HTMLDivElement;
|
|
160
174
|
}
|
|
161
175
|
export declare const getLegendItemHtml: (orientation: ELegendOrientation, showCheckboxes: boolean, showSeriesMarkers: boolean, item: TLegendItem) => string;
|
|
162
176
|
export declare const getLegendContainerHtml: (placement: ELegendPlacement, textColor: string, backgroundColor: string, margin: Thickness, body: string) => string;
|
|
@@ -35,11 +35,24 @@ var ELegendType;
|
|
|
35
35
|
*/
|
|
36
36
|
var SciChartLegendBase = /** @class */ (function () {
|
|
37
37
|
function SciChartLegendBase() {
|
|
38
|
+
var _this = this;
|
|
38
39
|
this.orientationProperty = ELegendOrientation.Vertical;
|
|
39
40
|
this.showLegendProperty = true;
|
|
40
41
|
this.placementProperty = ELegendPlacement.TopLeft;
|
|
41
42
|
this.marginProperty = 10;
|
|
42
43
|
this.isDirty = true;
|
|
44
|
+
this.eventListenersCollection = new Map();
|
|
45
|
+
/**
|
|
46
|
+
* removes event listeners from a specific {@link IRenderableSeries} series
|
|
47
|
+
*/
|
|
48
|
+
this.removeEventListenerFromSeries = function (renderableSeriesId) {
|
|
49
|
+
var _a;
|
|
50
|
+
(_a = _this.eventListenersCollection.get(renderableSeriesId)) === null || _a === void 0 ? void 0 : _a.forEach(function (_a) {
|
|
51
|
+
var element = _a.element, eventListener = _a.eventListener, eventType = _a.eventType;
|
|
52
|
+
element.removeEventListener(eventType, eventListener);
|
|
53
|
+
});
|
|
54
|
+
_this.eventListenersCollection.delete(renderableSeriesId);
|
|
55
|
+
};
|
|
43
56
|
}
|
|
44
57
|
SciChartLegendBase.prototype.setInvalidateParentSurface = function (value) {
|
|
45
58
|
this.invalidateParentSurface = value;
|
|
@@ -156,13 +169,13 @@ var SciChartLegendBase = /** @class */ (function () {
|
|
|
156
169
|
});
|
|
157
170
|
Object.defineProperty(SciChartLegendBase.prototype, "placementDivId", {
|
|
158
171
|
/**
|
|
159
|
-
* Gets or sets the parent div element for the Legend
|
|
172
|
+
* Gets or sets the parent div element reference or id for the Legend
|
|
160
173
|
*/
|
|
161
174
|
get: function () {
|
|
162
175
|
return this.placementDivIdProperty;
|
|
163
176
|
},
|
|
164
177
|
/**
|
|
165
|
-
* Gets or sets the parent div element for the Legend
|
|
178
|
+
* Gets or sets the parent div element reference or id for the Legend
|
|
166
179
|
*/
|
|
167
180
|
set: function (value) {
|
|
168
181
|
this.delete();
|
|
@@ -175,8 +188,8 @@ var SciChartLegendBase = /** @class */ (function () {
|
|
|
175
188
|
/** @inheritDoc */
|
|
176
189
|
SciChartLegendBase.prototype.delete = function () {
|
|
177
190
|
var _a;
|
|
178
|
-
// TODO: remove listeners from renderable series to prevent memory leaks in older browsers
|
|
179
191
|
if (this.div) {
|
|
192
|
+
this.removeEventListeners();
|
|
180
193
|
(_a = this.getParentDiv()) === null || _a === void 0 ? void 0 : _a.removeChild(this.div);
|
|
181
194
|
this.div = undefined;
|
|
182
195
|
}
|
|
@@ -239,7 +252,12 @@ var SciChartLegendBase = /** @class */ (function () {
|
|
|
239
252
|
}
|
|
240
253
|
};
|
|
241
254
|
SciChartLegendBase.prototype.getParentDiv = function () {
|
|
242
|
-
|
|
255
|
+
if (this.placementDivId) {
|
|
256
|
+
return typeof this.placementDivId === "string"
|
|
257
|
+
? document.getElementById(this.placementDivId)
|
|
258
|
+
: this.placementDivId;
|
|
259
|
+
}
|
|
260
|
+
return this.rootDiv;
|
|
243
261
|
};
|
|
244
262
|
return SciChartLegendBase;
|
|
245
263
|
}());
|
|
@@ -95,10 +95,25 @@ var SciChartPieLegend = /** @class */ (function (_super) {
|
|
|
95
95
|
SciChartPieLegend.prototype.addEventListeners = function () {
|
|
96
96
|
var _this = this;
|
|
97
97
|
this.pieSegmentArray.forEach(function (ps) {
|
|
98
|
-
var el =
|
|
99
|
-
|
|
98
|
+
var el = _this.getParentDiv().querySelector("#".concat(getCheckboxId(ps.id)));
|
|
99
|
+
if (!el) {
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
var eventSubscriptionItem = (0, SciChartPieSurface_1.addEventListenerToPieSegment)(ps, el, _this.animate);
|
|
103
|
+
var eventListenersForRenderableSeries = _this.eventListenersCollection.get(ps.id);
|
|
104
|
+
if (eventListenersForRenderableSeries) {
|
|
105
|
+
eventListenersForRenderableSeries.push(eventSubscriptionItem);
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
_this.eventListenersCollection.set(ps.id, [eventSubscriptionItem]);
|
|
109
|
+
}
|
|
100
110
|
});
|
|
101
111
|
};
|
|
112
|
+
/** @inheritDoc */
|
|
113
|
+
SciChartPieLegend.prototype.removeEventListeners = function () {
|
|
114
|
+
var _this = this;
|
|
115
|
+
this.pieSegmentArray.forEach(function (ps) { return _this.removeEventListenerFromSeries(ps.id); });
|
|
116
|
+
};
|
|
102
117
|
/**
|
|
103
118
|
* @inheritDoc
|
|
104
119
|
*/
|
|
@@ -123,7 +138,3 @@ var SciChartPieLegend = /** @class */ (function (_super) {
|
|
|
123
138
|
exports.SciChartPieLegend = SciChartPieLegend;
|
|
124
139
|
/** @ignore */
|
|
125
140
|
var getCheckboxId = function (pieSegmentId) { return "check".concat(pieSegmentId); };
|
|
126
|
-
/** @ignore */
|
|
127
|
-
var removeEventListenerFromSeries = function (renderableSeriesId) {
|
|
128
|
-
// TODO: to think about how to remove event listeners when removing series
|
|
129
|
-
};
|
|
@@ -4,6 +4,7 @@ import { ObservableArray } from "../../../Core/ObservableArray";
|
|
|
4
4
|
import { ESciChartSurfaceType } from "../../../types/SciChartSurfaceType";
|
|
5
5
|
import { TSciChartSurfaceCanvases } from "../../../types/TSciChartSurfaceCanvases";
|
|
6
6
|
import { IThemeProvider } from "../../Themes/IThemeProvider";
|
|
7
|
+
import { IEventSubscriptionItem } from "../Legend/SciChartLegendBase";
|
|
7
8
|
import { SciChartPieLegend } from "../Legend/SciChartPieLegend";
|
|
8
9
|
import { ISciChartSurfaceBase } from "../SciChartSurfaceBase";
|
|
9
10
|
import { IPieSurfaceOptions } from "./IPieSurfaceOptions";
|
|
@@ -45,7 +46,7 @@ export declare class SciChartPieSurface implements ISciChartSurfaceBase {
|
|
|
45
46
|
* @param width Optional - the width of the {@link SciChartPieSurface} in pixels. By default SciChart will scale to fit the parent Div
|
|
46
47
|
* @param height Optional - the height of the {@link SciChartPieSurface} in pixels. By default SciChart will scale to fit the parent Div
|
|
47
48
|
*/
|
|
48
|
-
static create(
|
|
49
|
+
static create(divElement: string | HTMLDivElement, options?: IPieSurfaceOptions): Promise<SciChartPieSurface>;
|
|
49
50
|
/**
|
|
50
51
|
* @summary Gets the collection of {@link IPieSegment} - the pie segments or slices on this {@link SciChartPieSurface}
|
|
51
52
|
* @description A {@link SciChartPieSurface} can have one to many {@link IPieSegment | Pie Segments}. *
|
|
@@ -178,4 +179,4 @@ export declare class SciChartPieSurface implements ISciChartSurfaceBase {
|
|
|
178
179
|
private applySciChartBackground;
|
|
179
180
|
}
|
|
180
181
|
/** @ignore */
|
|
181
|
-
export declare const addEventListenerToPieSegment: (ps: IPieSegment, el: HTMLElement, animate: boolean) =>
|
|
182
|
+
export declare const addEventListenerToPieSegment: (ps: IPieSegment, el: HTMLElement, animate: boolean) => IEventSubscriptionItem;
|
|
@@ -118,10 +118,10 @@ var SciChartPieSurface = /** @class */ (function () {
|
|
|
118
118
|
* @param width Optional - the width of the {@link SciChartPieSurface} in pixels. By default SciChart will scale to fit the parent Div
|
|
119
119
|
* @param height Optional - the height of the {@link SciChartPieSurface} in pixels. By default SciChart will scale to fit the parent Div
|
|
120
120
|
*/
|
|
121
|
-
SciChartPieSurface.create = function (
|
|
121
|
+
SciChartPieSurface.create = function (divElement, options) {
|
|
122
122
|
var _a, _b;
|
|
123
123
|
(0, chartBuilder_1.ensureRegistrations)();
|
|
124
|
-
var canvases = sciChartInitCommon_1.default.initCanvas(
|
|
124
|
+
var canvases = sciChartInitCommon_1.default.initCanvas(divElement, (_a = options === null || options === void 0 ? void 0 : options.widthAspect) !== null && _a !== void 0 ? _a : 0, (_b = options === null || options === void 0 ? void 0 : options.heightAspect) !== null && _b !== void 0 ? _b : 0, sciChartInitCommon_1.default.ECanvasType.svg);
|
|
125
125
|
return new Promise(function (resolve) {
|
|
126
126
|
var conflictingRenderContextDestinations = __spreadArray(__spreadArray(__spreadArray([], createMaster_1.sciChartDestinations, true), createMaster3d_1.sciChartDestinations, true), createSingle_1.sciChartSingleDestinations, true).filter(function (destination) { return destination.sciChartSurface.domChartRoot.id === canvases.domChartRoot.id; });
|
|
127
127
|
conflictingRenderContextDestinations.forEach(function (destination) { return destination.sciChartSurface.delete(); });
|
|
@@ -129,6 +129,7 @@ var SciChartPieSurface = /** @class */ (function () {
|
|
|
129
129
|
var scps = new SciChartPieSurface(canvases, options);
|
|
130
130
|
scps.applyTheme(options === null || options === void 0 ? void 0 : options.theme);
|
|
131
131
|
var unsub = sciChartInitCommon_1.default.subscribeToResize(canvases.domChartRoot, canvases.aspect, scps);
|
|
132
|
+
scps.addDeletable(unsub);
|
|
132
133
|
// setTimeout is used to make function async like createSciChartSurface, to have a consistent API
|
|
133
134
|
setTimeout(function () { return resolve(scps); }, 0);
|
|
134
135
|
});
|
|
@@ -392,8 +393,11 @@ var SciChartPieSurface = /** @class */ (function () {
|
|
|
392
393
|
// ADD EVENT LISTENERS
|
|
393
394
|
if (!app_1.IS_TEST_ENV) {
|
|
394
395
|
this.pieSegments.asArray().forEach(function (ps) {
|
|
395
|
-
var el =
|
|
396
|
-
|
|
396
|
+
var el = _this.domChartRoot.querySelector("[id='".concat(ps.id, "']"));
|
|
397
|
+
if (el) {
|
|
398
|
+
var subscriptionToken = (0, exports.addEventListenerToPieSegment)(ps, el, _this.animate);
|
|
399
|
+
_this.addDeletable(subscriptionToken);
|
|
400
|
+
}
|
|
397
401
|
});
|
|
398
402
|
}
|
|
399
403
|
this.drawSegmentTitles();
|
|
@@ -561,31 +565,36 @@ var calcTitlePosition = function (x, y, outerRadius, innerRadius, a1, a2, delta,
|
|
|
561
565
|
var isListenerBlocked = false;
|
|
562
566
|
/** @ignore */
|
|
563
567
|
var addEventListenerToPieSegment = function (ps, el, animate) {
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
(function
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
568
|
+
var eventListener = function (e) {
|
|
569
|
+
if (!animate) {
|
|
570
|
+
ps.isSelected = !ps.isSelected;
|
|
571
|
+
return;
|
|
572
|
+
}
|
|
573
|
+
// ANIMATE
|
|
574
|
+
if (!isListenerBlocked) {
|
|
575
|
+
var ROUNDS_1 = 10;
|
|
576
|
+
var directionDown = ps.isSelected;
|
|
577
|
+
var start_1 = directionDown ? PieSegment_1.PieSegment.DEFAULT_DELTA : 0;
|
|
578
|
+
var d_1 = directionDown ? -PieSegment_1.PieSegment.DEFAULT_DELTA / ROUNDS_1 : PieSegment_1.PieSegment.DEFAULT_DELTA / ROUNDS_1;
|
|
579
|
+
isListenerBlocked = true;
|
|
580
|
+
(function myLoop(k) {
|
|
581
|
+
setTimeout(function () {
|
|
582
|
+
ps.delta = start_1 + d_1 * k;
|
|
583
|
+
if (k === ROUNDS_1) {
|
|
584
|
+
isListenerBlocked = false;
|
|
585
|
+
}
|
|
586
|
+
if (++k <= ROUNDS_1)
|
|
587
|
+
myLoop(k);
|
|
588
|
+
}, 20);
|
|
589
|
+
})(1);
|
|
590
|
+
}
|
|
591
|
+
};
|
|
592
|
+
el.addEventListener("click", eventListener);
|
|
593
|
+
return {
|
|
594
|
+
eventListener: eventListener,
|
|
595
|
+
eventType: "click",
|
|
596
|
+
element: el,
|
|
597
|
+
delete: function () { return el.removeEventListener("click", eventListener); }
|
|
598
|
+
};
|
|
590
599
|
};
|
|
591
600
|
exports.addEventListenerToPieSegment = addEventListenerToPieSegment;
|
package/Core/BuildStamp.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { TSciChart } from "../types/TSciChart";
|
|
2
2
|
import { TSciChart3D } from "../types/TSciChart3D";
|
|
3
|
-
export declare const libraryVersion = "2.1.
|
|
3
|
+
export declare const libraryVersion = "2.1.2267";
|
|
4
4
|
export declare const checkBuildStamp: (wasmContext: TSciChart | TSciChart3D) => boolean;
|
package/Core/BuildStamp.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.checkBuildStamp = exports.libraryVersion = void 0;
|
|
4
|
-
var buildStamp = "2022-
|
|
4
|
+
var buildStamp = "2022-02-01T00:00:00";
|
|
5
5
|
var result;
|
|
6
6
|
// tslint:disable-next-line:no-var-requires
|
|
7
|
-
exports.libraryVersion = "2.1.
|
|
7
|
+
exports.libraryVersion = "2.1.2267";
|
|
8
8
|
var checkBuildStamp = function (wasmContext) {
|
|
9
9
|
if (result !== undefined)
|
|
10
10
|
return result;
|
package/README.md
CHANGED
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
[SciChart](https://www.scichart.com) provides a High Performance JavaScript & TypeScript Chart library which uses WebGL and WebAssembly to achieve incredible real-time and big-data performance.
|
|
6
6
|
|
|
7
|
+
Open the link to find out [SciChart.js performance compared to other libraries like Chart.js, Highcharts, etc](https://www.scichart.com/javascript-chart-performance-comparison/).
|
|
8
|
+
|
|
7
9
|
SciChart is the _**only viable solution for mission-critical data visualization applications**_, where high quality, fast, and feature-rich charts & graphs are a large part of the application.
|
|
8
10
|
|
|
9
11
|
Whether you are building Dashboards for business, stock-chart or trading apps, scientific or medical apps, or building a kiosk application on custom hardware with Electron, SciChart's ultra-fast 2D/3D WebGL rendering technology codenamed _Visual Xccelerator®_ will let you build apps, services and dashboards with rich charts & graphs that will delight your users.
|
|
@@ -14,6 +16,183 @@ We've prepared a short [Getting Started guide here](https://www.scichart.com/get
|
|
|
14
16
|
|
|
15
17
|
[](https://www.scichart.com/getting-started-scichart-js)
|
|
16
18
|
|
|
19
|
+
## Quick Start with Browser Bundle
|
|
20
|
+
|
|
21
|
+
1. **Make sure you downloaded [the Licensing Wizard](https://www.scichart.com/getting-started-scichart-js) and started trial**
|
|
22
|
+
|
|
23
|
+
Leave the Licensing Wizard running, it is used to validate licenses.
|
|
24
|
+
|
|
25
|
+
2. **Create scichart-example.js file with a simple chart**
|
|
26
|
+
|
|
27
|
+
```javascript
|
|
28
|
+
async function initSciChart() {
|
|
29
|
+
// In order to load data file from the CDN we need to set dataUrl
|
|
30
|
+
SciChart.SciChartSurface.configure({
|
|
31
|
+
dataUrl: "https://cdn.jsdelivr.net/npm/scichart@2.1.2261/_wasm/scichart2d.data",
|
|
32
|
+
wasmUrl: "https://cdn.jsdelivr.net/npm/scichart@2.1.2261/_wasm/scichart2d.wasm"
|
|
33
|
+
});
|
|
34
|
+
// Create a chart using the json builder api
|
|
35
|
+
await SciChart.chartBuilder.buildChart("scichart-root", {
|
|
36
|
+
series: {
|
|
37
|
+
type: "LineSeries",
|
|
38
|
+
options: { stroke: "steelblue" },
|
|
39
|
+
xyData: {
|
|
40
|
+
xValues: [1, 2, 5, 8, 10],
|
|
41
|
+
yValues: [3, 1, 7, 5, 8]
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
initSciChart();
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
See the documentation for [IScichart2Ddefinition](https://www.scichart.com/documentation/js/current/typedoc/interfaces/iscichart2ddefinition.html) for all the options available.
|
|
51
|
+
|
|
52
|
+
3. **Create html file**
|
|
53
|
+
|
|
54
|
+
The file should include **scichart.browser.js** the same version as in the code snippet above, **div element with id "scichart-root"** and deferred **scichart-example.js** script which is executed after the page is loaded.
|
|
55
|
+
|
|
56
|
+
```html
|
|
57
|
+
<!DOCTYPE html>
|
|
58
|
+
<html lang="en">
|
|
59
|
+
<head>
|
|
60
|
+
<meta charset="utf-8" />
|
|
61
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
62
|
+
<!-- Include SciChart.js -->
|
|
63
|
+
<script
|
|
64
|
+
src="https://cdn.jsdelivr.net/npm/scichart@2.1.2261/_wasm/scichart.browser.js"
|
|
65
|
+
crossorigin="anonymous"
|
|
66
|
+
></script>
|
|
67
|
+
<script src="scichart-example.js" defer></script>
|
|
68
|
+
<title>Hello, SciChart.js world!</title>
|
|
69
|
+
</head>
|
|
70
|
+
<body>
|
|
71
|
+
<div id="scichart-root" style="width: 800px; height: 600px;"></div>
|
|
72
|
+
</body>
|
|
73
|
+
</html>
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
4. **Host both files** on any web server. As a result you will see a simple line chart. Please note because we are using WebAssembly just opening the HTML file without a server will not work.
|
|
77
|
+
|
|
78
|
+
Follow [the link](https://github.com/ABTSoftware/SciChart.JS.Examples/tree/master/Sandbox/demo-browser-global-module) to find source code for this example.
|
|
79
|
+
|
|
80
|
+
## Quick Start with NPM and Webpack
|
|
81
|
+
|
|
82
|
+
SciChart.js can be loaded as an ES6 module with Babel or TypeScript transpiler.
|
|
83
|
+
|
|
84
|
+
1. **Make sure you downloaded [the Licensing Wizard](https://www.scichart.com/getting-started-scichart-js) and started trial**
|
|
85
|
+
|
|
86
|
+
Leave the Licensing Wizard running, it is used to validate licenses.
|
|
87
|
+
|
|
88
|
+
2. **Create a new Webpack project** or use an existing one.
|
|
89
|
+
|
|
90
|
+
```shell
|
|
91
|
+
npm init -y
|
|
92
|
+
npm install webpack webpack-cli webpack-dev-server copy-webpack-plugin --save-dev
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
add start script to package.json
|
|
96
|
+
|
|
97
|
+
```
|
|
98
|
+
"scripts": {
|
|
99
|
+
"start": "webpack serve"
|
|
100
|
+
},
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
3. **Install SciChart.js**
|
|
104
|
+
|
|
105
|
+
```shell
|
|
106
|
+
npm i scichart
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
4. **Add webpack.config.js file**
|
|
110
|
+
|
|
111
|
+
Use CopyPlugin to copy wasm and data files and serve them by webpack-dev-server. SciChart.js uses WebAssembly and those files must be loaded.
|
|
112
|
+
|
|
113
|
+
```
|
|
114
|
+
const path = require('path');
|
|
115
|
+
const CopyPlugin = require("copy-webpack-plugin");
|
|
116
|
+
|
|
117
|
+
module.exports = {
|
|
118
|
+
mode: 'development',
|
|
119
|
+
entry: "./src/index.js",
|
|
120
|
+
performance: {
|
|
121
|
+
hints: false
|
|
122
|
+
},
|
|
123
|
+
output: {
|
|
124
|
+
path: path.resolve(__dirname, 'build'),
|
|
125
|
+
filename: 'bundle.js',
|
|
126
|
+
},
|
|
127
|
+
plugins: [
|
|
128
|
+
new CopyPlugin({
|
|
129
|
+
patterns: [
|
|
130
|
+
{ from: "src/index.html", to: "" },
|
|
131
|
+
{ from: "node_modules/scichart/_wasm/scichart2d.data", to: "" },
|
|
132
|
+
{ from: "node_modules/scichart/_wasm/scichart2d.wasm", to: "" }
|
|
133
|
+
]
|
|
134
|
+
})
|
|
135
|
+
]
|
|
136
|
+
};
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
5. **Create a simple chart** by putting this into `src/index.js` file
|
|
140
|
+
|
|
141
|
+
```javascript
|
|
142
|
+
import { SciChartSurface } from "scichart/Charting/Visuals/SciChartSurface";
|
|
143
|
+
import { NumericAxis } from "scichart/Charting/Visuals/Axis/NumericAxis";
|
|
144
|
+
import { XyDataSeries } from "scichart/Charting/Model/XyDataSeries";
|
|
145
|
+
import { FastLineRenderableSeries } from "scichart/Charting/Visuals/RenderableSeries/FastLineRenderableSeries";
|
|
146
|
+
|
|
147
|
+
// You may need this to configure from where wasm and data files are served
|
|
148
|
+
// SciChartSurface.configure({ dataUrl: "/custom/scichart2d.data", wasmUrl: "/other/scichart2d.wasm" });
|
|
149
|
+
|
|
150
|
+
async function initSciChart() {
|
|
151
|
+
// Create the SciChartSurface in the div 'scichart-root'
|
|
152
|
+
// The SciChartSurface, and webassembly context 'wasmContext' are paired. This wasmContext
|
|
153
|
+
// instance must be passed to other types that exist on the same surface.
|
|
154
|
+
const { sciChartSurface, wasmContext } = await SciChartSurface.create("scichart-root");
|
|
155
|
+
|
|
156
|
+
// Create an X,Y Axis and add to the chart
|
|
157
|
+
const yAxis = new NumericAxis(wasmContext);
|
|
158
|
+
sciChartSurface.xAxes.add(xAxis);
|
|
159
|
+
sciChartSurface.yAxes.add(yAxis);
|
|
160
|
+
|
|
161
|
+
const dataSeries = new XyDataSeries(wasmContext, {
|
|
162
|
+
xValues: [1, 2, 5, 8, 10],
|
|
163
|
+
yValues: [3, 1, 7, 5, 8]
|
|
164
|
+
});
|
|
165
|
+
const renderableSeries = new FastLineRenderableSeries(wasmContext, {
|
|
166
|
+
dataSeries,
|
|
167
|
+
stroke: "steelblue"
|
|
168
|
+
});
|
|
169
|
+
sciChartSurface.renderableSeries.add(renderableSeries);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
initSciChart();
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
6. **Create src/index.html file**
|
|
176
|
+
|
|
177
|
+
```html
|
|
178
|
+
<html lang="en-us">
|
|
179
|
+
<head>
|
|
180
|
+
<meta charset="utf-8" />
|
|
181
|
+
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
|
|
182
|
+
<title>SciChart.js Tutorial 1</title>
|
|
183
|
+
<script async type="text/javascript" src="bundle.js"></script>
|
|
184
|
+
</head>
|
|
185
|
+
<body>
|
|
186
|
+
<!-- the Div where the SciChartSurface will reside -->
|
|
187
|
+
<div id="scichart-root" style="width: 800px; height: 600px;"></div>
|
|
188
|
+
</body>
|
|
189
|
+
</html>
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
7. **Run it `npm start`**. As a result you will see a simple line chart.
|
|
193
|
+
|
|
194
|
+
Follow [the link](https://github.com/ABTSoftware/SciChart.JS.Examples/tree/master/Sandbox/demo-simple-chart) to find source code for this example.
|
|
195
|
+
|
|
17
196
|
## Documentation
|
|
18
197
|
|
|
19
198
|
We've taken the time to create hundreds of documentation pages for our JavaScript Charts, which you can find over at https://www.scichart.com/javascript-chart-documentation. Take a look here for tutorials, getting-started guides, API Docs (TypeDoc) and more.
|
|
@@ -26,7 +205,50 @@ An online demo version of scichart.js.examples can be seen at https://demo.scich
|
|
|
26
205
|
|
|
27
206
|
# Release Notes
|
|
28
207
|
|
|
29
|
-
## Version 2
|
|
208
|
+
## Version 2.1 with Major Performance Improvements
|
|
209
|
+
|
|
210
|
+
We’ve used our expertise high performance computing in other platforms of SciChart to make massive improvements to chart rendering, updating and startup speed in SciChart.js v2.1.
|
|
211
|
+
|
|
212
|
+
**Performance improvements**:
|
|
213
|
+
|
|
214
|
+
- Smart Data-point Resampling was implemented. Datapoint resampling ensures the minimum viable data-set is displayed on the screen. Resampling is intended to be visually lossless, and automatic.
|
|
215
|
+
- Improved raw drawing speed of our underlying graphics engine by over 100%
|
|
216
|
+
- Added Async Label Creation option with global application or per-chart caching
|
|
217
|
+
- Optimised data transfers from JavaScript to WebAssembly
|
|
218
|
+
- Improved chart performance when using RolloverModifier and CursorModifier
|
|
219
|
+
- Implementation of Auto-detecting data distribution flags in DataSeries (flags dataSeries.isSorted, dataSeries.containsNaN). Specifying these flags gives better performance in big-data scenarios.
|
|
220
|
+
- Optimizations for Annotation notifyPropertyChange method not to be called if the property has not changed
|
|
221
|
+
- Display performance warnings in dev environment
|
|
222
|
+
- Optimisation getXRange() algorithm for unsorted data
|
|
223
|
+
|
|
224
|
+
**Documentation**:
|
|
225
|
+
|
|
226
|
+
- Added Documentation of how to use SciChart.js in vannilla HTML/Js (without npm) using our Browser Bundle served by CDN
|
|
227
|
+
- Added Documentation for Performance Tips & Tricks
|
|
228
|
+
- Added Documentation for new Data-point Resampling features
|
|
229
|
+
- Added Documentation & Examples for new Generic Animations API
|
|
230
|
+
|
|
231
|
+
**Live demo demo.scichart.com**:
|
|
232
|
+
|
|
233
|
+
- Added Generic Animations example to the Demo app
|
|
234
|
+
|
|
235
|
+
**Other improvements**:
|
|
236
|
+
|
|
237
|
+
- Added labels support outside of a Pie Chart
|
|
238
|
+
- Better error message if wasm cannot be loaded, or the wrong version loaded
|
|
239
|
+
- Add a property to configure stacked axis length
|
|
240
|
+
- Allow passing div element reference into SciChartSurface.create to make SciChart.js possible to use in shadow DOM
|
|
241
|
+
- Improve guard checks for data series creation
|
|
242
|
+
- Snap RolloverModifier vertical line to data points
|
|
243
|
+
- Add explanation error message for trial expired on old version
|
|
244
|
+
- Add AxisRenderer.axisSize property which allows setting axis label width
|
|
245
|
+
- Add includeAxis property to MouseWheelZoomModifier
|
|
246
|
+
- Add AxisRenderer.axisThickness
|
|
247
|
+
- Prevent CursorModifier axis labels to be cut out of the chart
|
|
248
|
+
|
|
249
|
+
See all the details at [SciChart.js v2.1 release](https://www.scichart.com/scichart-js-v2-1-released/).
|
|
250
|
+
|
|
251
|
+
## Version 2.0
|
|
30
252
|
|
|
31
253
|
SciChart.js v2 is a huge release with many new features, improvements and fixes including:
|
|
32
254
|
|