@amcharts/amcharts5 5.14.4 → 5.15.1
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/.internal/charts/flow/FlowNodes.d.ts +1 -0
- package/.internal/charts/flow/FlowNodes.d.ts.map +1 -1
- package/.internal/charts/flow/FlowNodes.js +7 -0
- package/.internal/charts/flow/FlowNodes.js.map +1 -1
- package/.internal/charts/gantt/Gantt.d.ts +1 -0
- package/.internal/charts/gantt/Gantt.d.ts.map +1 -1
- package/.internal/charts/gantt/Gantt.js +7 -0
- package/.internal/charts/gantt/Gantt.js.map +1 -1
- package/.internal/charts/gantt/GanttCategoryAxis.d.ts +1 -0
- package/.internal/charts/gantt/GanttCategoryAxis.d.ts.map +1 -1
- package/.internal/charts/gantt/GanttCategoryAxis.js +7 -0
- package/.internal/charts/gantt/GanttCategoryAxis.js.map +1 -1
- package/.internal/charts/hierarchy/Hierarchy.d.ts +1 -0
- package/.internal/charts/hierarchy/Hierarchy.d.ts.map +1 -1
- package/.internal/charts/hierarchy/Hierarchy.js +7 -0
- package/.internal/charts/hierarchy/Hierarchy.js.map +1 -1
- package/.internal/charts/map/ClusteredPointSeries.d.ts +2 -2
- package/.internal/charts/map/ClusteredPointSeries.d.ts.map +1 -1
- package/.internal/charts/map/ClusteredPointSeries.js.map +1 -1
- package/.internal/charts/percent/PercentSeries.d.ts +1 -0
- package/.internal/charts/percent/PercentSeries.d.ts.map +1 -1
- package/.internal/charts/percent/PercentSeries.js +7 -0
- package/.internal/charts/percent/PercentSeries.js.map +1 -1
- package/.internal/charts/stock/indicators/AccelerationBands.js +3 -3
- package/.internal/charts/stock/indicators/AccelerationBands.js.map +1 -1
- package/.internal/charts/stock/indicators/AccumulationDistribution.js +1 -1
- package/.internal/charts/stock/indicators/AccumulationDistribution.js.map +1 -1
- package/.internal/charts/stock/indicators/AccumulativeSwingIndex.js +1 -1
- package/.internal/charts/stock/indicators/AccumulativeSwingIndex.js.map +1 -1
- package/.internal/charts/stock/indicators/Aroon.js +2 -2
- package/.internal/charts/stock/indicators/Aroon.js.map +1 -1
- package/.internal/charts/stock/indicators/AverageTrueRange.js +1 -1
- package/.internal/charts/stock/indicators/AverageTrueRange.js.map +1 -1
- package/.internal/charts/stock/indicators/AwesomeOscillator.js +1 -1
- package/.internal/charts/stock/indicators/AwesomeOscillator.js.map +1 -1
- package/.internal/charts/stock/indicators/BollingerBands.js +2 -2
- package/.internal/charts/stock/indicators/BollingerBands.js.map +1 -1
- package/.internal/charts/stock/indicators/BullBearPower.js +1 -1
- package/.internal/charts/stock/indicators/BullBearPower.js.map +1 -1
- package/.internal/charts/stock/indicators/ChaikinMoneyFlow.js +1 -1
- package/.internal/charts/stock/indicators/ChaikinMoneyFlow.js.map +1 -1
- package/.internal/charts/stock/indicators/ChaikinOscillator.js +1 -1
- package/.internal/charts/stock/indicators/ChaikinOscillator.js.map +1 -1
- package/.internal/charts/stock/indicators/CommodityChannelIndex.js +1 -1
- package/.internal/charts/stock/indicators/CommodityChannelIndex.js.map +1 -1
- package/.internal/charts/stock/indicators/DisparityIndex.js +1 -1
- package/.internal/charts/stock/indicators/DisparityIndex.js.map +1 -1
- package/.internal/charts/stock/indicators/HeikinAshi.js +1 -1
- package/.internal/charts/stock/indicators/HeikinAshi.js.map +1 -1
- package/.internal/charts/stock/indicators/MACD.js +3 -3
- package/.internal/charts/stock/indicators/MACD.js.map +1 -1
- package/.internal/charts/stock/indicators/MACross.js +2 -2
- package/.internal/charts/stock/indicators/MACross.js.map +1 -1
- package/.internal/charts/stock/indicators/MedianPrice.js +1 -1
- package/.internal/charts/stock/indicators/MedianPrice.js.map +1 -1
- package/.internal/charts/stock/indicators/Momentum.js +1 -1
- package/.internal/charts/stock/indicators/Momentum.js.map +1 -1
- package/.internal/charts/stock/indicators/MovingAverage.js +1 -1
- package/.internal/charts/stock/indicators/MovingAverage.js.map +1 -1
- package/.internal/charts/stock/indicators/MovingAverageDeviation.js +1 -1
- package/.internal/charts/stock/indicators/MovingAverageDeviation.js.map +1 -1
- package/.internal/charts/stock/indicators/MovingAverageEnvelope.js +2 -2
- package/.internal/charts/stock/indicators/MovingAverageEnvelope.js.map +1 -1
- package/.internal/charts/stock/indicators/OnBalanceVolume.js +1 -1
- package/.internal/charts/stock/indicators/OnBalanceVolume.js.map +1 -1
- package/.internal/charts/stock/indicators/PVT.js +1 -1
- package/.internal/charts/stock/indicators/PVT.js.map +1 -1
- package/.internal/charts/stock/indicators/RelativeStrengthIndex.js +3 -3
- package/.internal/charts/stock/indicators/RelativeStrengthIndex.js.map +1 -1
- package/.internal/charts/stock/indicators/StandardDeviation.js +1 -1
- package/.internal/charts/stock/indicators/StandardDeviation.js.map +1 -1
- package/.internal/charts/stock/indicators/StochasticMomentumIndex.js +2 -2
- package/.internal/charts/stock/indicators/StochasticMomentumIndex.js.map +1 -1
- package/.internal/charts/stock/indicators/StochasticOscillator.js +2 -2
- package/.internal/charts/stock/indicators/StochasticOscillator.js.map +1 -1
- package/.internal/charts/stock/indicators/SuperTrend.js +2 -2
- package/.internal/charts/stock/indicators/SuperTrend.js.map +1 -1
- package/.internal/charts/stock/indicators/Trix.js +2 -2
- package/.internal/charts/stock/indicators/Trix.js.map +1 -1
- package/.internal/charts/stock/indicators/TypicalPrice.js +1 -1
- package/.internal/charts/stock/indicators/TypicalPrice.js.map +1 -1
- package/.internal/charts/stock/indicators/VWAP.js +1 -1
- package/.internal/charts/stock/indicators/VWAP.js.map +1 -1
- package/.internal/charts/stock/indicators/Volume.d.ts.map +1 -1
- package/.internal/charts/stock/indicators/Volume.js +1 -1
- package/.internal/charts/stock/indicators/Volume.js.map +1 -1
- package/.internal/charts/stock/indicators/VolumeProfile.d.ts.map +1 -1
- package/.internal/charts/stock/indicators/VolumeProfile.js +1 -0
- package/.internal/charts/stock/indicators/VolumeProfile.js.map +1 -1
- package/.internal/charts/stock/indicators/WilliamsR.js +1 -1
- package/.internal/charts/stock/indicators/WilliamsR.js.map +1 -1
- package/.internal/charts/stock/indicators/ZigZag.js +1 -1
- package/.internal/charts/stock/indicators/ZigZag.js.map +1 -1
- package/.internal/charts/stock/toolbar/DrawingControl.d.ts +1 -0
- package/.internal/charts/stock/toolbar/DrawingControl.d.ts.map +1 -1
- package/.internal/charts/stock/toolbar/DrawingControl.js +8 -1
- package/.internal/charts/stock/toolbar/DrawingControl.js.map +1 -1
- package/.internal/charts/venn/Venn.d.ts +1 -0
- package/.internal/charts/venn/Venn.d.ts.map +1 -1
- package/.internal/charts/venn/Venn.js +7 -0
- package/.internal/charts/venn/Venn.js.map +1 -1
- package/.internal/charts/xy/XYChart.d.ts +1 -0
- package/.internal/charts/xy/XYChart.d.ts.map +1 -1
- package/.internal/charts/xy/XYChart.js +8 -0
- package/.internal/charts/xy/XYChart.js.map +1 -1
- package/.internal/charts/xy/axes/AxisRenderer.d.ts.map +1 -1
- package/.internal/charts/xy/axes/AxisRenderer.js +6 -1
- package/.internal/charts/xy/axes/AxisRenderer.js.map +1 -1
- package/.internal/charts/xy/axes/DateAxis.js +10 -10
- package/.internal/charts/xy/axes/DateAxis.js.map +1 -1
- package/.internal/charts/xy/axes/GaplessDateAxis.d.ts.map +1 -1
- package/.internal/charts/xy/axes/GaplessDateAxis.js +5 -4
- package/.internal/charts/xy/axes/GaplessDateAxis.js.map +1 -1
- package/.internal/charts/xy/series/BaseColumnSeries.d.ts.map +1 -1
- package/.internal/charts/xy/series/BaseColumnSeries.js +19 -19
- package/.internal/charts/xy/series/BaseColumnSeries.js.map +1 -1
- package/.internal/charts/xy/series/CandlestickSeries.d.ts.map +1 -1
- package/.internal/charts/xy/series/CandlestickSeries.js +0 -1
- package/.internal/charts/xy/series/CandlestickSeries.js.map +1 -1
- package/.internal/charts/xy/series/LineSeries.d.ts.map +1 -1
- package/.internal/charts/xy/series/LineSeries.js +8 -6
- package/.internal/charts/xy/series/LineSeries.js.map +1 -1
- package/.internal/charts/xy/series/XYSeries.d.ts +2 -0
- package/.internal/charts/xy/series/XYSeries.d.ts.map +1 -1
- package/.internal/charts/xy/series/XYSeries.js +22 -8
- package/.internal/charts/xy/series/XYSeries.js.map +1 -1
- package/.internal/core/Registry.js +1 -1
- package/.internal/core/Registry.js.map +1 -1
- package/.internal/core/Root.d.ts.map +1 -1
- package/.internal/core/Root.js +35 -2
- package/.internal/core/Root.js.map +1 -1
- package/.internal/core/render/Component.d.ts +5 -0
- package/.internal/core/render/Component.d.ts.map +1 -1
- package/.internal/core/render/Component.js +41 -0
- package/.internal/core/render/Component.js.map +1 -1
- package/.internal/core/render/Container.d.ts +1 -1
- package/.internal/core/render/Container.d.ts.map +1 -1
- package/.internal/core/render/Container.js +3 -3
- package/.internal/core/render/Container.js.map +1 -1
- package/.internal/core/render/Series.d.ts.map +1 -1
- package/.internal/core/render/Series.js +12 -9
- package/.internal/core/render/Series.js.map +1 -1
- package/.internal/plugins/json/ChartSerializer.d.ts +82 -0
- package/.internal/plugins/json/ChartSerializer.d.ts.map +1 -0
- package/.internal/plugins/json/ChartSerializer.js +782 -0
- package/.internal/plugins/json/ChartSerializer.js.map +1 -0
- package/.internal/plugins/json/Json.d.ts.map +1 -1
- package/.internal/plugins/json/Json.js +178 -54
- package/.internal/plugins/json/Json.js.map +1 -1
- package/.internal/plugins/json/Serializer.d.ts +40 -6
- package/.internal/plugins/json/Serializer.d.ts.map +1 -1
- package/.internal/plugins/json/Serializer.js +97 -24
- package/.internal/plugins/json/Serializer.js.map +1 -1
- package/CHANGELOG.md +22 -0
- package/examples/javascript/flow-arc-horizontal/package.json +1 -1
- package/examples/javascript/flow-arc-vertical/package.json +1 -1
- package/examples/javascript/flow-chord/package.json +1 -1
- package/examples/javascript/flow-chord-directed/package.json +1 -1
- package/examples/javascript/flow-chord-non-ribbon/package.json +1 -1
- package/examples/javascript/flow-sankey/package.json +1 -1
- package/examples/javascript/gantt/package.json +1 -1
- package/examples/javascript/gantt-multilevel/package.json +1 -1
- package/examples/javascript/gantt-simple/package.json +1 -1
- package/examples/javascript/gauge/package.json +1 -1
- package/examples/javascript/gauge-bands/package.json +1 -1
- package/examples/javascript/hierarchy-force-directed/package.json +1 -1
- package/examples/javascript/hierarchy-pack/package.json +1 -1
- package/examples/javascript/hierarchy-partition/package.json +1 -1
- package/examples/javascript/hierarchy-sunburst/package.json +1 -1
- package/examples/javascript/hierarchy-tree/package.json +1 -1
- package/examples/javascript/hierarchy-treemap/package.json +1 -1
- package/examples/javascript/hierarchy-voronoi-treemap/package.json +1 -1
- package/examples/javascript/jest/package.json +1 -1
- package/examples/javascript/json-pie/package.json +1 -1
- package/examples/javascript/json-xy/package.json +1 -1
- package/examples/javascript/map-animating-along-lines/package.json +1 -1
- package/examples/javascript/map-clustered-points/package.json +1 -1
- package/examples/javascript/map-day-and-night/package.json +1 -1
- package/examples/javascript/map-globe-rotate-to-country/package.json +1 -1
- package/examples/javascript/map-globe-with-projected-circles/package.json +1 -1
- package/examples/javascript/map-with-bubbles/package.json +1 -1
- package/examples/javascript/map-zoom-to-country/package.json +1 -1
- package/examples/javascript/misc-40-charts/package.json +1 -1
- package/examples/javascript/misc-microchart-grid/package.json +1 -1
- package/examples/javascript/pie-chart/package.json +1 -1
- package/examples/javascript/pie-donut-chart/package.json +1 -1
- package/examples/javascript/pie-variable-radius/package.json +1 -1
- package/examples/javascript/radar-column-iwatch-style/package.json +1 -1
- package/examples/javascript/radar-heat-map/package.json +1 -1
- package/examples/javascript/radar-line/package.json +1 -1
- package/examples/javascript/radar-time-line/package.json +1 -1
- package/examples/javascript/sliced-funnel/package.json +1 -1
- package/examples/javascript/sliced-pictorial-stacked/package.json +1 -1
- package/examples/javascript/sliced-pyramid/package.json +1 -1
- package/examples/javascript/stock-chart/package.json +1 -1
- package/examples/javascript/stock-chart-comparing-stocks/package.json +1 -1
- package/examples/javascript/stock-chart-data-granularity/package.json +1 -1
- package/examples/javascript/stock-chart-data-grouping/package.json +1 -1
- package/examples/javascript/stock-chart-intraday/package.json +1 -1
- package/examples/javascript/stock-chart-live/package.json +1 -1
- package/examples/javascript/stock-chart-volume-separate-panel/package.json +1 -1
- package/examples/javascript/timeline-horizontal-serpentine-chart/package.json +1 -1
- package/examples/javascript/timeline-linear-process-diagram/package.json +1 -1
- package/examples/javascript/timeline-serpentine-chart/package.json +1 -1
- package/examples/javascript/timeline-spiral-chart/package.json +1 -1
- package/examples/javascript/venn-diagram/package.json +1 -1
- package/examples/javascript/wordcloud-with-data/package.json +1 -1
- package/examples/javascript/wordcloud-with-text/package.json +1 -1
- package/examples/javascript/xy-100-percent-stacked-column/package.json +1 -1
- package/examples/javascript/xy-animated-bullet-at-the-end-of-the-series/package.json +1 -1
- package/examples/javascript/xy-bubble/package.json +1 -1
- package/examples/javascript/xy-candlestick/package.json +1 -1
- package/examples/javascript/xy-clustered-column/package.json +1 -1
- package/examples/javascript/xy-column/package.json +1 -1
- package/examples/javascript/xy-comparing-series-google-analytics-style/package.json +1 -1
- package/examples/javascript/xy-data-grouping/package.json +1 -1
- package/examples/javascript/xy-draggable-range/package.json +1 -1
- package/examples/javascript/xy-drawing-series-with-mouse-or-touch/package.json +1 -1
- package/examples/javascript/xy-dumbbell plot/package.json +1 -1
- package/examples/javascript/xy-evenly-spaced-date-axis/package.json +1 -1
- package/examples/javascript/xy-line/package.json +1 -1
- package/examples/javascript/xy-line-highlight-on-legend-hover/package.json +1 -1
- package/examples/javascript/xy-live-data/package.json +1 -1
- package/examples/javascript/xy-multiple-synced-value-axes/package.json +1 -1
- package/examples/javascript/xy-ohlc/package.json +1 -1
- package/examples/javascript/xy-real-time-data-sorting/package.json +1 -1
- package/examples/javascript/xy-smoothed-line/package.json +1 -1
- package/examples/javascript/xy-stacked-and-clustered-column/package.json +1 -1
- package/examples/javascript/xy-stacked-column/package.json +1 -1
- package/examples/javascript/xy-stacked-step/package.json +1 -1
- package/examples/javascript/xy-stock/package.json +1 -1
- package/examples/javascript/xy-stock-comparing/package.json +1 -1
- package/examples/typescript/flow-arc-horizontal/package.json +1 -1
- package/examples/typescript/flow-arc-vertical/package.json +1 -1
- package/examples/typescript/flow-chord/package.json +1 -1
- package/examples/typescript/flow-chord-directed/package.json +1 -1
- package/examples/typescript/flow-chord-non-ribbon/package.json +1 -1
- package/examples/typescript/flow-sankey/package.json +1 -1
- package/examples/typescript/gantt/package.json +1 -1
- package/examples/typescript/gantt-multilevel/package.json +1 -1
- package/examples/typescript/gantt-simple/package.json +1 -1
- package/examples/typescript/gauge/package.json +1 -1
- package/examples/typescript/gauge-bands/package.json +1 -1
- package/examples/typescript/hierarchy-force-directed/package.json +1 -1
- package/examples/typescript/hierarchy-pack/package.json +1 -1
- package/examples/typescript/hierarchy-partition/package.json +1 -1
- package/examples/typescript/hierarchy-sunburst/package.json +1 -1
- package/examples/typescript/hierarchy-tree/package.json +1 -1
- package/examples/typescript/hierarchy-treemap/package.json +1 -1
- package/examples/typescript/hierarchy-voronoi-treemap/package.json +1 -1
- package/examples/typescript/jest/package.json +1 -1
- package/examples/typescript/json-pie/package.json +1 -1
- package/examples/typescript/json-xy/package.json +1 -1
- package/examples/typescript/map-animating-along-lines/package.json +1 -1
- package/examples/typescript/map-clustered-points/package.json +1 -1
- package/examples/typescript/map-day-and-night/package.json +1 -1
- package/examples/typescript/map-globe-rotate-to-country/package.json +1 -1
- package/examples/typescript/map-globe-with-projected-circles/package.json +1 -1
- package/examples/typescript/map-with-bubbles/package.json +1 -1
- package/examples/typescript/map-zoom-to-country/package.json +1 -1
- package/examples/typescript/misc-40-charts/package.json +1 -1
- package/examples/typescript/misc-microchart-grid/package.json +1 -1
- package/examples/typescript/pie-chart/package.json +1 -1
- package/examples/typescript/pie-donut-chart/package.json +1 -1
- package/examples/typescript/pie-variable-radius/package.json +1 -1
- package/examples/typescript/radar-column-iwatch-style/package.json +1 -1
- package/examples/typescript/radar-heat-map/package.json +1 -1
- package/examples/typescript/radar-line/package.json +1 -1
- package/examples/typescript/radar-time-line/package.json +1 -1
- package/examples/typescript/sliced-funnel/package.json +1 -1
- package/examples/typescript/sliced-pictorial-stacked/package.json +1 -1
- package/examples/typescript/sliced-pyramid/package.json +1 -1
- package/examples/typescript/stock-chart/package.json +1 -1
- package/examples/typescript/stock-chart-comparing-stocks/package.json +1 -1
- package/examples/typescript/stock-chart-data-granularity/package.json +1 -1
- package/examples/typescript/stock-chart-data-grouping/package.json +1 -1
- package/examples/typescript/stock-chart-intraday/package.json +1 -1
- package/examples/typescript/stock-chart-live/package.json +1 -1
- package/examples/typescript/stock-chart-volume-separate-panel/package.json +1 -1
- package/examples/typescript/timeline-horizontal-serpentine-chart/package.json +1 -1
- package/examples/typescript/timeline-linear-process-diagram/package.json +1 -1
- package/examples/typescript/timeline-serpentine-chart/package.json +1 -1
- package/examples/typescript/timeline-spiral-chart/package.json +1 -1
- package/examples/typescript/venn-diagram/package.json +1 -1
- package/examples/typescript/wordcloud-with-data/package.json +1 -1
- package/examples/typescript/wordcloud-with-text/package.json +1 -1
- package/examples/typescript/xy-100-percent-stacked-column/package.json +1 -1
- package/examples/typescript/xy-animated-bullet-at-the-end-of-the-series/package.json +1 -1
- package/examples/typescript/xy-bubble/package.json +1 -1
- package/examples/typescript/xy-candlestick/package.json +1 -1
- package/examples/typescript/xy-clustered-column/package.json +1 -1
- package/examples/typescript/xy-column/package.json +1 -1
- package/examples/typescript/xy-comparing-series-google-analytics-style/package.json +1 -1
- package/examples/typescript/xy-data-grouping/package.json +1 -1
- package/examples/typescript/xy-draggable-range/package.json +1 -1
- package/examples/typescript/xy-drawing-series-with-mouse-or-touch/package.json +1 -1
- package/examples/typescript/xy-dumbbell plot/package.json +1 -1
- package/examples/typescript/xy-evenly-spaced-date-axis/package.json +1 -1
- package/examples/typescript/xy-line/package.json +1 -1
- package/examples/typescript/xy-line-highlight-on-legend-hover/package.json +1 -1
- package/examples/typescript/xy-live-data/package.json +1 -1
- package/examples/typescript/xy-multiple-synced-value-axes/package.json +1 -1
- package/examples/typescript/xy-ohlc/package.json +1 -1
- package/examples/typescript/xy-real-time-data-sorting/package.json +1 -1
- package/examples/typescript/xy-smoothed-line/package.json +1 -1
- package/examples/typescript/xy-stacked-and-clustered-column/package.json +1 -1
- package/examples/typescript/xy-stacked-column/package.json +1 -1
- package/examples/typescript/xy-stacked-step/package.json +1 -1
- package/examples/typescript/xy-stock/package.json +1 -1
- package/examples/typescript/xy-stock-comparing/package.json +1 -1
- package/package.json +4 -4
- package/plugins/json.d.ts +1 -0
- package/plugins/json.d.ts.map +1 -1
- package/plugins/json.js +1 -0
- package/plugins/json.js.map +1 -1
|
@@ -0,0 +1,782 @@
|
|
|
1
|
+
import { Entity } from "../../core/util/Entity";
|
|
2
|
+
import { Container } from "../../core/render/Container";
|
|
3
|
+
import { DataItem } from "../../core/render/Component";
|
|
4
|
+
import { ListTemplate } from "../../core/util/List";
|
|
5
|
+
import { Serializer } from "./Serializer";
|
|
6
|
+
import * as $object from "../../core/util/Object";
|
|
7
|
+
import * as $type from "../../core/util/Type";
|
|
8
|
+
import * as $array from "../../core/util/Array";
|
|
9
|
+
/**
|
|
10
|
+
* Serializes whole charts into simple objects or JSON.
|
|
11
|
+
*
|
|
12
|
+
* @see {@link https://www.amcharts.com/docs/v5/concepts/serializing/chart-serializer/} for more info
|
|
13
|
+
* @since 5.15.0
|
|
14
|
+
*/
|
|
15
|
+
export class ChartSerializer extends Serializer {
|
|
16
|
+
constructor() {
|
|
17
|
+
super(...arguments);
|
|
18
|
+
Object.defineProperty(this, "_disableDataSerialization", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
configurable: true,
|
|
21
|
+
writable: true,
|
|
22
|
+
value: false
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(this, "_globalRefs", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
configurable: true,
|
|
27
|
+
writable: true,
|
|
28
|
+
value: []
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(this, "_internalRefs", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
configurable: true,
|
|
33
|
+
writable: true,
|
|
34
|
+
value: {}
|
|
35
|
+
});
|
|
36
|
+
Object.defineProperty(this, "_counters", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
configurable: true,
|
|
39
|
+
writable: true,
|
|
40
|
+
value: {}
|
|
41
|
+
});
|
|
42
|
+
Object.defineProperty(this, "_lists", {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
configurable: true,
|
|
45
|
+
writable: true,
|
|
46
|
+
value: {}
|
|
47
|
+
});
|
|
48
|
+
Object.defineProperty(this, "_mainRefs", {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
configurable: true,
|
|
51
|
+
writable: true,
|
|
52
|
+
value: {}
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
_afterNew() {
|
|
56
|
+
super._afterNew();
|
|
57
|
+
this._setSoft("maxDepth", 10);
|
|
58
|
+
this._setSoft("removeEmptyObjects", true);
|
|
59
|
+
this._setSoft("includeEvents", true);
|
|
60
|
+
this._setSoft("includeAdapters", true);
|
|
61
|
+
this._setSoft("includeStates", true);
|
|
62
|
+
this._setSoft("functionsAs", "function");
|
|
63
|
+
//this._setSoft("includeProperties", ["label"]);
|
|
64
|
+
this._setSoft("excludeSettings", [
|
|
65
|
+
"chart",
|
|
66
|
+
"themeTags",
|
|
67
|
+
"draw",
|
|
68
|
+
"curveFactory",
|
|
69
|
+
"tooltipDataItem",
|
|
70
|
+
"legendDataItem",
|
|
71
|
+
"vcx",
|
|
72
|
+
"vcy",
|
|
73
|
+
"bounds",
|
|
74
|
+
"pointTo",
|
|
75
|
+
"tooltipTarget",
|
|
76
|
+
"translateX",
|
|
77
|
+
"translateY",
|
|
78
|
+
// Handled directly
|
|
79
|
+
"heatRules"
|
|
80
|
+
]); // "x", "y"
|
|
81
|
+
this.adapters.add("excludeProperties", (exclude) => {
|
|
82
|
+
if (this._disableDataSerialization) {
|
|
83
|
+
return (exclude || []).concat(["data"]);
|
|
84
|
+
}
|
|
85
|
+
return exclude;
|
|
86
|
+
});
|
|
87
|
+
this.reset();
|
|
88
|
+
}
|
|
89
|
+
reset() {
|
|
90
|
+
this._disableDataSerialization = false;
|
|
91
|
+
this._globalRefs = [];
|
|
92
|
+
this._internalRefs = {};
|
|
93
|
+
this._counters = {};
|
|
94
|
+
this._lists = {
|
|
95
|
+
data: {},
|
|
96
|
+
axes: {},
|
|
97
|
+
series: {},
|
|
98
|
+
sprites: {},
|
|
99
|
+
elements: {}
|
|
100
|
+
};
|
|
101
|
+
this._mainRefs = {
|
|
102
|
+
functions: [],
|
|
103
|
+
data: [],
|
|
104
|
+
templates: [],
|
|
105
|
+
axes: [],
|
|
106
|
+
series: [],
|
|
107
|
+
axisRanges: [],
|
|
108
|
+
seriesAxisRanges: []
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Serializes target object into a simple object.
|
|
113
|
+
*
|
|
114
|
+
* @param source Target object
|
|
115
|
+
* @return Serialized data
|
|
116
|
+
*/
|
|
117
|
+
serializeAll(source) {
|
|
118
|
+
// This will go as deep in the structure to find either chart or a series,
|
|
119
|
+
// then will pass on to specialized serializers
|
|
120
|
+
// Map out the structure
|
|
121
|
+
this._examineStructure(source);
|
|
122
|
+
// Kick off serializing
|
|
123
|
+
const result = this._serializeEntity(source);
|
|
124
|
+
// Finally, add in global references
|
|
125
|
+
result.refs = [];
|
|
126
|
+
$object.each(this._mainRefs, (_key, value) => {
|
|
127
|
+
if (value.length) {
|
|
128
|
+
value.forEach((item) => {
|
|
129
|
+
result.refs.push(item);
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
// Cleanup
|
|
134
|
+
if (this.get("removeEmptyObjects")) {
|
|
135
|
+
this._pruneEmptyObjects(result);
|
|
136
|
+
}
|
|
137
|
+
return result;
|
|
138
|
+
}
|
|
139
|
+
_serializeEntity(source) {
|
|
140
|
+
// Initialize the result object
|
|
141
|
+
let result;
|
|
142
|
+
// Process series differently
|
|
143
|
+
if (source.isType("Series") && !this._isLegend(source)) {
|
|
144
|
+
this._disableDataSerialization = true;
|
|
145
|
+
result = this.serialize(source, 0, true);
|
|
146
|
+
this._disableDataSerialization = false;
|
|
147
|
+
this._processSeries(source, result);
|
|
148
|
+
// const seriesId = this._processSeries(source, result);
|
|
149
|
+
// this._lists.series[seriesId];
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
result = this.serialize(source, 0, true);
|
|
153
|
+
}
|
|
154
|
+
// Only go deeper if it's a plain Container
|
|
155
|
+
if (source.className === "Container") {
|
|
156
|
+
result.children = [];
|
|
157
|
+
source.children.each((child) => {
|
|
158
|
+
if (!this._isLegend(child)) {
|
|
159
|
+
const serializedChild = this._serializeEntity(child);
|
|
160
|
+
if (child.isType("Series")) {
|
|
161
|
+
result.children.push("#" + this._getInternalRef(child.uid));
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
164
|
+
result.children.push(serializedChild);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
// Specialized serializers
|
|
170
|
+
if (source.isType("SerialChart")) {
|
|
171
|
+
this._processSerialChart(source, result);
|
|
172
|
+
}
|
|
173
|
+
if (source.isType("XYChart")) {
|
|
174
|
+
this._processXYChart(source, result);
|
|
175
|
+
}
|
|
176
|
+
if (source.isType("MapChart")) {
|
|
177
|
+
this._processMapChart(source, result);
|
|
178
|
+
}
|
|
179
|
+
if (source.isType("CurveChart")) {
|
|
180
|
+
this._processCurveChart(source, result);
|
|
181
|
+
}
|
|
182
|
+
if (source.isType("StockChart")) {
|
|
183
|
+
this._processStockChart(source, result);
|
|
184
|
+
}
|
|
185
|
+
if (source.isType("Gantt")) {
|
|
186
|
+
this._processGantt(source, result);
|
|
187
|
+
}
|
|
188
|
+
if (source.isType("Hierarchy")) {
|
|
189
|
+
this._processHierarchy(source, result);
|
|
190
|
+
}
|
|
191
|
+
// Process custom children
|
|
192
|
+
if (source.isType("Container")) {
|
|
193
|
+
this._processCustomChildren(source, result);
|
|
194
|
+
// Check for custom children in property-linked internal containers
|
|
195
|
+
$object.each(source, (key, child) => {
|
|
196
|
+
if (child instanceof Container && !key.match(/^\_/)) {
|
|
197
|
+
this._maybeInit(result, "properties", {});
|
|
198
|
+
this._maybeInit(result.properties, key, {});
|
|
199
|
+
this._processCustomChildren(child, result.properties[key]);
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
return result;
|
|
204
|
+
}
|
|
205
|
+
_examineStructure(source) {
|
|
206
|
+
// Collect serializable custom children
|
|
207
|
+
source.children.each((child) => {
|
|
208
|
+
this._lists.elements[child.uid] = child;
|
|
209
|
+
if (child.hasTag("serialize") || this._isLegend(child)) {
|
|
210
|
+
this._lists.sprites[child.uid] = child;
|
|
211
|
+
}
|
|
212
|
+
if (child.isType("Container")) {
|
|
213
|
+
this._examineStructure(child);
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
_processCustomChildren(source, result) {
|
|
218
|
+
source.children.each((child) => {
|
|
219
|
+
if (this._lists.sprites[child.uid] !== undefined) {
|
|
220
|
+
delete this._lists.sprites[child.uid];
|
|
221
|
+
this._maybeInit(result, "children", []);
|
|
222
|
+
let childItem;
|
|
223
|
+
// Additional processing for Legend
|
|
224
|
+
if (child.isType("Legend")) {
|
|
225
|
+
// Do not let serializer serialize legend's data
|
|
226
|
+
// It can contain big objects like Series, we'll build the data array
|
|
227
|
+
// ourselves
|
|
228
|
+
this._disableDataSerialization = true;
|
|
229
|
+
childItem = this.serialize(child, 0, false);
|
|
230
|
+
this._maybeInit(childItem, "properties", {});
|
|
231
|
+
childItem.properties.data = [];
|
|
232
|
+
child.data.values.forEach((item, index) => {
|
|
233
|
+
if (item instanceof DataItem) {
|
|
234
|
+
const series = item.component;
|
|
235
|
+
childItem.properties.data[index] = "#" + this._getInternalRef(series.uid) + ".dataItems." + index;
|
|
236
|
+
}
|
|
237
|
+
else if (item.isType("Series")) {
|
|
238
|
+
childItem.properties.data[index] = "#" + this._getInternalRef(item.uid);
|
|
239
|
+
}
|
|
240
|
+
else {
|
|
241
|
+
childItem.properties.data[index] = item;
|
|
242
|
+
}
|
|
243
|
+
});
|
|
244
|
+
this._disableDataSerialization = false;
|
|
245
|
+
// Populate templates
|
|
246
|
+
this._populateTemplates(child, childItem.properties, [
|
|
247
|
+
"labels", "valueLabels", "markers", "markerRectangles", "itemContainers"
|
|
248
|
+
]);
|
|
249
|
+
}
|
|
250
|
+
else {
|
|
251
|
+
childItem = this.serialize(child, 0, true);
|
|
252
|
+
}
|
|
253
|
+
childItem.index = child.parent.children.indexOf(child);
|
|
254
|
+
result.children.push(childItem);
|
|
255
|
+
}
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
_processSeries(series, result) {
|
|
259
|
+
const datahash = this._hashObject(series.data.values);
|
|
260
|
+
let dataId = this._getInternalRef(datahash);
|
|
261
|
+
const seriesId = this._getId("series");
|
|
262
|
+
this._lists.series[seriesId] = result;
|
|
263
|
+
this._saveInternalRef(series.uid, seriesId);
|
|
264
|
+
if (dataId === undefined) {
|
|
265
|
+
dataId = this._getId("data");
|
|
266
|
+
this._lists.data[dataId] = this.serialize(series.data.values, 0, true, true);
|
|
267
|
+
this._saveInternalRef(datahash, dataId);
|
|
268
|
+
//_datas[dataId] = this._lists.data[dataId];
|
|
269
|
+
this._saveRefId("data", dataId, this._lists.data[dataId]);
|
|
270
|
+
}
|
|
271
|
+
this._maybeInit(this._lists.series[seriesId], "properties", {});
|
|
272
|
+
this._lists.series[seriesId].properties.data = "#" + dataId;
|
|
273
|
+
// Populate templates
|
|
274
|
+
this._populateTemplates(series, this._lists.series[seriesId].properties, [
|
|
275
|
+
// XY
|
|
276
|
+
"strokes", "fills", "columns",
|
|
277
|
+
// Percent
|
|
278
|
+
"slices", "labels", "ticks", "links",
|
|
279
|
+
// Hierarchy
|
|
280
|
+
"nodes", "circles", "outerCircles",
|
|
281
|
+
// Map
|
|
282
|
+
"mapPolygons", "mapLines"
|
|
283
|
+
]);
|
|
284
|
+
// Handle bullets
|
|
285
|
+
series.bullets.each((bulletFunction) => {
|
|
286
|
+
this._maybeInit(this._lists.series[seriesId].properties, "bullets", []);
|
|
287
|
+
const sampleDataItem = series.dataItems.length ? series.dataItems[0] : new DataItem(series, {}, {});
|
|
288
|
+
const bullet = bulletFunction(series.root, series, sampleDataItem);
|
|
289
|
+
const serializedBullet = this.serialize(bullet, 0, true);
|
|
290
|
+
const bulletSprite = bullet.get("sprite");
|
|
291
|
+
if (bulletSprite) {
|
|
292
|
+
// Serialize the sprite (including children)
|
|
293
|
+
serializedBullet.settings.sprite = this._serializeEntity(bullet.get("sprite"));
|
|
294
|
+
this._lists.series[seriesId].properties.bullets.push(serializedBullet);
|
|
295
|
+
// Look for templates
|
|
296
|
+
this._processTemplate(bullet.get("sprite"), serializedBullet.settings.sprite);
|
|
297
|
+
}
|
|
298
|
+
});
|
|
299
|
+
// Handle heat rules
|
|
300
|
+
const heatRules = series.get("heatRules");
|
|
301
|
+
if (heatRules) {
|
|
302
|
+
this._lists.series[seriesId].settings.heatRules = [];
|
|
303
|
+
heatRules.forEach((rule) => {
|
|
304
|
+
// Figure out target
|
|
305
|
+
let targetId = this._findInternalRef(rule.target);
|
|
306
|
+
if (targetId) {
|
|
307
|
+
targetId = "#" + targetId;
|
|
308
|
+
}
|
|
309
|
+
else {
|
|
310
|
+
// Let's search in series template lists
|
|
311
|
+
$object.each(series, (key, value) => {
|
|
312
|
+
if (value instanceof ListTemplate && value.template === rule.target) {
|
|
313
|
+
const templateId = this._getId("template");
|
|
314
|
+
const serializedTemplate = this.serialize(value.template, 0, true);
|
|
315
|
+
targetId = "#" + templateId;
|
|
316
|
+
result.properties[key].properties.template = "#" + templateId;
|
|
317
|
+
this._saveRefId("templates", templateId, serializedTemplate);
|
|
318
|
+
this._saveInternalRef(templateId, value.template);
|
|
319
|
+
}
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
if (targetId) {
|
|
323
|
+
const serializedRule = this.serialize(rule, 0, true);
|
|
324
|
+
serializedRule.target = targetId;
|
|
325
|
+
serializedRule.__parse = true;
|
|
326
|
+
this._lists.series[seriesId].settings.heatRules.push(serializedRule);
|
|
327
|
+
}
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
this._saveRefId("series", seriesId, this._lists.series[seriesId]);
|
|
331
|
+
this._processCustomChildren(series, this._lists.series[seriesId]);
|
|
332
|
+
return seriesId;
|
|
333
|
+
}
|
|
334
|
+
_processTemplate(source, result) {
|
|
335
|
+
if (source.template) {
|
|
336
|
+
const template = source.template;
|
|
337
|
+
const templateId = this._getId("template");
|
|
338
|
+
const serializedTemplate = this.serialize(template, 0, true);
|
|
339
|
+
this._maybeInit(result, "properties", {});
|
|
340
|
+
result.properties.template = "#" + templateId;
|
|
341
|
+
this._saveRefId("templates", templateId, serializedTemplate);
|
|
342
|
+
this._saveInternalRef(templateId, template);
|
|
343
|
+
}
|
|
344
|
+
if (source.isType("Container")) {
|
|
345
|
+
source.children.each((child, index) => {
|
|
346
|
+
if (result.children && (result.children.length > index)) {
|
|
347
|
+
this._processTemplate(child, result.children[index]);
|
|
348
|
+
}
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
_processSerialChart(source, result) {
|
|
353
|
+
// Process series
|
|
354
|
+
const _series = [];
|
|
355
|
+
source.series.each((series, _index) => {
|
|
356
|
+
this._disableDataSerialization = true;
|
|
357
|
+
const serializedSeries = this.serialize(series, 0, true);
|
|
358
|
+
this._disableDataSerialization = false;
|
|
359
|
+
const seriesId = this._processSeries(series, serializedSeries);
|
|
360
|
+
this._lists.series[seriesId];
|
|
361
|
+
_series.push("#" + seriesId);
|
|
362
|
+
});
|
|
363
|
+
// Add series to chart
|
|
364
|
+
this._maybeInit(result, "properties", {});
|
|
365
|
+
this._maybeInit(result.properties, "series", []);
|
|
366
|
+
result.properties.series = _series;
|
|
367
|
+
// Custom children
|
|
368
|
+
this._processCustomChildren(source, result);
|
|
369
|
+
}
|
|
370
|
+
_processXYChart(source, result) {
|
|
371
|
+
this._maybeInit(result.properties, "xAxes", []);
|
|
372
|
+
this._maybeInit(result.properties, "yAxes", []);
|
|
373
|
+
// Add axes
|
|
374
|
+
["x", "y"].forEach((axisType) => {
|
|
375
|
+
source[axisType + "Axes"].each((axis, _index) => {
|
|
376
|
+
const axisId = this._processAxis(axis, null);
|
|
377
|
+
result.properties[axisType + "Axes"].push("#" + axisId);
|
|
378
|
+
});
|
|
379
|
+
});
|
|
380
|
+
// Populate series with axe references
|
|
381
|
+
source.series.each((series, _index) => {
|
|
382
|
+
const id = this._getInternalRef(series.uid);
|
|
383
|
+
this._lists.series[id].settings.xAxis = "#" + this._getInternalRef(series.get("xAxis").uid);
|
|
384
|
+
this._lists.series[id].settings.yAxis = "#" + this._getInternalRef(series.get("yAxis").uid);
|
|
385
|
+
this._lists.series[id].settings.baseAxis = "#" + this._getInternalRef(series.get("baseAxis").uid);
|
|
386
|
+
});
|
|
387
|
+
// Process series axis ranges
|
|
388
|
+
source.series.each((series, _index) => {
|
|
389
|
+
const axisRanges = series.axisRanges.values;
|
|
390
|
+
if (axisRanges.length) {
|
|
391
|
+
for (let i = 0; i < axisRanges.length; i++) {
|
|
392
|
+
const rangeId = this._getId("seriesAxisRange");
|
|
393
|
+
const range = axisRanges[i];
|
|
394
|
+
const axis = range.axisDataItem.component;
|
|
395
|
+
const axisId = this._getInternalRef(axis.uid);
|
|
396
|
+
const seriesId = this._getInternalRef(series.uid);
|
|
397
|
+
const serializedRange = {
|
|
398
|
+
axis: "#" + axisId,
|
|
399
|
+
series: "#" + seriesId,
|
|
400
|
+
settings: this.serialize(range.axisDataItem._settings, 0, true),
|
|
401
|
+
__parseLogic: "axisRange"
|
|
402
|
+
};
|
|
403
|
+
["fills", "strokes", "graphics"].forEach((key) => {
|
|
404
|
+
const value = range[key];
|
|
405
|
+
if (value && value instanceof ListTemplate) {
|
|
406
|
+
serializedRange[key] = this.serialize(value.template._settings, 0, true);
|
|
407
|
+
}
|
|
408
|
+
});
|
|
409
|
+
this._saveRefId("seriesAxisRanges", rangeId, serializedRange);
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
});
|
|
413
|
+
// Handle layout for axis containers
|
|
414
|
+
["leftAxesContainer", "rightAxesContainer"].forEach((key) => {
|
|
415
|
+
const serializedContainer = this.serialize(source[key], 0, true);
|
|
416
|
+
if (serializedContainer) {
|
|
417
|
+
this._stripType(serializedContainer);
|
|
418
|
+
this._maybeInit(result, "properties", {});
|
|
419
|
+
result.properties[key] = serializedContainer;
|
|
420
|
+
}
|
|
421
|
+
});
|
|
422
|
+
// Process cursor
|
|
423
|
+
const cursor = source.get("cursor");
|
|
424
|
+
if (cursor) {
|
|
425
|
+
["x", "y"].forEach((axisType) => {
|
|
426
|
+
const axis = cursor.get(axisType + "Axis");
|
|
427
|
+
if (axis) {
|
|
428
|
+
result.settings.cursor.settings[axisType + "Axis"] = "#" + this._getInternalRef(axis.uid);
|
|
429
|
+
}
|
|
430
|
+
this._maybeInit(result.settings.cursor, "properties", {});
|
|
431
|
+
});
|
|
432
|
+
result.settings.cursor.properties.lineX = this.serialize(cursor.lineX);
|
|
433
|
+
result.settings.cursor.properties.lineY = this.serialize(cursor.lineY);
|
|
434
|
+
this._stripType(result.settings.cursor.properties.lineX);
|
|
435
|
+
this._stripType(result.settings.cursor.properties.lineY);
|
|
436
|
+
cursor.get("snapToSeries", []).forEach((series, index) => {
|
|
437
|
+
result.settings.cursor.settings.snapToSeries[index] = "#" + this._getInternalRef(series.uid);
|
|
438
|
+
});
|
|
439
|
+
}
|
|
440
|
+
// Process the rest of the XY stuff
|
|
441
|
+
result.properties.zoomOutButton = this.serialize(source.zoomOutButton, 0, false);
|
|
442
|
+
this._stripType(result.properties.zoomOutButton);
|
|
443
|
+
this._stripKeys(result.properties.zoomOutButton.settings, ["background", "icon"]);
|
|
444
|
+
// Process the scrollbar
|
|
445
|
+
const scrollbarX = source.get("scrollbarX");
|
|
446
|
+
if (scrollbarX && scrollbarX.isType("XYChartScrollbar")) {
|
|
447
|
+
const serializedScrollbarChart = this._serializeEntity(scrollbarX.chart);
|
|
448
|
+
this._stripType(serializedScrollbarChart);
|
|
449
|
+
this._maybeInit(result.settings.scrollbarX, "properties", {});
|
|
450
|
+
result.settings.scrollbarX.properties.chart = serializedScrollbarChart;
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
_processAxis(axis, _result, stripType) {
|
|
454
|
+
const axisId = this._getId("axis");
|
|
455
|
+
const serializedAxis = this.serialize(axis, 0, true);
|
|
456
|
+
this._saveRefId("axes", axisId, serializedAxis);
|
|
457
|
+
// Renderer
|
|
458
|
+
this._maybeInit(serializedAxis.settings, "renderer", {});
|
|
459
|
+
this._maybeInit(serializedAxis.settings.renderer, "properties", {});
|
|
460
|
+
this._populateTemplates(axis.get("renderer"), serializedAxis.settings.renderer.properties, [
|
|
461
|
+
"labels", "grid", "minorGrid", "ticks"
|
|
462
|
+
]);
|
|
463
|
+
// Axis syncing
|
|
464
|
+
const syncedAxis = axis.get("syncWithAxis");
|
|
465
|
+
if (syncedAxis) {
|
|
466
|
+
serializedAxis.settings.syncWithAxis = "#" + this._getInternalRef(syncedAxis.uid);
|
|
467
|
+
}
|
|
468
|
+
// Axis header
|
|
469
|
+
if (axis.axisHeader && axis.axisHeader.children.length) {
|
|
470
|
+
this._maybeInit(serializedAxis, "properties", {});
|
|
471
|
+
serializedAxis.properties.axisHeader = this.serialize(axis.axisHeader, 0, true);
|
|
472
|
+
this._processCustomChildren(axis.axisHeader, serializedAxis.properties.axisHeader);
|
|
473
|
+
}
|
|
474
|
+
// Axis bullet
|
|
475
|
+
const bulletFunction = axis.get("bullet");
|
|
476
|
+
if (bulletFunction) {
|
|
477
|
+
const sampleDataItem = axis.dataItems.length ? axis.dataItems[0] : new DataItem(axis, {}, {});
|
|
478
|
+
const bullet = bulletFunction(axis.root, axis, sampleDataItem);
|
|
479
|
+
const serializedBullet = this.serialize(bullet, 0, true);
|
|
480
|
+
serializedAxis.properties.bullet = serializedBullet;
|
|
481
|
+
}
|
|
482
|
+
// Axis ranges
|
|
483
|
+
const axisRanges = axis.axisRanges.values;
|
|
484
|
+
if (axisRanges.length) {
|
|
485
|
+
for (let i = 0; i < axisRanges.length; i++) {
|
|
486
|
+
const rangeId = this._getId("axisRange");
|
|
487
|
+
const range = axisRanges[i];
|
|
488
|
+
const serializedRange = {
|
|
489
|
+
axis: "#" + axisId,
|
|
490
|
+
settings: this.serialize(range._settings, 0, true),
|
|
491
|
+
__parseLogic: "axisRange"
|
|
492
|
+
};
|
|
493
|
+
this._saveRefId("axisRanges", rangeId, serializedRange);
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
// Process CategoryAxis data
|
|
497
|
+
if (axis.isType("CategoryAxis")) {
|
|
498
|
+
let dataid = this._getInternalRef(this._hashObject(axis.data.values));
|
|
499
|
+
if (dataid === undefined) {
|
|
500
|
+
dataid = this._getId("data");
|
|
501
|
+
this._lists.data[dataid] = this.serialize(axis.data.values, 0, true, true);
|
|
502
|
+
this._saveInternalRef(this._hashObject(axis.data.values), dataid);
|
|
503
|
+
this._saveRefId("data", dataid, this._lists.data[dataid]);
|
|
504
|
+
}
|
|
505
|
+
this._maybeInit(serializedAxis, "properties", {});
|
|
506
|
+
serializedAxis.properties.data = "#" + dataid;
|
|
507
|
+
}
|
|
508
|
+
this._saveInternalRef(axis.uid, axisId);
|
|
509
|
+
if (stripType) {
|
|
510
|
+
this._stripType(serializedAxis);
|
|
511
|
+
this._stripType(serializedAxis.settings.renderer);
|
|
512
|
+
}
|
|
513
|
+
const axisItem = {};
|
|
514
|
+
axisItem[axisId] = serializedAxis;
|
|
515
|
+
this._processCustomChildren(axis, axisItem[axisId]);
|
|
516
|
+
this._globalRefs.push(axisItem);
|
|
517
|
+
return axisId;
|
|
518
|
+
}
|
|
519
|
+
_processCurveChart(source, _result) {
|
|
520
|
+
// Curve Chart needs special treament, as it's X axis references Y axis
|
|
521
|
+
// via `yAxis` of its renderer
|
|
522
|
+
source.xAxes.each((axis) => {
|
|
523
|
+
const xRenderer = axis.get("renderer");
|
|
524
|
+
const yRenderer = xRenderer.get("yRenderer");
|
|
525
|
+
if (yRenderer) {
|
|
526
|
+
// Add reference
|
|
527
|
+
const xAxisId = this._getInternalRef(axis.uid);
|
|
528
|
+
const yAxisId = this._getInternalRef(yRenderer.axis.uid);
|
|
529
|
+
const serializedXAxis = this._getRef("axes", xAxisId);
|
|
530
|
+
serializedXAxis.settings.renderer.settings.yRenderer = "#" + yAxisId + ".get('renderer')";
|
|
531
|
+
const serializedYAxis = this._getRef("axes", yAxisId);
|
|
532
|
+
delete serializedYAxis.settings.renderer.settings.xRenderer;
|
|
533
|
+
// Swap positions of the axes
|
|
534
|
+
const xIndex = this._getRefIndex("axes", xAxisId);
|
|
535
|
+
const yIndex = this._getRefIndex("axes", yAxisId);
|
|
536
|
+
if (xIndex < yIndex) {
|
|
537
|
+
[this._mainRefs.axes[xIndex], this._mainRefs.axes[yIndex]] = [this._mainRefs.axes[yIndex], this._mainRefs.axes[xIndex]];
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
});
|
|
541
|
+
}
|
|
542
|
+
_processMapChart(source, result) {
|
|
543
|
+
// Clean up auto-populated data
|
|
544
|
+
source.series.each((series, _index) => {
|
|
545
|
+
const seriesId = this._getInternalRef(series.uid);
|
|
546
|
+
const serializedSeries = this._lists.series[seriesId];
|
|
547
|
+
let serializedData = this._getRef("data", serializedSeries.properties.data.substr(1));
|
|
548
|
+
$array.keepIf(serializedData, (item) => !item.madeFromGeoData);
|
|
549
|
+
$array.map(serializedData, (item) => {
|
|
550
|
+
if (item.geometry) {
|
|
551
|
+
//delete item.geometry;
|
|
552
|
+
}
|
|
553
|
+
});
|
|
554
|
+
if (serializedData.length === 0) {
|
|
555
|
+
delete serializedSeries.properties.data;
|
|
556
|
+
}
|
|
557
|
+
// Clustered bullet
|
|
558
|
+
if (series.get("clusteredBullet")) {
|
|
559
|
+
const bulletFunction = series.get("clusteredBullet");
|
|
560
|
+
const sampleDataItem = series.clusteredDataItems.length ? series.clusteredDataItems[0] : new DataItem(series, {}, {});
|
|
561
|
+
const bullet = bulletFunction(series.root, series, sampleDataItem);
|
|
562
|
+
const serializedBullet = this.serialize(bullet, 0, true);
|
|
563
|
+
if (bullet.get("sprite")) {
|
|
564
|
+
serializedBullet.settings.sprite = this._serializeEntity(bullet.get("sprite"));
|
|
565
|
+
this._lists.series[seriesId].settings.clusteredBullet = serializedBullet;
|
|
566
|
+
this._processTemplate(bullet.get("sprite"), serializedBullet.settings.sprite);
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
});
|
|
570
|
+
// Remove target from ZoomControl
|
|
571
|
+
if (result.settings.zoomControl && result.settings.zoomControl.settings.target) {
|
|
572
|
+
delete result.settings.zoomControl.settings.target;
|
|
573
|
+
this._maybeInit(result.settings.zoomControl, "properties", {});
|
|
574
|
+
["homeButton", "minusButton", "plusButton"].forEach((button) => {
|
|
575
|
+
result.settings.zoomControl.properties[button] = {
|
|
576
|
+
settings: {
|
|
577
|
+
visible: source.get("zoomControl")[button].get("visible")
|
|
578
|
+
}
|
|
579
|
+
};
|
|
580
|
+
});
|
|
581
|
+
}
|
|
582
|
+
// Handle projection setting
|
|
583
|
+
const projection = source.get("projection");
|
|
584
|
+
if (projection && this.get("includeProjection", false)) {
|
|
585
|
+
// @TODO: use references for functions instead
|
|
586
|
+
//result.settings.projection = "#" + this._saveFunction(projection);
|
|
587
|
+
const asString = this.get("functionsAs", "string") == "string";
|
|
588
|
+
if (asString) {
|
|
589
|
+
result.settings.projection = projection.toString();
|
|
590
|
+
}
|
|
591
|
+
else {
|
|
592
|
+
result.settings.projection = projection;
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
_processGantt(source, result) {
|
|
597
|
+
this._notSupported(source, result);
|
|
598
|
+
/*
|
|
599
|
+
// Process series and axis data
|
|
600
|
+
this._maybeInit(result, "properties", {});
|
|
601
|
+
|
|
602
|
+
// Process series
|
|
603
|
+
this._disableDataSerialization = true;
|
|
604
|
+
const serializedSeries = this.serialize(source.series, 0, true);
|
|
605
|
+
this._stripType(serializedSeries);
|
|
606
|
+
result.properties.series = "#" + this._processSeries(source.series, serializedSeries);
|
|
607
|
+
|
|
608
|
+
// Process category axis
|
|
609
|
+
const serializedYAxis = this.serialize(source.yAxis, 0, true);
|
|
610
|
+
this._stripType(serializedYAxis);
|
|
611
|
+
const yAxisId = this._processAxis(source.yAxis, serializedYAxis, true);
|
|
612
|
+
result.properties.yAxis = "#" + yAxisId;
|
|
613
|
+
*/
|
|
614
|
+
}
|
|
615
|
+
_processStockChart(source, result) {
|
|
616
|
+
this._notSupported(source, result);
|
|
617
|
+
}
|
|
618
|
+
_processHierarchy(source, result) {
|
|
619
|
+
const selectedDataItem = source.get("selectedDataItem");
|
|
620
|
+
if (selectedDataItem) {
|
|
621
|
+
const index = source.dataItems.indexOf(selectedDataItem);
|
|
622
|
+
result.settings.selectedDataItem = "@series.dataItems." + index;
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
_populateTemplates(source, result, templateKeys) {
|
|
626
|
+
templateKeys.forEach((key) => {
|
|
627
|
+
if (source[key]) {
|
|
628
|
+
this._maybeInit(result, key, {});
|
|
629
|
+
result[key] = {
|
|
630
|
+
properties: {
|
|
631
|
+
template: this.serialize(source[key].template, 0, true)
|
|
632
|
+
}
|
|
633
|
+
};
|
|
634
|
+
this._stripType(result[key].properties.template);
|
|
635
|
+
}
|
|
636
|
+
});
|
|
637
|
+
}
|
|
638
|
+
_stripKeys(source, keys) {
|
|
639
|
+
keys.forEach((key) => {
|
|
640
|
+
if (source[key] !== undefined) {
|
|
641
|
+
delete source[key];
|
|
642
|
+
}
|
|
643
|
+
});
|
|
644
|
+
}
|
|
645
|
+
_stripType(source) {
|
|
646
|
+
this._stripKeys(source, ["type"]);
|
|
647
|
+
}
|
|
648
|
+
_saveInternalRef(ref, value) {
|
|
649
|
+
return this._internalRefs[ref] = value;
|
|
650
|
+
}
|
|
651
|
+
_getInternalRef(ref) {
|
|
652
|
+
return this._internalRefs[ref];
|
|
653
|
+
}
|
|
654
|
+
_findInternalRef(ref) {
|
|
655
|
+
let res;
|
|
656
|
+
$object.eachContinue(this._internalRefs, (key, value) => {
|
|
657
|
+
if (value === ref) {
|
|
658
|
+
res = key;
|
|
659
|
+
return false;
|
|
660
|
+
}
|
|
661
|
+
return true;
|
|
662
|
+
});
|
|
663
|
+
return res;
|
|
664
|
+
}
|
|
665
|
+
_getRef(key, id) {
|
|
666
|
+
let found;
|
|
667
|
+
this._mainRefs[key].forEach((value) => {
|
|
668
|
+
if (value[id] !== undefined) {
|
|
669
|
+
found = value[id];
|
|
670
|
+
return;
|
|
671
|
+
}
|
|
672
|
+
});
|
|
673
|
+
return found;
|
|
674
|
+
}
|
|
675
|
+
_getRefIndex(key, id) {
|
|
676
|
+
let found = -1;
|
|
677
|
+
this._mainRefs[key].forEach((value, index) => {
|
|
678
|
+
if (value[id] !== undefined) {
|
|
679
|
+
found = index;
|
|
680
|
+
return;
|
|
681
|
+
}
|
|
682
|
+
});
|
|
683
|
+
return found;
|
|
684
|
+
}
|
|
685
|
+
_saveRef(key, value) {
|
|
686
|
+
this._mainRefs[key].push(value);
|
|
687
|
+
}
|
|
688
|
+
_saveRefId(key, id, value) {
|
|
689
|
+
const ref = {};
|
|
690
|
+
ref[id] = value;
|
|
691
|
+
this._saveRef(key, ref);
|
|
692
|
+
}
|
|
693
|
+
// private _saveFunction(callback: any): string {
|
|
694
|
+
// const id = this._getId("function");
|
|
695
|
+
// this._saveRefId("functions", id, this.get("functionsAs") == "string" ? callback.toString() : callback);
|
|
696
|
+
// return id;
|
|
697
|
+
// }
|
|
698
|
+
_hashObject(obj) {
|
|
699
|
+
const json = JSON.stringify(obj, (_key, value) => {
|
|
700
|
+
if ($type.isObject(value) && value instanceof Entity) {
|
|
701
|
+
return JSON.stringify(Object.keys(value));
|
|
702
|
+
}
|
|
703
|
+
return value;
|
|
704
|
+
});
|
|
705
|
+
let hash = 0;
|
|
706
|
+
for (let i = 0; i < json.length; i++) {
|
|
707
|
+
const chr = json.charCodeAt(i);
|
|
708
|
+
hash = (hash << 5) - hash + chr;
|
|
709
|
+
hash |= 0; // convert to 32-bit int
|
|
710
|
+
}
|
|
711
|
+
return "h" + (hash >>> 0).toString(16); // unsigned hex
|
|
712
|
+
}
|
|
713
|
+
_maybeInit(source, key, value) {
|
|
714
|
+
if (!source[key]) {
|
|
715
|
+
source[key] = value;
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
_counter(id) {
|
|
719
|
+
if (this._counters[id] === undefined) {
|
|
720
|
+
this._counters[id] = 0;
|
|
721
|
+
}
|
|
722
|
+
else {
|
|
723
|
+
this._counters[id]++;
|
|
724
|
+
}
|
|
725
|
+
return this._counters[id];
|
|
726
|
+
}
|
|
727
|
+
_getId(id) {
|
|
728
|
+
return id + "-" + this._counter(id);
|
|
729
|
+
}
|
|
730
|
+
_pruneEmptyObjects(value) {
|
|
731
|
+
// Non-object primitives → never empty
|
|
732
|
+
if (value === null || !$type.isObject(value)) {
|
|
733
|
+
return false;
|
|
734
|
+
}
|
|
735
|
+
// Process arrays
|
|
736
|
+
if ($type.isArray(value)) {
|
|
737
|
+
for (let i = value.length - 1; i >= 0; i--) {
|
|
738
|
+
const el = value[i];
|
|
739
|
+
if (el && $type.isObject(el) && !$type.isArray(el)) {
|
|
740
|
+
const empty = this._pruneEmptyObjects(el);
|
|
741
|
+
if (empty) {
|
|
742
|
+
value.splice(i, 1);
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
return false;
|
|
747
|
+
}
|
|
748
|
+
// Regular object
|
|
749
|
+
for (const key of $object.keys(value)) {
|
|
750
|
+
const child = value[key];
|
|
751
|
+
if (key === "states" && $type.isArray(value)) {
|
|
752
|
+
delete value[key];
|
|
753
|
+
}
|
|
754
|
+
else if (child && $type.isObject(child)) {
|
|
755
|
+
const childEmpty = this._pruneEmptyObjects(child);
|
|
756
|
+
if (childEmpty) {
|
|
757
|
+
delete value[key];
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
return Object.keys(value).length === 0;
|
|
762
|
+
}
|
|
763
|
+
_isLegend(source) {
|
|
764
|
+
return source.isType("Legend") || source.isType("HeatLegend");
|
|
765
|
+
}
|
|
766
|
+
_notSupported(_source, result) {
|
|
767
|
+
throw new Error("Unsupported type for serialization: " + result.type);
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
Object.defineProperty(ChartSerializer, "className", {
|
|
771
|
+
enumerable: true,
|
|
772
|
+
configurable: true,
|
|
773
|
+
writable: true,
|
|
774
|
+
value: "ChartSerializer"
|
|
775
|
+
});
|
|
776
|
+
Object.defineProperty(ChartSerializer, "classNames", {
|
|
777
|
+
enumerable: true,
|
|
778
|
+
configurable: true,
|
|
779
|
+
writable: true,
|
|
780
|
+
value: Serializer.classNames.concat([ChartSerializer.className])
|
|
781
|
+
});
|
|
782
|
+
//# sourceMappingURL=ChartSerializer.js.map
|