@amcharts/amcharts5 5.1.8 → 5.1.11
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/hierarchy/ForceDirected.d.ts +1 -0
- package/.internal/charts/hierarchy/ForceDirected.d.ts.map +1 -1
- package/.internal/charts/hierarchy/ForceDirected.js +9 -0
- package/.internal/charts/hierarchy/ForceDirected.js.map +1 -1
- package/.internal/charts/hierarchy/LinkedHierarchy.d.ts +1 -0
- package/.internal/charts/hierarchy/LinkedHierarchy.d.ts.map +1 -1
- package/.internal/charts/hierarchy/LinkedHierarchy.js +12 -3
- package/.internal/charts/hierarchy/LinkedHierarchy.js.map +1 -1
- package/.internal/charts/radar/RadarChart.d.ts +1 -0
- package/.internal/charts/radar/RadarChart.d.ts.map +1 -1
- package/.internal/charts/radar/RadarChart.js +7 -0
- package/.internal/charts/radar/RadarChart.js.map +1 -1
- package/.internal/charts/xy/XYChart.d.ts +11 -1
- package/.internal/charts/xy/XYChart.d.ts.map +1 -1
- package/.internal/charts/xy/XYChart.js +77 -11
- package/.internal/charts/xy/XYChart.js.map +1 -1
- package/.internal/charts/xy/XYChartDefaultTheme.d.ts.map +1 -1
- package/.internal/charts/xy/XYChartDefaultTheme.js +0 -2
- package/.internal/charts/xy/XYChartDefaultTheme.js.map +1 -1
- package/.internal/charts/xy/axes/Axis.d.ts.map +1 -1
- package/.internal/charts/xy/axes/Axis.js +2 -1
- package/.internal/charts/xy/axes/Axis.js.map +1 -1
- package/.internal/charts/xy/axes/AxisRendererX.d.ts.map +1 -1
- package/.internal/charts/xy/axes/AxisRendererX.js +7 -2
- package/.internal/charts/xy/axes/AxisRendererX.js.map +1 -1
- package/.internal/charts/xy/axes/AxisRendererY.js +2 -2
- package/.internal/charts/xy/axes/AxisRendererY.js.map +1 -1
- package/.internal/charts/xy/axes/DateAxis.d.ts.map +1 -1
- package/.internal/charts/xy/axes/DateAxis.js +50 -5
- package/.internal/charts/xy/axes/DateAxis.js.map +1 -1
- package/.internal/charts/xy/axes/ValueAxis.d.ts +13 -0
- package/.internal/charts/xy/axes/ValueAxis.d.ts.map +1 -1
- package/.internal/charts/xy/axes/ValueAxis.js +125 -75
- package/.internal/charts/xy/axes/ValueAxis.js.map +1 -1
- package/.internal/charts/xy/series/BaseColumnSeries.d.ts.map +1 -1
- package/.internal/charts/xy/series/BaseColumnSeries.js +9 -0
- package/.internal/charts/xy/series/BaseColumnSeries.js.map +1 -1
- package/.internal/charts/xy/series/LineSeries.d.ts.map +1 -1
- package/.internal/charts/xy/series/LineSeries.js +3 -0
- package/.internal/charts/xy/series/LineSeries.js.map +1 -1
- package/.internal/charts/xy/series/XYSeries.d.ts +11 -0
- package/.internal/charts/xy/series/XYSeries.d.ts.map +1 -1
- package/.internal/charts/xy/series/XYSeries.js +44 -11
- package/.internal/charts/xy/series/XYSeries.js.map +1 -1
- package/.internal/core/Classes.d.ts +14 -8
- package/.internal/core/Classes.d.ts.map +1 -1
- package/.internal/core/Classes.js.map +1 -1
- package/.internal/core/Root.d.ts +1 -0
- package/.internal/core/Root.d.ts.map +1 -1
- package/.internal/core/Root.js +11 -2
- package/.internal/core/Root.js.map +1 -1
- package/.internal/core/render/Graphics.js +1 -1
- package/.internal/core/render/Graphics.js.map +1 -1
- package/.internal/core/render/GridLayout.d.ts.map +1 -1
- package/.internal/core/render/GridLayout.js +11 -9
- package/.internal/core/render/GridLayout.js.map +1 -1
- package/.internal/core/render/HorizontalLayout.d.ts.map +1 -1
- package/.internal/core/render/HorizontalLayout.js +40 -34
- package/.internal/core/render/HorizontalLayout.js.map +1 -1
- package/.internal/core/render/Legend.d.ts.map +1 -1
- package/.internal/core/render/Legend.js +7 -0
- package/.internal/core/render/Legend.js.map +1 -1
- package/.internal/core/render/Scrollbar.d.ts.map +1 -1
- package/.internal/core/render/Scrollbar.js +3 -0
- package/.internal/core/render/Scrollbar.js.map +1 -1
- package/.internal/core/render/Series.d.ts +5 -0
- package/.internal/core/render/Series.d.ts.map +1 -1
- package/.internal/core/render/Series.js +40 -10
- package/.internal/core/render/Series.js.map +1 -1
- package/.internal/core/render/Sprite.d.ts +4 -0
- package/.internal/core/render/Sprite.d.ts.map +1 -1
- package/.internal/core/render/Sprite.js +14 -0
- package/.internal/core/render/Sprite.js.map +1 -1
- package/.internal/core/render/VerticalLayout.d.ts.map +1 -1
- package/.internal/core/render/VerticalLayout.js +40 -34
- package/.internal/core/render/VerticalLayout.js.map +1 -1
- package/.internal/core/render/backend/CanvasRenderer.d.ts +4 -3
- package/.internal/core/render/backend/CanvasRenderer.d.ts.map +1 -1
- package/.internal/core/render/backend/CanvasRenderer.js +52 -27
- package/.internal/core/render/backend/CanvasRenderer.js.map +1 -1
- package/.internal/core/render/backend/Renderer.d.ts +1 -0
- package/.internal/core/render/backend/Renderer.d.ts.map +1 -1
- package/.internal/core/render/backend/Renderer.js.map +1 -1
- package/.internal/core/util/PopulateString.js +12 -2
- package/.internal/core/util/PopulateString.js.map +1 -1
- package/.internal/core/util/ResizeSensor.js +1 -1
- package/.internal/core/util/ResizeSensor.js.map +1 -1
- package/.internal/core/util/Time.d.ts +1 -0
- package/.internal/core/util/Time.d.ts.map +1 -1
- package/.internal/core/util/Time.js +12 -0
- package/.internal/core/util/Time.js.map +1 -1
- package/.internal/plugins/exporting/ExportingMenu.d.ts.map +1 -1
- package/.internal/plugins/exporting/ExportingMenu.js +3 -2
- package/.internal/plugins/exporting/ExportingMenu.js.map +1 -1
- package/.internal/plugins/json/Classes-script.d.ts +271 -0
- package/.internal/plugins/json/Classes-script.d.ts.map +1 -0
- package/.internal/plugins/json/Classes-script.js +139 -0
- package/.internal/plugins/json/Classes-script.js.map +1 -0
- package/.internal/plugins/json/Classes.d.ts +271 -0
- package/.internal/plugins/json/Classes.d.ts.map +1 -0
- package/.internal/plugins/json/Classes.js +139 -0
- package/.internal/plugins/json/Classes.js.map +1 -0
- package/.internal/plugins/json/Json.d.ts +7 -0
- package/.internal/plugins/json/Json.d.ts.map +1 -0
- package/.internal/plugins/json/Json.js +304 -0
- package/.internal/plugins/json/Json.js.map +1 -0
- package/CHANGELOG.md +52 -0
- 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/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/json/README.md +6 -0
- package/examples/javascript/json/index.css +11 -0
- package/examples/javascript/json/index.html +12 -0
- package/examples/javascript/json/index.js +206 -0
- package/examples/javascript/json/package.json +16 -0
- package/examples/javascript/json/webpack.config.js +38 -0
- package/examples/javascript/map-animating-along-lines/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/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-chord/package.json +1 -1
- package/examples/typescript/flow-chord/webpack.config.js +1 -1
- package/examples/typescript/flow-chord-directed/package.json +1 -1
- package/examples/typescript/flow-chord-directed/webpack.config.js +1 -1
- package/examples/typescript/flow-chord-non-ribbon/package.json +1 -1
- package/examples/typescript/flow-chord-non-ribbon/webpack.config.js +1 -1
- package/examples/typescript/flow-sankey/package.json +1 -1
- package/examples/typescript/flow-sankey/webpack.config.js +1 -1
- package/examples/typescript/gauge/package.json +1 -1
- package/examples/typescript/gauge/webpack.config.js +1 -1
- package/examples/typescript/gauge-bands/package.json +1 -1
- package/examples/typescript/gauge-bands/webpack.config.js +1 -1
- package/examples/typescript/hierarchy-force-directed/package.json +1 -1
- package/examples/typescript/hierarchy-force-directed/webpack.config.js +1 -1
- package/examples/typescript/hierarchy-pack/package.json +1 -1
- package/examples/typescript/hierarchy-pack/webpack.config.js +1 -1
- package/examples/typescript/hierarchy-partition/package.json +1 -1
- package/examples/typescript/hierarchy-partition/webpack.config.js +1 -1
- package/examples/typescript/hierarchy-sunburst/package.json +1 -1
- package/examples/typescript/hierarchy-sunburst/webpack.config.js +1 -1
- package/examples/typescript/hierarchy-tree/package.json +1 -1
- package/examples/typescript/hierarchy-tree/webpack.config.js +1 -1
- package/examples/typescript/hierarchy-treemap/package.json +1 -1
- package/examples/typescript/hierarchy-treemap/webpack.config.js +1 -1
- package/examples/typescript/json/README.md +6 -0
- package/examples/typescript/json/index.css +11 -0
- package/examples/typescript/json/index.html +12 -0
- package/examples/typescript/json/index.ts +206 -0
- package/examples/typescript/json/package.json +18 -0
- package/examples/typescript/json/tsconfig.json +12 -0
- package/examples/typescript/json/webpack.config.js +45 -0
- package/examples/typescript/map-animating-along-lines/package.json +1 -1
- package/examples/typescript/map-animating-along-lines/webpack.config.js +1 -1
- package/examples/typescript/map-day-and-night/package.json +1 -1
- package/examples/typescript/map-day-and-night/webpack.config.js +1 -1
- package/examples/typescript/map-globe-rotate-to-country/package.json +1 -1
- package/examples/typescript/map-globe-rotate-to-country/webpack.config.js +1 -1
- package/examples/typescript/map-globe-with-projected-circles/package.json +1 -1
- package/examples/typescript/map-globe-with-projected-circles/webpack.config.js +1 -1
- package/examples/typescript/map-with-bubbles/package.json +1 -1
- package/examples/typescript/map-with-bubbles/webpack.config.js +1 -1
- package/examples/typescript/map-zoom-to-country/package.json +1 -1
- package/examples/typescript/map-zoom-to-country/webpack.config.js +1 -1
- package/examples/typescript/misc-40-charts/package.json +1 -1
- package/examples/typescript/misc-40-charts/webpack.config.js +1 -1
- package/examples/typescript/misc-microchart-grid/package.json +1 -1
- package/examples/typescript/misc-microchart-grid/webpack.config.js +1 -1
- package/examples/typescript/pie-chart/package.json +1 -1
- package/examples/typescript/pie-chart/webpack.config.js +1 -1
- package/examples/typescript/pie-donut-chart/package.json +1 -1
- package/examples/typescript/pie-donut-chart/webpack.config.js +1 -1
- package/examples/typescript/pie-variable-radius/package.json +1 -1
- package/examples/typescript/pie-variable-radius/webpack.config.js +1 -1
- package/examples/typescript/radar-column-iwatch-style/package.json +1 -1
- package/examples/typescript/radar-column-iwatch-style/webpack.config.js +1 -1
- package/examples/typescript/radar-heat-map/package.json +1 -1
- package/examples/typescript/radar-heat-map/webpack.config.js +1 -1
- package/examples/typescript/radar-line/package.json +1 -1
- package/examples/typescript/radar-line/webpack.config.js +1 -1
- package/examples/typescript/radar-time-line/package.json +1 -1
- package/examples/typescript/radar-time-line/webpack.config.js +1 -1
- package/examples/typescript/sliced-funnel/package.json +1 -1
- package/examples/typescript/sliced-funnel/webpack.config.js +1 -1
- package/examples/typescript/sliced-pictorial-stacked/package.json +1 -1
- package/examples/typescript/sliced-pictorial-stacked/webpack.config.js +1 -1
- package/examples/typescript/sliced-pyramid/package.json +1 -1
- package/examples/typescript/sliced-pyramid/webpack.config.js +1 -1
- package/examples/typescript/venn-diagram/package.json +1 -1
- package/examples/typescript/venn-diagram/webpack.config.js +1 -1
- package/examples/typescript/wordcloud-with-data/package.json +1 -1
- package/examples/typescript/wordcloud-with-data/webpack.config.js +1 -1
- package/examples/typescript/wordcloud-with-text/package.json +1 -1
- package/examples/typescript/wordcloud-with-text/webpack.config.js +1 -1
- package/examples/typescript/xy-100-percent-stacked-column/package.json +1 -1
- package/examples/typescript/xy-100-percent-stacked-column/webpack.config.js +1 -1
- package/examples/typescript/xy-animated-bullet-at-the-end-of-the-series/package.json +1 -1
- package/examples/typescript/xy-animated-bullet-at-the-end-of-the-series/webpack.config.js +1 -1
- package/examples/typescript/xy-bubble/package.json +1 -1
- package/examples/typescript/xy-bubble/webpack.config.js +1 -1
- package/examples/typescript/xy-candlestick/package.json +1 -1
- package/examples/typescript/xy-candlestick/webpack.config.js +1 -1
- package/examples/typescript/xy-clustered-column/package.json +1 -1
- package/examples/typescript/xy-clustered-column/webpack.config.js +1 -1
- package/examples/typescript/xy-column/package.json +1 -1
- package/examples/typescript/xy-column/webpack.config.js +1 -1
- package/examples/typescript/xy-comparing-series-google-analytics-style/package.json +1 -1
- package/examples/typescript/xy-comparing-series-google-analytics-style/webpack.config.js +1 -1
- package/examples/typescript/xy-data-grouping/package.json +1 -1
- package/examples/typescript/xy-data-grouping/webpack.config.js +1 -1
- package/examples/typescript/xy-draggable-range/package.json +1 -1
- package/examples/typescript/xy-draggable-range/webpack.config.js +1 -1
- package/examples/typescript/xy-drawing-series-with-mouse-or-touch/package.json +1 -1
- package/examples/typescript/xy-drawing-series-with-mouse-or-touch/webpack.config.js +1 -1
- package/examples/typescript/xy-dumbbell plot/package.json +1 -1
- package/examples/typescript/xy-dumbbell plot/webpack.config.js +1 -1
- package/examples/typescript/xy-evenly-spaced-date-axis/package.json +1 -1
- package/examples/typescript/xy-evenly-spaced-date-axis/webpack.config.js +1 -1
- package/examples/typescript/xy-line/package.json +1 -1
- package/examples/typescript/xy-line/webpack.config.js +1 -1
- package/examples/typescript/xy-line-highlight-on-legend-hover/package.json +1 -1
- package/examples/typescript/xy-line-highlight-on-legend-hover/webpack.config.js +1 -1
- package/examples/typescript/xy-live-data/package.json +1 -1
- package/examples/typescript/xy-live-data/webpack.config.js +1 -1
- package/examples/typescript/xy-multiple-synced-value-axes/package.json +1 -1
- package/examples/typescript/xy-multiple-synced-value-axes/webpack.config.js +1 -1
- package/examples/typescript/xy-ohlc/package.json +1 -1
- package/examples/typescript/xy-ohlc/webpack.config.js +1 -1
- package/examples/typescript/xy-real-time-data-sorting/package.json +1 -1
- package/examples/typescript/xy-real-time-data-sorting/webpack.config.js +1 -1
- package/examples/typescript/xy-smoothed-line/package.json +1 -1
- package/examples/typescript/xy-smoothed-line/webpack.config.js +1 -1
- package/examples/typescript/xy-stacked-and-clustered-column/package.json +1 -1
- package/examples/typescript/xy-stacked-and-clustered-column/webpack.config.js +1 -1
- package/examples/typescript/xy-stacked-column/package.json +1 -1
- package/examples/typescript/xy-stacked-column/webpack.config.js +1 -1
- package/examples/typescript/xy-stacked-step/package.json +1 -1
- package/examples/typescript/xy-stacked-step/webpack.config.js +1 -1
- package/examples/typescript/xy-stock/package.json +1 -1
- package/examples/typescript/xy-stock/webpack.config.js +1 -1
- package/examples/typescript/xy-stock-comparing/package.json +1 -1
- package/examples/typescript/xy-stock-comparing/webpack.config.js +1 -1
- package/index.d.ts +4 -0
- package/index.d.ts.map +1 -1
- package/index.js +4 -0
- package/index.js.map +1 -1
- package/locales/lt_LT.js +25 -25
- package/locales/lt_LT.js.map +1 -1
- package/package.json +9 -9
- package/plugins/json.d.ts +2 -0
- package/plugins/json.d.ts.map +1 -0
- package/plugins/json.js +2 -0
- package/plugins/json.js.map +1 -0
- package/xy.d.ts +1 -0
- package/xy.d.ts.map +1 -1
- package/xy.js +1 -0
- package/xy.js.map +1 -1
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
import { __awaiter, __generator, __read } from "tslib";
|
|
2
|
+
import { Entity } from "../../core/util/Entity";
|
|
3
|
+
import { Container } from "../../core/render/Container";
|
|
4
|
+
import { Color } from "../../core/util/Color";
|
|
5
|
+
import * as $type from "../../core/util/Type";
|
|
6
|
+
import * as $array from "../../core/util/Array";
|
|
7
|
+
import * as $object from "../../core/util/Object";
|
|
8
|
+
import classes from "./Classes";
|
|
9
|
+
function isObject(value) {
|
|
10
|
+
return $type.isObject(value);
|
|
11
|
+
}
|
|
12
|
+
function getClass(name) {
|
|
13
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
14
|
+
var promise;
|
|
15
|
+
return __generator(this, function (_a) {
|
|
16
|
+
switch (_a.label) {
|
|
17
|
+
case 0:
|
|
18
|
+
promise = classes[name];
|
|
19
|
+
return [4 /*yield*/, promise()];
|
|
20
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
function parseArray(root, value, refs) {
|
|
26
|
+
return Promise.all($array.map(value, function (value) { return parseType(root, value, refs); }));
|
|
27
|
+
}
|
|
28
|
+
function lookupRef(refs, name) {
|
|
29
|
+
var i = refs.length;
|
|
30
|
+
while (i--) {
|
|
31
|
+
var sub = refs[i];
|
|
32
|
+
if (name in sub) {
|
|
33
|
+
return sub[name];
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
throw new Error("Could not find ref #" + name);
|
|
37
|
+
}
|
|
38
|
+
function parseSettings(root, object, refs) {
|
|
39
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
40
|
+
var settings;
|
|
41
|
+
var _this = this;
|
|
42
|
+
return __generator(this, function (_a) {
|
|
43
|
+
switch (_a.label) {
|
|
44
|
+
case 0:
|
|
45
|
+
settings = {};
|
|
46
|
+
return [4 /*yield*/, Promise.all($array.map($object.keys(object), function (key) { return __awaiter(_this, void 0, void 0, function () {
|
|
47
|
+
var _a, _b;
|
|
48
|
+
return __generator(this, function (_c) {
|
|
49
|
+
switch (_c.label) {
|
|
50
|
+
case 0:
|
|
51
|
+
_a = settings;
|
|
52
|
+
_b = key;
|
|
53
|
+
return [4 /*yield*/, parseType(root, object[key], refs)];
|
|
54
|
+
case 1:
|
|
55
|
+
_a[_b] = _c.sent();
|
|
56
|
+
return [2 /*return*/];
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
}); }))];
|
|
60
|
+
case 1:
|
|
61
|
+
_a.sent();
|
|
62
|
+
return [2 /*return*/, settings];
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
function parseProperties(root, object, refs) {
|
|
68
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
69
|
+
var _this = this;
|
|
70
|
+
return __generator(this, function (_a) {
|
|
71
|
+
switch (_a.label) {
|
|
72
|
+
case 0: return [4 /*yield*/, Promise.all($array.map($object.keys(object), function (key) { return __awaiter(_this, void 0, void 0, function () {
|
|
73
|
+
var parsed;
|
|
74
|
+
return __generator(this, function (_a) {
|
|
75
|
+
switch (_a.label) {
|
|
76
|
+
case 0: return [4 /*yield*/, parseValue(root, object[key], refs)];
|
|
77
|
+
case 1:
|
|
78
|
+
parsed = _a.sent();
|
|
79
|
+
return [2 /*return*/, function (entity) {
|
|
80
|
+
var old = entity[key];
|
|
81
|
+
if (old && old instanceof Entity) {
|
|
82
|
+
// TODO merge it if the value is an Entity
|
|
83
|
+
if (parsed.isValue) {
|
|
84
|
+
throw new Error("Cannot merge value into Entity");
|
|
85
|
+
}
|
|
86
|
+
if (parsed.settings) {
|
|
87
|
+
old.setAll(parsed.settings);
|
|
88
|
+
}
|
|
89
|
+
mergeEntity(old, parsed);
|
|
90
|
+
}
|
|
91
|
+
else if (parsed.isValue) {
|
|
92
|
+
// Merge Array into List
|
|
93
|
+
if (old && $type.isArray(parsed.value)) {
|
|
94
|
+
$array.each(parsed.value, function (value) {
|
|
95
|
+
old.push(value);
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
// TODO merge it if the value is an Entity
|
|
100
|
+
entity[key] = parsed.value;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
entity[key] = constructEntity(root, parsed);
|
|
105
|
+
}
|
|
106
|
+
}];
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
}); }))];
|
|
110
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
function parseRefs(root, object, refs) {
|
|
116
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
117
|
+
var newRefs;
|
|
118
|
+
var _this = this;
|
|
119
|
+
return __generator(this, function (_a) {
|
|
120
|
+
switch (_a.label) {
|
|
121
|
+
case 0:
|
|
122
|
+
newRefs = {};
|
|
123
|
+
return [4 /*yield*/, Promise.all($array.map($object.keys(object), function (key) { return __awaiter(_this, void 0, void 0, function () {
|
|
124
|
+
var _a, _b;
|
|
125
|
+
return __generator(this, function (_c) {
|
|
126
|
+
switch (_c.label) {
|
|
127
|
+
case 0:
|
|
128
|
+
_a = newRefs;
|
|
129
|
+
_b = key;
|
|
130
|
+
return [4 /*yield*/, parseType(root, object[key], refs)];
|
|
131
|
+
case 1:
|
|
132
|
+
_a[_b] = _c.sent();
|
|
133
|
+
return [2 /*return*/];
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
}); }))];
|
|
137
|
+
case 1:
|
|
138
|
+
_a.sent();
|
|
139
|
+
return [2 /*return*/, newRefs];
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
function parseValue(root, value, refs) {
|
|
145
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
146
|
+
var _a, _b, _c, construct, settings, properties, children, ref;
|
|
147
|
+
var _d;
|
|
148
|
+
return __generator(this, function (_e) {
|
|
149
|
+
switch (_e.label) {
|
|
150
|
+
case 0:
|
|
151
|
+
if (!$type.isArray(value)) return [3 /*break*/, 2];
|
|
152
|
+
_d = {
|
|
153
|
+
isValue: true
|
|
154
|
+
};
|
|
155
|
+
return [4 /*yield*/, parseArray(root, value, refs)];
|
|
156
|
+
case 1: return [2 /*return*/, (_d.value = _e.sent(),
|
|
157
|
+
_d)];
|
|
158
|
+
case 2:
|
|
159
|
+
if (!isObject(value)) return [3 /*break*/, 8];
|
|
160
|
+
if (!(value.type === "Color")) return [3 /*break*/, 3];
|
|
161
|
+
return [2 /*return*/, {
|
|
162
|
+
isValue: true,
|
|
163
|
+
value: Color.fromAny(value.value),
|
|
164
|
+
}];
|
|
165
|
+
case 3:
|
|
166
|
+
if (!value.refs) return [3 /*break*/, 5];
|
|
167
|
+
_b = (_a = refs).concat;
|
|
168
|
+
return [4 /*yield*/, parseRefs(root, value.refs, refs)];
|
|
169
|
+
case 4:
|
|
170
|
+
refs = _b.apply(_a, [[_e.sent()]]);
|
|
171
|
+
_e.label = 5;
|
|
172
|
+
case 5: return [4 /*yield*/, Promise.all([
|
|
173
|
+
(value.type ? getClass(value.type) : Promise.resolve(undefined)),
|
|
174
|
+
(value.settings ? parseSettings(root, value.settings, refs) : Promise.resolve(undefined)),
|
|
175
|
+
(value.properties ? parseProperties(root, value.properties, refs) : Promise.resolve(undefined)),
|
|
176
|
+
(value.children ? parseArray(root, value.children, refs) : Promise.resolve(undefined)),
|
|
177
|
+
])];
|
|
178
|
+
case 6:
|
|
179
|
+
_c = __read.apply(void 0, [_e.sent(), 4]), construct = _c[0], settings = _c[1], properties = _c[2], children = _c[3];
|
|
180
|
+
return [2 /*return*/, {
|
|
181
|
+
isValue: false,
|
|
182
|
+
type: value.type,
|
|
183
|
+
construct: construct,
|
|
184
|
+
settings: settings,
|
|
185
|
+
adapters: value.adapters,
|
|
186
|
+
children: children,
|
|
187
|
+
properties: properties,
|
|
188
|
+
value: value,
|
|
189
|
+
}];
|
|
190
|
+
case 7: return [3 /*break*/, 9];
|
|
191
|
+
case 8:
|
|
192
|
+
if ($type.isString(value)) {
|
|
193
|
+
if (value[0] === "#") {
|
|
194
|
+
ref = value.slice(1);
|
|
195
|
+
if (value[1] === "#") {
|
|
196
|
+
return [2 /*return*/, {
|
|
197
|
+
isValue: true,
|
|
198
|
+
value: ref,
|
|
199
|
+
}];
|
|
200
|
+
}
|
|
201
|
+
else {
|
|
202
|
+
return [2 /*return*/, {
|
|
203
|
+
isValue: true,
|
|
204
|
+
value: lookupRef(refs, ref),
|
|
205
|
+
}];
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
else {
|
|
209
|
+
return [2 /*return*/, {
|
|
210
|
+
isValue: true,
|
|
211
|
+
value: value,
|
|
212
|
+
}];
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
else {
|
|
216
|
+
return [2 /*return*/, {
|
|
217
|
+
isValue: true,
|
|
218
|
+
value: value,
|
|
219
|
+
}];
|
|
220
|
+
}
|
|
221
|
+
_e.label = 9;
|
|
222
|
+
case 9: return [2 /*return*/];
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
function mergeEntity(entity, parsed) {
|
|
228
|
+
if (parsed.adapters) {
|
|
229
|
+
$array.each(parsed.adapters, function (adapter) {
|
|
230
|
+
entity.adapters.add(adapter.key, adapter.callback);
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
if (parsed.properties) {
|
|
234
|
+
$array.each(parsed.properties, function (fn) {
|
|
235
|
+
fn(entity);
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
if (entity instanceof Container) {
|
|
239
|
+
if (parsed.children) {
|
|
240
|
+
entity.children.setAll(parsed.children);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
function constructEntity(root, parsed) {
|
|
245
|
+
if (!parsed.construct) {
|
|
246
|
+
return parsed.value;
|
|
247
|
+
}
|
|
248
|
+
var entity = parsed.construct.new(root, parsed.settings || {});
|
|
249
|
+
mergeEntity(entity, parsed);
|
|
250
|
+
return entity;
|
|
251
|
+
}
|
|
252
|
+
function parseType(root, value, refs) {
|
|
253
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
254
|
+
var parsed;
|
|
255
|
+
return __generator(this, function (_a) {
|
|
256
|
+
switch (_a.label) {
|
|
257
|
+
case 0: return [4 /*yield*/, parseValue(root, value, refs)];
|
|
258
|
+
case 1:
|
|
259
|
+
parsed = _a.sent();
|
|
260
|
+
if (parsed.isValue) {
|
|
261
|
+
return [2 /*return*/, parsed.value];
|
|
262
|
+
}
|
|
263
|
+
else {
|
|
264
|
+
return [2 /*return*/, constructEntity(root, parsed)];
|
|
265
|
+
}
|
|
266
|
+
return [2 /*return*/];
|
|
267
|
+
}
|
|
268
|
+
});
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
var JsonParser = /** @class */ (function () {
|
|
272
|
+
function JsonParser() {
|
|
273
|
+
}
|
|
274
|
+
Object.defineProperty(JsonParser.prototype, "parse", {
|
|
275
|
+
enumerable: false,
|
|
276
|
+
configurable: true,
|
|
277
|
+
writable: true,
|
|
278
|
+
value: function (root, object) {
|
|
279
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
280
|
+
return __generator(this, function (_a) {
|
|
281
|
+
return [2 /*return*/, parseType(root, object, [])];
|
|
282
|
+
});
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
});
|
|
286
|
+
Object.defineProperty(JsonParser.prototype, "parseString", {
|
|
287
|
+
enumerable: false,
|
|
288
|
+
configurable: true,
|
|
289
|
+
writable: true,
|
|
290
|
+
value: function (root, string) {
|
|
291
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
292
|
+
return __generator(this, function (_a) {
|
|
293
|
+
switch (_a.label) {
|
|
294
|
+
case 0: return [4 /*yield*/, this.parse(root, JSON.parse(string))];
|
|
295
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
296
|
+
}
|
|
297
|
+
});
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
});
|
|
301
|
+
return JsonParser;
|
|
302
|
+
}());
|
|
303
|
+
export { JsonParser };
|
|
304
|
+
//# sourceMappingURL=Json.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Json.js","sourceRoot":"","sources":["../../../../../src/.internal/plugins/json/Json.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,MAA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Q,EAAE;YACjB,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;SAC3C;KACJ;AACL,CAAC;AAGD,SAAS,eAAe,CAAmB,IAAU,EAAE,MAAwB;IAC3E,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE;QACnB,OAAO,MAAM,CAAC,KAAK,CAAC;KACvB;IAED,IAAM,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,QAAQ,IAAI,EAAE,CAAM,CAAC;IAEtE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAE5B,OAAO,MAAM,CAAC;AAClB,CAAC;AAGD,SAAe,SAAS,CAAC,IAAU,EAAE,KAAc,EAAE,IAAiB;;;;;wBACnD,qBAAM,UAAU,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,EAAA;;oBAA5C,MAAM,GAAG,SAAmC;oBAElD,IAAI,MAAM,CAAC,OAAO,EAAE;wBAChB,sBAAO,MAAM,CAAC,KAAK,EAAC;qBAEvB;yBAAM;wBACH,sBAAO,eAAe,CAAC,IAAI,EAAE,MAAM,CAAC,EAAC;qBACxC;;;;;CACJ;AAGD;IAAA;IAQA,CAAC;;;;;eAPG,UAA8B,IAAU,EAAE,MAAe;;;oBACrD,sBAAO,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,CAAC,EAAC;;;SACtC;;;;;;eAED,UAAoC,IAAU,EAAE,MAAc;;;;gCACnD,qBAAM,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,EAAA;gCAAjD,sBAAO,SAA0C,EAAC;;;;SACrD;;IACL,iBAAC;AAAD,CAAC,AARD,IAQC","sourcesContent":["import type { Root } from \"../../core/Root\";\nimport type { Sprite } from \"../../core/render/Sprite\";\nimport { Entity } from \"../../core/util/Entity\";\nimport { Container } from \"../../core/render/Container\";\nimport { Color } from \"../../core/util/Color\";\n\nimport * as $type from \"../../core/util/Type\";\nimport * as $array from \"../../core/util/Array\";\nimport * as $object from \"../../core/util/Object\";\n\nimport type { IClasses } from \"./Classes\";\nimport classes from \"./Classes\";\n\n\ninterface IRef {\n [key: string]: any;\n}\n\n\nfunction isObject(value: any): value is { [key: string]: any } {\n return $type.isObject(value);\n}\n\n\nasync function getClass(name: string): Promise<typeof Entity> {\n const promise = classes[name as keyof IClasses];\n return await promise() as typeof Entity;\n}\n\n\nfunction parseArray(root: Root, value: Array<unknown>, refs: Array<IRef>): Promise<any> {\n return Promise.all($array.map(value, (value) => parseType(root, value, refs)));\n}\n\n\nfunction lookupRef(refs: Array<IRef>, name: string): any {\n let i = refs.length;\n\n while (i--) {\n const sub = refs[i];\n\n if (name in sub) {\n return sub[name];\n }\n }\n\n throw new Error(\"Could not find ref #\" + name);\n}\n\n\ninterface IAdapter<E extends Entity> {\n key: keyof E[\"_settings\"],\n callback: (value: E[\"_settings\"][this[\"key\"]], target: E, key: this[\"key\"]) => E[\"_settings\"][this[\"key\"]],\n}\n\ntype IParsedProperties = Array<(entity: Entity) => void>;\n\ninterface IParsedEntity<E extends Entity> {\n isValue: false,\n type: string | undefined,\n construct: typeof Entity | undefined,\n settings: object | undefined,\n adapters: Array<IAdapter<E>> | undefined,\n children: Array<Sprite> | undefined,\n properties: IParsedProperties | undefined,\n value: object,\n}\n\ntype IParsed<E extends Entity>\n = IParsedEntity<E>\n | { isValue: true, value: any };\n\n\nasync function parseSettings<E extends Entity>(root: Root, object: object, refs: Array<IRef>): Promise<E[\"_settings\"]> {\n const settings: { [key: string]: any } = {};\n\n await Promise.all($array.map($object.keys(object), async (key) => {\n settings[key] = await parseType(root, object[key], refs);\n }));\n\n return settings;\n}\n\n\nasync function parseProperties(root: Root, object: object, refs: Array<IRef>): Promise<IParsedProperties> {\n return await Promise.all($array.map($object.keys(object), async (key) => {\n const parsed = await parseValue(root, object[key], refs);\n\n return (entity: Entity) => {\n const old = entity[key] as unknown;\n\n if (old && old instanceof Entity) {\n // TODO merge it if the value is an Entity\n if (parsed.isValue) {\n throw new Error(\"Cannot merge value into Entity\");\n }\n\n if (parsed.settings) {\n old.setAll(parsed.settings);\n }\n\n mergeEntity(old, parsed);\n\n } else if (parsed.isValue) {\n // Merge Array into List\n if (old && $type.isArray(parsed.value)) {\n $array.each(parsed.value, (value) => {\n (old as any).push(value);\n });\n\n } else {\n // TODO merge it if the value is an Entity\n (entity as any)[key] = parsed.value;\n }\n\n } else {\n (entity as any)[key] = constructEntity(root, parsed);\n }\n };\n }));\n}\n\n\nasync function parseRefs(root: Root, object: { [key: string]: any }, refs: Array<IRef>): Promise<IRef> {\n const newRefs: IRef = {};\n\n await Promise.all($array.map($object.keys(object), async (key) => {\n newRefs[key] = await parseType(root, object[key], refs);\n }));\n\n return newRefs;\n}\n\n\nasync function parseValue<E extends Entity>(root: Root, value: any, refs: Array<IRef>): Promise<IParsed<E>> {\n if ($type.isArray(value)) {\n return {\n isValue: true,\n value: await parseArray(root, value, refs),\n };\n\n } else if (isObject(value)) {\n if (value.type === \"Color\") {\n return {\n isValue: true,\n value: Color.fromAny(value.value),\n };\n\n } else {\n if (value.refs) {\n refs = refs.concat([await parseRefs(root, value.refs, refs)]);\n }\n\n const [construct, settings, properties, children] = await Promise.all([\n (value.type ? getClass(value.type) : Promise.resolve(undefined)),\n (value.settings ? parseSettings(root, value.settings, refs) : Promise.resolve(undefined)),\n (value.properties ? parseProperties(root, value.properties, refs) : Promise.resolve(undefined)),\n (value.children ? parseArray(root, value.children, refs) : Promise.resolve(undefined)),\n ]);\n\n return {\n isValue: false,\n type: value.type,\n construct,\n settings,\n adapters: value.adapters,\n children,\n properties,\n value,\n };\n }\n\n } else if ($type.isString(value)) {\n if (value[0] === \"#\") {\n const ref = value.slice(1);\n\n if (value[1] === \"#\") {\n return {\n isValue: true,\n value: ref,\n };\n\n } else {\n return {\n isValue: true,\n value: lookupRef(refs, ref),\n };\n }\n\n } else {\n return {\n isValue: true,\n value,\n };\n }\n\n } else {\n return {\n isValue: true,\n value,\n };\n }\n}\n\n\nfunction mergeEntity<E extends Entity>(entity: E, parsed: IParsedEntity<E>): void {\n if (parsed.adapters) {\n $array.each(parsed.adapters, (adapter) => {\n entity.adapters.add(adapter.key, adapter.callback);\n });\n }\n\n if (parsed.properties) {\n $array.each(parsed.properties, (fn) => {\n fn(entity);\n });\n }\n\n if (entity instanceof Container) {\n if (parsed.children) {\n entity.children.setAll(parsed.children);\n }\n }\n}\n\n\nfunction constructEntity<E extends Entity>(root: Root, parsed: IParsedEntity<E>): E | object {\n if (!parsed.construct) {\n return parsed.value;\n }\n\n const entity = parsed.construct.new(root, parsed.settings || {}) as E;\n\n mergeEntity(entity, parsed);\n\n return entity;\n}\n\n\nasync function parseType(root: Root, value: unknown, refs: Array<IRef>): Promise<any> {\n const parsed = await parseValue(root, value, refs);\n\n if (parsed.isValue) {\n return parsed.value;\n\n } else {\n return constructEntity(root, parsed);\n }\n}\n\n\nexport class JsonParser {\n async parse<E extends Entity>(root: Root, object: unknown): Promise<E> {\n return parseType(root, object, []);\n }\n\n async parseString<E extends Entity>(root: Root, string: string): Promise<E> {\n return await this.parse(root, JSON.parse(string));\n }\n}\n"]}
|
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,58 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
|
|
|
5
5
|
Please note, that this project, while following numbering syntax, it DOES NOT
|
|
6
6
|
adhere to [Semantic Versioning](http://semver.org/spec/v2.0.0.html) rules.
|
|
7
7
|
|
|
8
|
+
## [5.1.11] - 2022-04-06
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- `groupDataWithOriginals` and `groupDataCallback` settings added to `XYSeries`. [More info](https://www.amcharts.com/docs/v5/charts/xy-chart/axes/date-axis/#Custom_aggregation_functions).
|
|
12
|
+
- `strictMinMaxSelection` setting added to `ValueAxis`. When set to `true`, the axis won't round `min` and `max` of a selection to the nearest round values, but will use actual min and max (`extraMin` and `extraMax` will still be added if set). This is a good feature when your series displays not actual but derivative values, like `valueYChangeSelection` as it helps to avoid frequent jumping of series to adjusted min and max of the axis.
|
|
13
|
+
|
|
14
|
+
### Changed
|
|
15
|
+
- Internal layout of `XYChart` containers was changed. `plotContainers` now goes to `yAxesAndPlotContainer`, and `plotContainer` and `topPlotContainer` goe into `plotContainers`.
|
|
16
|
+
|
|
17
|
+
### Fixed
|
|
18
|
+
- If `XYChart` was used without animated theme, and scrollbar's background was clicked to zoom to some specific spot, it resulted in scrollbar not being updated anymore when zoomed with wheel or zoom-out button.
|
|
19
|
+
- Fixed and issue where nodes of `ForceDirected` series were flickering to 0,0 point when div of a chart was resized.
|
|
20
|
+
- Fixed potential XSS injection issue with the accessibility of tooltips.
|
|
21
|
+
- `container` setting in `ExportingMenu` was being ignored.
|
|
22
|
+
- In some specific cases not all series were included in min/max calculation of a `ValueAxis` resulting not all series to be visible.
|
|
23
|
+
- When whole series was out of selected scope, its last or first value (depending on seleciton) was still included when calculating min and max.
|
|
24
|
+
- Layouts were allocating space for margins of hidden items.
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
## [5.1.10] - 2022-03-30
|
|
28
|
+
|
|
29
|
+
### Added
|
|
30
|
+
- New in-line text formatting property `verticalAlign` added. Currently supports only `"super"` and `"sub"` values. E.g. `Copyright[fontSize: 8px; verticalAlign: super;]TM[\]`.
|
|
31
|
+
|
|
32
|
+
### Changed
|
|
33
|
+
- Logarithmic scale on `ValueAxis` was revamped with a different approach. No changes from the configration, but might influence appearance/scale.
|
|
34
|
+
- When calculating derivative values for series, `low`, `high`, and `open` used previous `low`, `high`, and `open` values. Now they all use `value` instead.
|
|
35
|
+
- Updated to D3 v7.
|
|
36
|
+
|
|
37
|
+
### Fixed
|
|
38
|
+
- In some cases, using a text placehodler, an empty string was shown insteaf of a zero.
|
|
39
|
+
- Some grid container masking issues fixed.
|
|
40
|
+
- Sometimes `valueAxis` was zoomed-in a bit on the first render of an `XYChart`.
|
|
41
|
+
- Axis ranges with `dRadius > 0` were not visible on `RadarChart`.
|
|
42
|
+
- Dynamic change of `value*Show` fields of an `XYSeries` was not working.
|
|
43
|
+
- Removing data from a legend could lead to JS errors in some particular cases.
|
|
44
|
+
- Ghost label was creating a gap in an `XYChartScrollbar` between scrollbar bottom an scrollbar series.
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
## [5.1.9] - 2022-03-17
|
|
48
|
+
|
|
49
|
+
### Fixed
|
|
50
|
+
- Fixed the issue with resizing a chart inside of a flexbox. ([Issue 311](https://github.com/amcharts/amcharts5/issues/311))
|
|
51
|
+
- Fixed jumpy axis when panning an `XYChart` with mouse wheel.
|
|
52
|
+
- Panning XYChart with mouse wheel had incorrect direction if axis was inversed.
|
|
53
|
+
- If axis range had a gradient fill, gradient used to spread only through visible area, making it look icorrect.
|
|
54
|
+
- After pinch zooming and `XYChart` or zooming the chart with no animated theme used, CPU usage used to increase.
|
|
55
|
+
- `DateAxis` with `baseIntervals` `timeUnit` set to `"month"` could show incorrect month in the axis tooltip.
|
|
56
|
+
- If a `Graphics` had a gradient `fill`/`stroke` and initially was invisible, setting it to visible did not make the gradient to appear.
|
|
57
|
+
- While zooming `LineSeries`, a part of the line to the left of the first visible data point could disappear.
|
|
58
|
+
|
|
59
|
+
|
|
8
60
|
## [5.1.8] - 2022-03-10
|
|
9
61
|
|
|
10
62
|
### Added
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
body {
|
|
2
|
+
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
|
|
3
|
+
padding: 0;
|
|
4
|
+
margin: 0;
|
|
5
|
+
background-color: #ffffff;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
#chartdiv {
|
|
9
|
+
width: 100%;
|
|
10
|
+
height: 80vh;
|
|
11
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<title>amCharts 5 Example - json</title>
|
|
6
|
+
<link rel="stylesheet" href="index.css" />
|
|
7
|
+
</head>
|
|
8
|
+
<body>
|
|
9
|
+
<div id="chartdiv"></div>
|
|
10
|
+
<script src="dist/index.js"></script>
|
|
11
|
+
</body>
|
|
12
|
+
</html>
|