scichart 2.0.2204 → 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/DataPointSelectionModifier.js +0 -1
- package/Charting/ChartModifiers/LegendModifier.d.ts +2 -2
- package/Charting/ChartModifiers/RolloverModifier.d.ts +5 -3
- package/Charting/ChartModifiers/RolloverModifier.js +38 -80
- package/Charting/Drawing/BrushCache.d.ts +8 -2
- package/Charting/Drawing/BrushCache.js +16 -8
- package/Charting/Drawing/WebGlRenderContext2D.d.ts +1 -0
- package/Charting/Drawing/WebGlRenderContext2D.js +4 -1
- package/Charting/LayoutManager/BaseAxisLayoutStrategy.d.ts +2 -0
- package/Charting/LayoutManager/BaseAxisLayoutStrategy.js +33 -0
- package/Charting/LayoutManager/BottomAlignedOuterHorizontallyStackedAxisLayoutStrategy.js +18 -2
- package/Charting/LayoutManager/LeftAlignedOuterVerticallyStackedAxisLayoutStrategy.js +19 -2
- package/Charting/LayoutManager/RightAlignedOuterVerticallyStackedAxisLayoutStrategy.js +18 -2
- package/Charting/LayoutManager/TopAlignedOuterHorizontallyStackedAxisLayoutStrategy.js +18 -2
- package/Charting/Model/BaseDataSeries.d.ts +42 -15
- package/Charting/Model/BaseDataSeries.js +77 -28
- package/Charting/Model/BaseHeatmapDataSeries.d.ts +31 -23
- package/Charting/Model/BaseHeatmapDataSeries.js +45 -18
- package/Charting/Model/DataDistributionCalculator/DataDistributionCalculator.d.ts +23 -0
- package/Charting/Model/DataDistributionCalculator/DataDistributionCalculator.js +122 -0
- package/Charting/Model/DataDistributionCalculator/IDataDistributionCalculator.d.ts +57 -0
- package/Charting/Model/DataDistributionCalculator/IDataDistributionCalculator.js +2 -0
- package/Charting/Model/Filters/OhlcFilterBase.d.ts +2 -2
- package/Charting/Model/Filters/XyFilterBase.d.ts +3 -3
- package/Charting/Model/Filters/XyMovingAverageFilter.js +1 -1
- package/Charting/Model/Filters/XyyFilterBase.d.ts +4 -4
- package/Charting/Model/Filters/XyzFilterBase.d.ts +4 -4
- package/Charting/Model/IDataSeries.d.ts +37 -5
- package/Charting/Model/OhlcDataSeries.d.ts +12 -11
- package/Charting/Model/OhlcDataSeries.js +47 -44
- package/Charting/Model/PointSeries/BasePointSeriesResampled.d.ts +21 -0
- package/Charting/Model/PointSeries/BasePointSeriesResampled.js +56 -0
- package/Charting/Model/PointSeries/BasePointSeriesWrapped.d.ts +14 -0
- package/Charting/Model/PointSeries/BasePointSeriesWrapped.js +23 -0
- package/Charting/Model/PointSeries/IPointSeries.d.ts +31 -0
- package/Charting/Model/PointSeries/IPointSeries.js +2 -0
- package/Charting/Model/PointSeries/OhlcPointSeriesResampled.d.ts +13 -0
- package/Charting/Model/PointSeries/OhlcPointSeriesResampled.js +59 -0
- package/Charting/Model/PointSeries/OhlcPointSeriesWrapped.d.ts +11 -0
- package/Charting/Model/PointSeries/OhlcPointSeriesWrapped.js +32 -0
- package/Charting/Model/PointSeries/XyPointSeriesResampled.d.ts +7 -0
- package/Charting/Model/PointSeries/XyPointSeriesResampled.js +27 -0
- package/Charting/Model/PointSeries/XyPointSeriesWrapped.d.ts +6 -0
- package/Charting/Model/PointSeries/XyPointSeriesWrapped.js +27 -0
- package/Charting/Model/PointSeries/XyyPointSeriesResampled.d.ts +10 -0
- package/Charting/Model/PointSeries/XyyPointSeriesResampled.js +48 -0
- package/Charting/Model/PointSeries/XyyPointSeriesWrapped.d.ts +8 -0
- package/Charting/Model/PointSeries/XyyPointSeriesWrapped.js +29 -0
- package/Charting/Model/PointSeries/XyzPointSeriesWrapped.d.ts +8 -0
- package/Charting/Model/PointSeries/XyzPointSeriesWrapped.js +29 -0
- package/Charting/Model/XyDataSeries.d.ts +3 -2
- package/Charting/Model/XyDataSeries.js +26 -26
- package/Charting/Model/XyyDataSeries.d.ts +5 -5
- package/Charting/Model/XyyDataSeries.js +30 -27
- package/Charting/Model/XyzDataSeries.d.ts +5 -5
- package/Charting/Model/XyzDataSeries.js +30 -27
- package/Charting/Numerics/CoordinateCalculators/CategoryCoordinateCalculator.d.ts +2 -2
- package/Charting/Numerics/CoordinateCalculators/FlippedCategoryCoordinateCalculator.d.ts +2 -2
- package/Charting/Numerics/CoordinateCalculators/FlippedNumericCoordinateCalculator.d.ts +2 -1
- package/Charting/Numerics/CoordinateCalculators/FlippedNumericCoordinateCalculator.js +6 -2
- package/Charting/Numerics/CoordinateCalculators/NumericCoordinateCalculator.d.ts +2 -1
- package/Charting/Numerics/CoordinateCalculators/NumericCoordinateCalculator.js +6 -2
- package/Charting/Numerics/Resamplers/ExtremeResamplerHelper.d.ts +54 -0
- package/Charting/Numerics/Resamplers/ExtremeResamplerHelper.js +234 -0
- package/Charting/Numerics/Resamplers/ResamplingMode.d.ts +37 -0
- package/Charting/Numerics/Resamplers/ResamplingMode.js +41 -0
- package/Charting/Numerics/Resamplers/ResamplingParams.d.ts +39 -0
- package/Charting/Numerics/Resamplers/ResamplingParams.js +52 -0
- package/Charting/Services/RenderPassData.d.ts +6 -1
- package/Charting/Services/RenderPassData.js +5 -1
- package/Charting/Services/RenderPassInfo.d.ts +18 -0
- package/Charting/Services/RenderPassInfo.js +14 -0
- package/Charting/Services/SciChartRenderer.d.ts +14 -1
- package/Charting/Services/SciChartRenderer.js +125 -31
- package/Charting/Visuals/Annotations/AnnotationBase.d.ts +1 -1
- package/Charting/Visuals/Annotations/RolloverMarkerSvgAnnotation.js +1 -1
- package/Charting/Visuals/Annotations/SvgAnnotationBase.js +7 -2
- package/Charting/Visuals/Axis/AxisBase2D.d.ts +23 -0
- package/Charting/Visuals/Axis/AxisBase2D.js +71 -24
- package/Charting/Visuals/Axis/AxisCore.d.ts +11 -0
- package/Charting/Visuals/Axis/AxisCore.js +39 -18
- package/Charting/Visuals/Axis/AxisRenderer.d.ts +1 -0
- package/Charting/Visuals/Axis/AxisRenderer.js +37 -10
- package/Charting/Visuals/Axis/CategoryAxisBase.d.ts +51 -0
- package/Charting/Visuals/Axis/CategoryAxisBase.js +85 -20
- package/Charting/Visuals/Axis/IAxisCoreOptions.d.ts +5 -0
- package/Charting/Visuals/Axis/LabelProvider/SmartDateLabelProvider.js +7 -4
- package/Charting/Visuals/Axis/NumericAxis.js +2 -2
- package/Charting/Visuals/Axis/constants.d.ts +1 -0
- package/Charting/Visuals/Axis/constants.js +1 -0
- 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/RenderableSeries/Animations/FadeAnimation.d.ts +2 -2
- package/Charting/Visuals/RenderableSeries/Animations/ScaleAnimation.d.ts +2 -2
- package/Charting/Visuals/RenderableSeries/Animations/SeriesAnimation.d.ts +3 -3
- package/Charting/Visuals/RenderableSeries/Animations/SweepAnimation.d.ts +2 -2
- package/Charting/Visuals/RenderableSeries/Animations/WaveAnimation.d.ts +2 -2
- package/Charting/Visuals/RenderableSeries/Animations/animationHelpers.d.ts +6 -6
- package/Charting/Visuals/RenderableSeries/Animations/animationHelpers.js +2 -2
- package/Charting/Visuals/RenderableSeries/BaseBandRenderableSeries.d.ts +9 -2
- package/Charting/Visuals/RenderableSeries/BaseBandRenderableSeries.js +45 -1
- package/Charting/Visuals/RenderableSeries/BaseLineRenderableSeries.d.ts +1 -0
- package/Charting/Visuals/RenderableSeries/BaseLineRenderableSeries.js +1 -0
- package/Charting/Visuals/RenderableSeries/BaseMountainRenderableSeries.d.ts +1 -0
- package/Charting/Visuals/RenderableSeries/BaseMountainRenderableSeries.js +1 -0
- package/Charting/Visuals/RenderableSeries/BaseOhlcRenderableSeries.d.ts +12 -5
- package/Charting/Visuals/RenderableSeries/BaseOhlcRenderableSeries.js +113 -0
- package/Charting/Visuals/RenderableSeries/BaseRenderableSeries.d.ts +42 -6
- package/Charting/Visuals/RenderableSeries/BaseRenderableSeries.js +129 -21
- package/Charting/Visuals/RenderableSeries/BaseStackedCollection.d.ts +36 -4
- package/Charting/Visuals/RenderableSeries/BaseStackedCollection.js +51 -3
- package/Charting/Visuals/RenderableSeries/BaseStackedRenderableSeries.d.ts +38 -4
- package/Charting/Visuals/RenderableSeries/BaseStackedRenderableSeries.js +54 -3
- package/Charting/Visuals/RenderableSeries/DrawingProviders/BandSeriesDrawingProvider.d.ts +1 -1
- package/Charting/Visuals/RenderableSeries/DrawingProviders/BandSeriesDrawingProvider.js +8 -14
- package/Charting/Visuals/RenderableSeries/DrawingProviders/BaseSeriesDrawingProvider.js +4 -3
- package/Charting/Visuals/RenderableSeries/DrawingProviders/BubbleSeriesDrawingProvider.js +5 -11
- package/Charting/Visuals/RenderableSeries/DrawingProviders/ColumnSeriesDrawingProvider.d.ts +1 -0
- package/Charting/Visuals/RenderableSeries/DrawingProviders/ColumnSeriesDrawingProvider.js +31 -19
- package/Charting/Visuals/RenderableSeries/DrawingProviders/LineSeriesDrawingProvider.d.ts +2 -1
- package/Charting/Visuals/RenderableSeries/DrawingProviders/LineSeriesDrawingProvider.js +17 -21
- package/Charting/Visuals/RenderableSeries/DrawingProviders/MountainSeriesDrawingProvider.js +16 -15
- package/Charting/Visuals/RenderableSeries/DrawingProviders/OhlcSeriesDrawingProvider.js +9 -15
- package/Charting/Visuals/RenderableSeries/DrawingProviders/PointMarkerDrawingProvider.d.ts +4 -3
- package/Charting/Visuals/RenderableSeries/DrawingProviders/PointMarkerDrawingProvider.js +16 -21
- package/Charting/Visuals/RenderableSeries/DrawingProviders/UniformContoursDrawingProvider.js +2 -9
- package/Charting/Visuals/RenderableSeries/DrawingProviders/UniformHeatmapDrawingProvider.js +0 -7
- package/Charting/Visuals/RenderableSeries/FastBubbleRenderableSeries.d.ts +11 -2
- package/Charting/Visuals/RenderableSeries/FastBubbleRenderableSeries.js +17 -0
- package/Charting/Visuals/RenderableSeries/FastColumnRenderableSeries.d.ts +1 -0
- package/Charting/Visuals/RenderableSeries/FastColumnRenderableSeries.js +1 -0
- package/Charting/Visuals/RenderableSeries/FastLineRenderableSeries.d.ts +1 -0
- package/Charting/Visuals/RenderableSeries/FastLineRenderableSeries.js +6 -0
- package/Charting/Visuals/RenderableSeries/HitTest/BandSeriesHitTestProvider.js +2 -2
- package/Charting/Visuals/RenderableSeries/HitTest/BaseHitTestProvider.js +1 -1
- package/Charting/Visuals/RenderableSeries/HitTest/BubbleSeriesHitTestProvider.js +1 -1
- package/Charting/Visuals/RenderableSeries/HitTest/ColumnSeriesHitTestProvider.js +2 -2
- package/Charting/Visuals/RenderableSeries/HitTest/LineSeriesHitTestProvider.js +2 -2
- package/Charting/Visuals/RenderableSeries/HitTest/MountainSeriesHitTestProvider.js +1 -1
- package/Charting/Visuals/RenderableSeries/HitTest/OhlcSeriesHitTestProvider.js +2 -2
- package/Charting/Visuals/RenderableSeries/HitTest/ScatterSeriesHitTestProvider.js +1 -1
- package/Charting/Visuals/RenderableSeries/HitTest/StackedColumnSeriesHitTestProvider.js +2 -2
- package/Charting/Visuals/RenderableSeries/HitTest/StackedMountainSeriesHitTestProvider.js +2 -2
- package/Charting/Visuals/RenderableSeries/HitTest/hitTestHelpers.d.ts +6 -6
- package/Charting/Visuals/RenderableSeries/HitTest/hitTestHelpers.js +1 -1
- package/Charting/Visuals/RenderableSeries/IBaseRenderableSeriesOptions.d.ts +12 -1
- package/Charting/Visuals/RenderableSeries/IRenderableSeries.d.ts +38 -2
- package/Charting/Visuals/RenderableSeries/ISpline.d.ts +3 -3
- package/Charting/Visuals/RenderableSeries/SplineBandRenderableSeries.d.ts +4 -4
- package/Charting/Visuals/RenderableSeries/SplineBandRenderableSeries.js +5 -5
- package/Charting/Visuals/RenderableSeries/SplineLineRenderableSeries.d.ts +3 -3
- package/Charting/Visuals/RenderableSeries/SplineLineRenderableSeries.js +3 -3
- package/Charting/Visuals/RenderableSeries/SplineMountainRenderableSeries.d.ts +3 -3
- package/Charting/Visuals/RenderableSeries/SplineMountainRenderableSeries.js +3 -3
- package/Charting/Visuals/RenderableSeries/StackedColumnCollection.js +0 -6
- package/Charting/Visuals/RenderableSeries/StackedMountainCollection.d.ts +1 -1
- package/Charting/Visuals/RenderableSeries/StackedMountainCollection.js +1 -7
- package/Charting/Visuals/RenderableSeries/UniformContoursRenderableSeries.d.ts +5 -0
- package/Charting/Visuals/RenderableSeries/UniformContoursRenderableSeries.js +6 -0
- package/Charting/Visuals/RenderableSeries/UniformHeatmapRenderableSeries.d.ts +5 -0
- package/Charting/Visuals/RenderableSeries/UniformHeatmapRenderableSeries.js +6 -0
- package/Charting/Visuals/RenderableSeries/XyScatterRenderableSeries.d.ts +5 -3
- package/Charting/Visuals/RenderableSeries/XyScatterRenderableSeries.js +6 -3
- package/Charting/Visuals/RenderableSeries/constants.d.ts +3 -0
- package/Charting/Visuals/RenderableSeries/constants.js +3 -0
- package/Charting/Visuals/SciChartDefaults.d.ts +9 -1
- package/Charting/Visuals/SciChartDefaults.js +9 -1
- package/Charting/Visuals/SciChartPieSurface/SciChartPieSurface.d.ts +4 -2
- package/Charting/Visuals/SciChartPieSurface/SciChartPieSurface.js +46 -32
- package/Charting/Visuals/SciChartSurface.d.ts +4 -4
- package/Charting/Visuals/SciChartSurface.js +18 -11
- package/Charting/Visuals/SciChartSurfaceBase.d.ts +3 -2
- package/Charting/Visuals/SciChartSurfaceBase.js +4 -4
- package/Charting/Visuals/createMaster.d.ts +1 -1
- package/Charting/Visuals/createMaster.js +11 -6
- package/Charting/Visuals/createSingle.d.ts +1 -1
- package/Charting/Visuals/createSingle.js +2 -2
- package/Charting/Visuals/licenseManager2D.js +21 -20
- package/Charting/Visuals/licenseManager2dState.d.ts +4 -0
- package/Charting/Visuals/licenseManager2dState.js +12 -0
- package/Charting/Visuals/loader.js +2 -0
- package/Charting/Visuals/sciChartInitCommon.d.ts +2 -2
- package/Charting/Visuals/sciChartInitCommon.js +22 -12
- package/Charting3D/Model/DataSeries/XyzDataSeries3D.d.ts +7 -7
- package/Charting3D/Model/DataSeries/XyzDataSeries3D.js +3 -3
- package/Charting3D/Visuals/SciChart3DSurface.d.ts +2 -2
- package/Charting3D/Visuals/SciChart3DSurface.js +3 -3
- package/Charting3D/Visuals/createMaster3d.d.ts +1 -1
- package/Charting3D/Visuals/createMaster3d.js +11 -6
- package/Charting3D/Visuals/createSingle3d.d.ts +1 -1
- package/Charting3D/Visuals/createSingle3d.js +2 -2
- package/Core/BuildStamp.d.ts +1 -1
- package/Core/BuildStamp.js +2 -2
- package/Core/NumberRange.d.ts +1 -0
- package/Core/NumberRange.js +8 -0
- package/Core/OneTimePerformanceWarning.d.ts +6 -0
- package/Core/OneTimePerformanceWarning.js +19 -0
- package/Core/storage/localStorageApi.d.ts +9 -0
- package/Core/storage/localStorageApi.js +32 -0
- 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 +13 -13
- package/_wasm/scichart3d.wasm +0 -0
- package/constants/performanceWarnings.d.ts +5 -0
- package/constants/performanceWarnings.js +8 -0
- package/package.json +1 -1
- package/types/NumberArray.d.ts +1 -0
- package/types/NumberArray.js +5 -1
- package/types/SearchMode.d.ts +21 -0
- package/types/SearchMode.js +25 -0
- package/types/TSciChart.d.ts +144 -40
- package/types/TSciChart3D.d.ts +66 -28
- package/types/TStackedAxisLength.d.ts +4 -0
- package/types/TStackedAxisLength.js +4 -0
- package/utils/array.d.ts +7 -0
- package/utils/array.js +19 -1
- package/utils/calcAverage.d.ts +2 -2
- package/utils/ccall/appendDoubleVectorFromJsArray.d.ts +19 -0
- package/utils/ccall/appendDoubleVectorFromJsArray.js +91 -0
- package/utils/hash.d.ts +7 -0
- package/utils/hash.js +35 -0
- package/utils/tooltip.d.ts +42 -0
- package/utils/tooltip.js +119 -0
- package/utils/ccall/fillDoubleVectorFromJsArray.d.ts +0 -3
- package/utils/ccall/fillDoubleVectorFromJsArray.js +0 -33
- package/utils/performance.d.ts +0 -5
- package/utils/performance.js +0 -11
|
@@ -45,6 +45,7 @@ var AxisRenderer = /** @class */ (function () {
|
|
|
45
45
|
this.hideOverlappingLabelsProperty = true;
|
|
46
46
|
this.webAssemblyContext = webAssemblyContext;
|
|
47
47
|
this.textureManager = new TextureManager_1.TextureManager(webAssemblyContext);
|
|
48
|
+
this.vertices = new webAssemblyContext.VectorColorVertex();
|
|
48
49
|
if (!app_1.IS_TEST_ENV) {
|
|
49
50
|
this.measureTextCanvas = document.createElement("canvas");
|
|
50
51
|
this.measureTextCanvas.width = 1;
|
|
@@ -55,6 +56,7 @@ var AxisRenderer = /** @class */ (function () {
|
|
|
55
56
|
AxisRenderer.prototype.delete = function () {
|
|
56
57
|
this.measureTextCanvas = undefined;
|
|
57
58
|
this.textureManager = (0, Deleter_1.deleteSafe)(this.textureManager);
|
|
59
|
+
this.vertices = (0, Deleter_1.deleteSafe)(this.vertices);
|
|
58
60
|
};
|
|
59
61
|
/**
|
|
60
62
|
* Called when the {@link AxisRenderer} is attached to an {@link AxisBase2D | Axis}
|
|
@@ -311,7 +313,6 @@ var AxisRenderer = /** @class */ (function () {
|
|
|
311
313
|
return;
|
|
312
314
|
var viewRect = this.viewRect;
|
|
313
315
|
var tickSize = tickStyle.tickSize;
|
|
314
|
-
var vertices = new this.webAssemblyContext.VectorColorVertex();
|
|
315
316
|
var isHorizontal = (0, AxisAlignment_1.getIsHorizontal)(axisAlignment);
|
|
316
317
|
if (isHorizontal === undefined) {
|
|
317
318
|
return;
|
|
@@ -347,17 +348,16 @@ var AxisRenderer = /** @class */ (function () {
|
|
|
347
348
|
}
|
|
348
349
|
}
|
|
349
350
|
var vertex = new _this.webAssemblyContext.SCRTColorVertex(x1, y1);
|
|
350
|
-
vertices.push_back(vertex);
|
|
351
|
+
_this.vertices.push_back(vertex);
|
|
351
352
|
vertex.delete();
|
|
352
353
|
var vertex2 = new _this.webAssemblyContext.SCRTColorVertex(x2, y2);
|
|
353
|
-
vertices.push_back(vertex2);
|
|
354
|
+
_this.vertices.push_back(vertex2);
|
|
354
355
|
vertex2.delete();
|
|
355
356
|
});
|
|
356
357
|
var leftOffset = viewRect.left - (isHorizontal ? axisOffset : 0);
|
|
357
358
|
var topOffset = viewRect.top - (isHorizontal ? 0 : axisOffset);
|
|
358
|
-
renderContext.drawLinesNative(vertices, pen, WebGlRenderContext2D_1.ELineDrawMode.DiscontinuousLine, leftOffset, topOffset);
|
|
359
|
-
vertices.clear();
|
|
360
|
-
vertices.delete();
|
|
359
|
+
renderContext.drawLinesNative(this.vertices, pen, WebGlRenderContext2D_1.ELineDrawMode.DiscontinuousLine, leftOffset, topOffset);
|
|
360
|
+
this.vertices.clear();
|
|
361
361
|
};
|
|
362
362
|
/**
|
|
363
363
|
* Called internally - draws axis labels when needed, for example for line annotations
|
|
@@ -367,22 +367,49 @@ var AxisRenderer = /** @class */ (function () {
|
|
|
367
367
|
return undefined;
|
|
368
368
|
var nativeContext = renderContext.getNativeContext();
|
|
369
369
|
var _a = this.textureManager.createSimpleTextTexture(displayValue, __assign(__assign({}, textStyle), { padding: new Thickness_1.Thickness(2, 2, 2, 2) }), fill), bitmapTexture = _a.bitmapTexture, textureHeight = _a.textureHeight, textureWidth = _a.textureWidth;
|
|
370
|
+
var canvas = {
|
|
371
|
+
height: this.parentAxis.parentSurface.domCanvas2D.height,
|
|
372
|
+
width: this.parentAxis.parentSurface.domCanvas2D.width
|
|
373
|
+
};
|
|
374
|
+
var getPosition = function (viewRectSize, coord, canvasSize, textureSize$) {
|
|
375
|
+
if (viewRectSize + coord < textureSize$ / 2) {
|
|
376
|
+
return 0;
|
|
377
|
+
}
|
|
378
|
+
else if (viewRectSize + coord > canvasSize - textureSize$ / 2) {
|
|
379
|
+
return canvasSize - textureSize$;
|
|
380
|
+
}
|
|
381
|
+
else {
|
|
382
|
+
return viewRectSize + coord - textureSize$ / 2;
|
|
383
|
+
}
|
|
384
|
+
};
|
|
370
385
|
var xPosition, yPosition;
|
|
371
386
|
if (axisAlignment === AxisAlignment_1.EAxisAlignment.Bottom) {
|
|
372
|
-
xPosition = this.viewRect.x
|
|
387
|
+
xPosition = getPosition(this.viewRect.x, coord, canvas.width, textureWidth);
|
|
373
388
|
yPosition = this.viewRect.y;
|
|
389
|
+
if (canvas.height - yPosition < textureHeight) {
|
|
390
|
+
yPosition = canvas.height - textureHeight;
|
|
391
|
+
}
|
|
374
392
|
}
|
|
375
393
|
else if (axisAlignment === AxisAlignment_1.EAxisAlignment.Top) {
|
|
376
|
-
xPosition = this.viewRect.x
|
|
394
|
+
xPosition = getPosition(this.viewRect.x, coord, canvas.width, textureWidth);
|
|
377
395
|
yPosition = this.viewRect.y + this.viewRect.height - textureHeight;
|
|
396
|
+
if (this.parentAxis.axisLayoutState.axisSize < textureHeight) {
|
|
397
|
+
yPosition = 0;
|
|
398
|
+
}
|
|
378
399
|
}
|
|
379
400
|
else if (axisAlignment === AxisAlignment_1.EAxisAlignment.Left) {
|
|
380
401
|
xPosition = this.viewRect.x + this.viewRect.width - textureWidth;
|
|
381
|
-
yPosition = this.viewRect.y
|
|
402
|
+
yPosition = getPosition(this.viewRect.y, coord, canvas.height, textureHeight);
|
|
403
|
+
if (this.parentAxis.axisLayoutState.axisSize < textureWidth) {
|
|
404
|
+
xPosition = 0;
|
|
405
|
+
}
|
|
382
406
|
}
|
|
383
407
|
else if (axisAlignment === AxisAlignment_1.EAxisAlignment.Right) {
|
|
384
408
|
xPosition = this.viewRect.x;
|
|
385
|
-
yPosition = this.viewRect.y
|
|
409
|
+
yPosition = getPosition(this.viewRect.y, coord, canvas.height, textureHeight);
|
|
410
|
+
if (canvas.width - xPosition < textureWidth) {
|
|
411
|
+
xPosition = canvas.width - textureWidth;
|
|
412
|
+
}
|
|
386
413
|
}
|
|
387
414
|
nativeContext.DrawTexture(bitmapTexture, Math.round(xPosition), Math.round(yPosition), textureWidth, textureHeight);
|
|
388
415
|
bitmapTexture.delete();
|
|
@@ -6,11 +6,30 @@ import { AxisBase2D, IAxisBase2dOptions } from "./AxisBase2D";
|
|
|
6
6
|
import { ILabel2DOptions } from "./LabelProvider/LabelProviderBase2D";
|
|
7
7
|
export declare type TCategoryCoordCalc = CategoryCoordinateCalculator | FlippedCategoryCoordinateCalculator;
|
|
8
8
|
export interface ICategoryAxisBaseOptions extends IAxisBase2dOptions, ILabel2DOptions {
|
|
9
|
+
/**
|
|
10
|
+
* The default x values to use if no series or data is added to the chart.
|
|
11
|
+
* The tick values shown will depend on the visible range, which for category axis is by index, not by value.
|
|
12
|
+
* eg if you want default values [10, 20, 30, 40] you would need to set visibleRange: new NumberRange(0,3)
|
|
13
|
+
* By default it will start at 0 and increment by 1, up to the size of the visible range.
|
|
14
|
+
* To change the start and step set defaultXStart and defaultXStep
|
|
15
|
+
*/
|
|
16
|
+
defaultXValues?: number[];
|
|
17
|
+
/**
|
|
18
|
+
* The starting value for default x values. See defaultXValues
|
|
19
|
+
*/
|
|
20
|
+
defaultXStart?: number;
|
|
21
|
+
/**
|
|
22
|
+
* The step size for default x values. See defaultXValues
|
|
23
|
+
*/
|
|
24
|
+
defaultXStep?: number;
|
|
9
25
|
}
|
|
10
26
|
/**
|
|
11
27
|
* @summary A 2D Chart Category Axis Base type
|
|
12
28
|
*/
|
|
13
29
|
export declare abstract class CategoryAxisBase extends AxisBase2D {
|
|
30
|
+
private defaultXValuesProperty;
|
|
31
|
+
private defaultXStartProperty;
|
|
32
|
+
private defaultXStepProperty;
|
|
14
33
|
/**
|
|
15
34
|
* Creates an instance of a {@link CategoryAxisBase}
|
|
16
35
|
* @param webAssemblyContext The {@link TSciChart | SciChart 2D WebAssembly Context} containing native methods and
|
|
@@ -22,6 +41,38 @@ export declare abstract class CategoryAxisBase extends AxisBase2D {
|
|
|
22
41
|
* @inheritDoc
|
|
23
42
|
*/
|
|
24
43
|
get isCategoryAxis(): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* The default x values to use if no series or data is added to the chart.
|
|
46
|
+
* The tick values shown will depend on the visible range, which for category axis is by index, not by value.
|
|
47
|
+
* eg if you want default values [10, 20, 30, 40] you would need to set visibleRange: new NumberRange(0,3)
|
|
48
|
+
* By default it will start at 0 and increment by 1, up to the size of the visible range.
|
|
49
|
+
* To change the start and step set defaultXStart and defaultXStep
|
|
50
|
+
*/
|
|
51
|
+
get defaultXValues(): number[];
|
|
52
|
+
/**
|
|
53
|
+
* The default x values to use if no series or data is added to the chart.
|
|
54
|
+
* The tick values shown will depend on the visible range, which for category axis is by index, not by value.
|
|
55
|
+
* eg if you want default values [10, 20, 30, 40] you would need to set visibleRange: new NumberRange(0,3)
|
|
56
|
+
* By default it will start at 0 and increment by 1, up to the size of the visible range.
|
|
57
|
+
* To change the start and step set defaultXStart and defaultXStep
|
|
58
|
+
*/
|
|
59
|
+
set defaultXValues(values: number[]);
|
|
60
|
+
/**
|
|
61
|
+
* The starting value for default x values. See defaultXValues
|
|
62
|
+
*/
|
|
63
|
+
get defaultXStart(): number;
|
|
64
|
+
/**
|
|
65
|
+
* The starting value for default x values. See defaultXValues
|
|
66
|
+
*/
|
|
67
|
+
set defaultXStart(value: number);
|
|
68
|
+
/**
|
|
69
|
+
* The step size for default x values. See defaultXValues
|
|
70
|
+
*/
|
|
71
|
+
get defaultXStep(): number;
|
|
72
|
+
/**
|
|
73
|
+
* The step size for default x values. See defaultXValues
|
|
74
|
+
*/
|
|
75
|
+
set defaultXStep(value: number);
|
|
25
76
|
/**
|
|
26
77
|
* @inheritDoc
|
|
27
78
|
*/
|
|
@@ -19,6 +19,7 @@ exports.CategoryAxisBase = void 0;
|
|
|
19
19
|
var Deleter_1 = require("../../../Core/Deleter");
|
|
20
20
|
var NumberRange_1 = require("../../../Core/NumberRange");
|
|
21
21
|
var SeriesType_1 = require("../../../types/SeriesType");
|
|
22
|
+
var appendDoubleVectorFromJsArray_1 = require("../../../utils/ccall/appendDoubleVectorFromJsArray");
|
|
22
23
|
var CategoryCoordinateCalculator_1 = require("../../Numerics/CoordinateCalculators/CategoryCoordinateCalculator");
|
|
23
24
|
var FlippedCategoryCoordinateCalculator_1 = require("../../Numerics/CoordinateCalculators/FlippedCategoryCoordinateCalculator");
|
|
24
25
|
var NumericTickProvider_1 = require("../../Numerics/TickProviders/NumericTickProvider");
|
|
@@ -36,7 +37,14 @@ var CategoryAxisBase = /** @class */ (function (_super) {
|
|
|
36
37
|
* @param options Optional parameters of type {@link ICategoryAxisBaseOptions} used to configure the axis at instantiation time
|
|
37
38
|
*/
|
|
38
39
|
function CategoryAxisBase(webAssemblyContext, options) {
|
|
40
|
+
var _a, _b, _c;
|
|
39
41
|
var _this = _super.call(this, webAssemblyContext, options) || this;
|
|
42
|
+
_this.defaultXValuesProperty = [];
|
|
43
|
+
_this.defaultXStartProperty = 0;
|
|
44
|
+
_this.defaultXStepProperty = 1;
|
|
45
|
+
_this.defaultXValuesProperty = (_a = options === null || options === void 0 ? void 0 : options.defaultXValues) !== null && _a !== void 0 ? _a : _this.defaultXValuesProperty;
|
|
46
|
+
_this.defaultXStartProperty = (_b = options === null || options === void 0 ? void 0 : options.defaultXStart) !== null && _b !== void 0 ? _b : _this.defaultXStartProperty;
|
|
47
|
+
_this.defaultXStepProperty = (_c = options === null || options === void 0 ? void 0 : options.defaultXStep) !== null && _c !== void 0 ? _c : _this.defaultXStepProperty;
|
|
40
48
|
_this.tickProvider = new NumericTickProvider_1.NumericTickProvider(_this.webAssemblyContext2D);
|
|
41
49
|
_this.deltaCalculator = new CategoryDeltaCalculator_1.CategoryDeltaCalculator(_this.webAssemblyContext2D);
|
|
42
50
|
return _this;
|
|
@@ -51,6 +59,68 @@ var CategoryAxisBase = /** @class */ (function (_super) {
|
|
|
51
59
|
enumerable: false,
|
|
52
60
|
configurable: true
|
|
53
61
|
});
|
|
62
|
+
Object.defineProperty(CategoryAxisBase.prototype, "defaultXValues", {
|
|
63
|
+
/**
|
|
64
|
+
* The default x values to use if no series or data is added to the chart.
|
|
65
|
+
* The tick values shown will depend on the visible range, which for category axis is by index, not by value.
|
|
66
|
+
* eg if you want default values [10, 20, 30, 40] you would need to set visibleRange: new NumberRange(0,3)
|
|
67
|
+
* By default it will start at 0 and increment by 1, up to the size of the visible range.
|
|
68
|
+
* To change the start and step set defaultXStart and defaultXStep
|
|
69
|
+
*/
|
|
70
|
+
get: function () {
|
|
71
|
+
return this.defaultXValuesProperty;
|
|
72
|
+
},
|
|
73
|
+
/**
|
|
74
|
+
* The default x values to use if no series or data is added to the chart.
|
|
75
|
+
* The tick values shown will depend on the visible range, which for category axis is by index, not by value.
|
|
76
|
+
* eg if you want default values [10, 20, 30, 40] you would need to set visibleRange: new NumberRange(0,3)
|
|
77
|
+
* By default it will start at 0 and increment by 1, up to the size of the visible range.
|
|
78
|
+
* To change the start and step set defaultXStart and defaultXStep
|
|
79
|
+
*/
|
|
80
|
+
set: function (values) {
|
|
81
|
+
this.defaultXValuesProperty = values;
|
|
82
|
+
if (this.invalidateParentCallback)
|
|
83
|
+
this.invalidateParentCallback();
|
|
84
|
+
},
|
|
85
|
+
enumerable: false,
|
|
86
|
+
configurable: true
|
|
87
|
+
});
|
|
88
|
+
Object.defineProperty(CategoryAxisBase.prototype, "defaultXStart", {
|
|
89
|
+
/**
|
|
90
|
+
* The starting value for default x values. See defaultXValues
|
|
91
|
+
*/
|
|
92
|
+
get: function () {
|
|
93
|
+
return this.defaultXStartProperty;
|
|
94
|
+
},
|
|
95
|
+
/**
|
|
96
|
+
* The starting value for default x values. See defaultXValues
|
|
97
|
+
*/
|
|
98
|
+
set: function (value) {
|
|
99
|
+
this.defaultXStartProperty = value;
|
|
100
|
+
if (this.invalidateParentCallback)
|
|
101
|
+
this.invalidateParentCallback();
|
|
102
|
+
},
|
|
103
|
+
enumerable: false,
|
|
104
|
+
configurable: true
|
|
105
|
+
});
|
|
106
|
+
Object.defineProperty(CategoryAxisBase.prototype, "defaultXStep", {
|
|
107
|
+
/**
|
|
108
|
+
* The step size for default x values. See defaultXValues
|
|
109
|
+
*/
|
|
110
|
+
get: function () {
|
|
111
|
+
return this.defaultXStepProperty;
|
|
112
|
+
},
|
|
113
|
+
/**
|
|
114
|
+
* The step size for default x values. See defaultXValues
|
|
115
|
+
*/
|
|
116
|
+
set: function (value) {
|
|
117
|
+
this.defaultXStepProperty = value;
|
|
118
|
+
if (this.invalidateParentCallback)
|
|
119
|
+
this.invalidateParentCallback();
|
|
120
|
+
},
|
|
121
|
+
enumerable: false,
|
|
122
|
+
configurable: true
|
|
123
|
+
});
|
|
54
124
|
/**
|
|
55
125
|
* @inheritDoc
|
|
56
126
|
*/
|
|
@@ -60,16 +130,6 @@ var CategoryAxisBase = /** @class */ (function (_super) {
|
|
|
60
130
|
var coordCalc = this.getCurrentCoordinateCalculatorInternal();
|
|
61
131
|
var scs = this.parentSurface;
|
|
62
132
|
var renderableSeries = scs.renderableSeries.asArray().find(function (rs) { return rs.xAxisId === _this.id; });
|
|
63
|
-
if (!renderableSeries) {
|
|
64
|
-
throw new Error("category x axis with id=".concat(this.id, " should have renderable series"));
|
|
65
|
-
}
|
|
66
|
-
if (!renderableSeries.hasDataSeries()) {
|
|
67
|
-
throw new Error("category x axis with id=".concat(this.id, " should have data series"));
|
|
68
|
-
}
|
|
69
|
-
var dataSeriesLength = renderableSeries.getDataSeriesValuesCount();
|
|
70
|
-
if (dataSeriesLength === 0) {
|
|
71
|
-
throw new Error("category x axis with id=".concat(this.id, " should have data series count > 0"));
|
|
72
|
-
}
|
|
73
133
|
this.setBaseXValues(coordCalc, renderableSeries);
|
|
74
134
|
this.coordCalcCache = coordCalc;
|
|
75
135
|
};
|
|
@@ -84,16 +144,6 @@ var CategoryAxisBase = /** @class */ (function (_super) {
|
|
|
84
144
|
var shouldFlip = !(this.isXAxis !== this.flippedCoordinates);
|
|
85
145
|
var scs = this.parentSurface;
|
|
86
146
|
var renderableSeries = scs.renderableSeries.asArray().find(function (rs) { return rs.xAxisId === _this.id; });
|
|
87
|
-
if (!renderableSeries) {
|
|
88
|
-
throw new Error("category x axis with id=".concat(this.id, " should have renderable series"));
|
|
89
|
-
}
|
|
90
|
-
if (!renderableSeries.hasDataSeries()) {
|
|
91
|
-
throw new Error("category x axis with id=".concat(this.id, " should have data series"));
|
|
92
|
-
}
|
|
93
|
-
var dataSeriesLength = renderableSeries.getDataSeriesValuesCount();
|
|
94
|
-
if (dataSeriesLength === 0) {
|
|
95
|
-
throw new Error("category x axis with id=".concat(this.id, " should have data series count > 0"));
|
|
96
|
-
}
|
|
97
147
|
var coordCalc = shouldFlip
|
|
98
148
|
? new FlippedCategoryCoordinateCalculator_1.FlippedCategoryCoordinateCalculator(this.webAssemblyContext2D, size, 0, 0, min, max, this.offset)
|
|
99
149
|
: new CategoryCoordinateCalculator_1.CategoryCoordinateCalculator(this.webAssemblyContext2D, size, 0, 0, min, max, this.offset);
|
|
@@ -128,6 +178,21 @@ var CategoryAxisBase = /** @class */ (function (_super) {
|
|
|
128
178
|
return Math.min(Math.max(1, this.maxAutoTicks), coordCalc.baseXValues.size());
|
|
129
179
|
};
|
|
130
180
|
CategoryAxisBase.prototype.setBaseXValues = function (coordCalc, renderableSeries) {
|
|
181
|
+
var _this = this;
|
|
182
|
+
if (!(renderableSeries === null || renderableSeries === void 0 ? void 0 : renderableSeries.dataSeries)) {
|
|
183
|
+
if (!coordCalc.baseXValues) {
|
|
184
|
+
var defaultBaseXValues = new this.webAssemblyContext2D.SCRTDoubleVector();
|
|
185
|
+
if (this.defaultXValues && this.defaultXValues.length > 0) {
|
|
186
|
+
(0, appendDoubleVectorFromJsArray_1.appendDoubleVectorFromJsArray)(this.webAssemblyContext2D, defaultBaseXValues, this.defaultXValues);
|
|
187
|
+
}
|
|
188
|
+
else {
|
|
189
|
+
var xValues = Array.from(Array(this.visibleRange.diff), function (_, i) { return _this.defaultXStart + i * _this.defaultXStep; });
|
|
190
|
+
(0, appendDoubleVectorFromJsArray_1.appendDoubleVectorFromJsArray)(this.webAssemblyContext2D, defaultBaseXValues, xValues);
|
|
191
|
+
}
|
|
192
|
+
coordCalc.baseXValues = defaultBaseXValues;
|
|
193
|
+
}
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
131
196
|
if (renderableSeries.type === SeriesType_1.ESeriesType.UniformHeatmapSeries) {
|
|
132
197
|
throw Error("Category Axis is not supported for UniformHeatmapRenderableSeries");
|
|
133
198
|
}
|
|
@@ -5,6 +5,11 @@ import { TGridLineStyle, TTextStyle, TTickLineStyle } from "./AxisCore";
|
|
|
5
5
|
* Optional parameters passed to {@link AxisCore} constructor to set defaults at construction time
|
|
6
6
|
*/
|
|
7
7
|
export interface IAxisCoreOptions {
|
|
8
|
+
/**
|
|
9
|
+
* When true, 32-bit faster paths for coordinate calculation maths are used. This improves performance in
|
|
10
|
+
* edge-cases where every CPU cycle counts.
|
|
11
|
+
*/
|
|
12
|
+
allowFastMath?: boolean;
|
|
8
13
|
/**
|
|
9
14
|
* The VisibleRange is the range of the Axis (min to max).
|
|
10
15
|
* @description
|
|
@@ -117,7 +117,8 @@ var SmartDateLabelProvider = /** @class */ (function (_super) {
|
|
|
117
117
|
};
|
|
118
118
|
SmartDateLabelProvider.prototype.formatTradeChartLabel = function (tradeChartLabelFormat, value, prevValue, prevPrevValue) {
|
|
119
119
|
if (tradeChartLabelFormat === ETradeChartLabelFormat.Minutes) {
|
|
120
|
-
var newDate =
|
|
120
|
+
var newDate = prevValue === undefined ||
|
|
121
|
+
(0, date_1.formatUnixDateToHumanStringMMMDD)(value) !== (0, date_1.formatUnixDateToHumanStringMMMDD)(prevValue);
|
|
121
122
|
if (newDate) {
|
|
122
123
|
return (0, date_1.formatUnixDateToHumanStringMMMDD)(value);
|
|
123
124
|
}
|
|
@@ -126,7 +127,8 @@ var SmartDateLabelProvider = /** @class */ (function (_super) {
|
|
|
126
127
|
}
|
|
127
128
|
}
|
|
128
129
|
else if (tradeChartLabelFormat === ETradeChartLabelFormat.Days) {
|
|
129
|
-
var newMonth =
|
|
130
|
+
var newMonth = prevValue === undefined ||
|
|
131
|
+
(0, date_1.formatUnixDateToHumanStringMMM)(value) !== (0, date_1.formatUnixDateToHumanStringMMM)(prevValue);
|
|
130
132
|
if (newMonth) {
|
|
131
133
|
return (0, date_1.formatUnixDateToHumanStringMMM)(value);
|
|
132
134
|
}
|
|
@@ -135,12 +137,13 @@ var SmartDateLabelProvider = /** @class */ (function (_super) {
|
|
|
135
137
|
}
|
|
136
138
|
}
|
|
137
139
|
else if (tradeChartLabelFormat === ETradeChartLabelFormat.Months) {
|
|
138
|
-
var newYear =
|
|
140
|
+
var newYear = prevValue === undefined ||
|
|
141
|
+
(0, date_1.formatUnixDateToHumanStringYYYY)(value) !== (0, date_1.formatUnixDateToHumanStringYYYY)(prevValue);
|
|
139
142
|
if (newYear) {
|
|
140
143
|
return (0, date_1.formatUnixDateToHumanStringYYYY)(value);
|
|
141
144
|
}
|
|
142
145
|
// If previous label was year, display month label
|
|
143
|
-
var prevPrevNewYear =
|
|
146
|
+
var prevPrevNewYear = prevPrevValue === undefined ||
|
|
144
147
|
(0, date_1.formatUnixDateToHumanStringYYYY)(prevValue) !== (0, date_1.formatUnixDateToHumanStringYYYY)(prevPrevValue);
|
|
145
148
|
var newMonth = prevPrevNewYear || (0, date_1.formatUnixDateToHumanStringMMM)(value) !== (0, date_1.formatUnixDateToHumanStringMMM)(prevValue);
|
|
146
149
|
if (newMonth) {
|
|
@@ -58,8 +58,8 @@ var NumericAxis = /** @class */ (function (_super) {
|
|
|
58
58
|
var size = this.axisLength;
|
|
59
59
|
var shouldFlip = this.isXAxis !== this.flippedCoordinatesProperty;
|
|
60
60
|
return shouldFlip
|
|
61
|
-
? new FlippedNumericCoordinateCalculator_1.FlippedNumericCoordinateCalculator(this.webAssemblyContext2D, size, min, max, offset)
|
|
62
|
-
: new NumericCoordinateCalculator_1.NumericCoordinateCalculator(this.webAssemblyContext2D, size, min, max, offset);
|
|
61
|
+
? new FlippedNumericCoordinateCalculator_1.FlippedNumericCoordinateCalculator(this.webAssemblyContext2D, size, min, max, offset, this.allowFastMath)
|
|
62
|
+
: new NumericCoordinateCalculator_1.NumericCoordinateCalculator(this.webAssemblyContext2D, size, min, max, offset, this.allowFastMath);
|
|
63
63
|
};
|
|
64
64
|
return NumericAxis;
|
|
65
65
|
}(AxisBase2D_1.AxisBase2D));
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.PROPERTY = void 0;
|
|
4
4
|
var PROPERTY;
|
|
5
5
|
(function (PROPERTY) {
|
|
6
|
+
PROPERTY["ALLOW_FAST_MATH"] = "ALLOW_FAST_MATH";
|
|
6
7
|
PROPERTY["AUTO_RANGE"] = "AUTO_RANGE";
|
|
7
8
|
PROPERTY["AUTO_TICKS"] = "AUTO_TICKS";
|
|
8
9
|
PROPERTY["AXIS_ALIGNMENT"] = "AXIS_ALIGNMENT";
|
|
@@ -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
|
-
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EAnimationType } from "../../../../types/AnimationType";
|
|
2
|
-
import {
|
|
2
|
+
import { SCRTDoubleVector, TSciChart } from "../../../../types/TSciChart";
|
|
3
3
|
import { SeriesAnimation, IBaseAnimationOptions } from "./SeriesAnimation";
|
|
4
4
|
export interface IFadeAnimationOptions extends IBaseAnimationOptions {
|
|
5
5
|
}
|
|
@@ -8,5 +8,5 @@ export declare class FadeAnimation extends SeriesAnimation {
|
|
|
8
8
|
readonly type = EAnimationType.Fade;
|
|
9
9
|
constructor(options?: IFadeAnimationOptions);
|
|
10
10
|
/** @inheritDoc */
|
|
11
|
-
calculateAnimationValues(wasmContext: TSciChart, originalValues:
|
|
11
|
+
calculateAnimationValues(wasmContext: TSciChart, originalValues: SCRTDoubleVector, animationValues: SCRTDoubleVector, progress: number, noZeroLine?: boolean): void;
|
|
12
12
|
}
|