Skip to content

Commit 82e3251

Browse files
committed
Version 5.18.0
1 parent f9addda commit 82e3251

21 files changed

Lines changed: 4993 additions & 6701 deletions

build/tasks/build-script.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,8 @@ module.exports = async (state) => {
327327
{
328328
test: /\.js$/,
329329
enforce: "pre",
330-
use: ["source-map-loader"]
330+
use: ["source-map-loader"],
331+
exclude: /node_modules/,
331332
},
332333
]
333334
},

build/tasks/generate-classes.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ function mapClass(name) {
1111
case "DurationAxis":
1212
case "GaplessDateAxis":
1313
return `${name}<AxisRenderer>`;
14+
case "GanttCategoryAxis":
15+
return `${name}<GanttCategoryAxisRenderer>`;
16+
case "GanttDateAxis":
17+
return `${name}<GanttDateAxisRenderer>`;
1418
default:
1519
return name;
1620
}
@@ -102,8 +106,8 @@ async function writeJson(state, classes, keys) {
102106

103107
imports.push(`import type { ${className} } from "./${chunk}";`);
104108
types.push(`\t"${key}": () => Promise<typeof ${className}>;`);
105-
properties.push(`\t"${key}": () => import(/* webpackExports: "${className}", webpackChunkName: "json_${chunkName(chunk)}" */ "./${chunk}").then((m) => m.${className}),`);
106-
propertiesScript.push(`\t"${key}": () => import(/* webpackExports: "${className}", webpackMode: "weak" */ "./${chunk}").then((m) => m.${className}),`);
109+
properties.push(`\t"${key}": () => import(/* webpackChunkName: "json_${chunkName(chunk)}" */ "./${chunk}").then((m) => m.${className}),`);
110+
propertiesScript.push(`\t"${key}": () => import(/* webpackMode: "weak" */ "./${chunk}").then((m) => m.${className}),`);
107111
});
108112

109113
await writeFile(state.dir("src", ".internal", "plugins", "json", "Classes.ts"), `/**

package.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"private": true,
33
"name": "@amcharts/amcharts5",
4-
"version": "5.17.3",
4+
"version": "5.18.0",
55
"author": "amCharts <contact@amcharts.com> (https://www.amcharts.com/)",
66
"description": "amCharts 5",
77
"homepage": "https://www.amcharts.com/",
@@ -53,12 +53,16 @@
5353
"d3-voronoi-treemap": "^1.1.2",
5454
"flatpickr": "^4.6.13",
5555
"markerjs2": "^2.29.4",
56-
"pdfmake": "^0.2.2",
56+
"pdfmake": "~0.3.9",
5757
"polylabel": "^1.1.0",
5858
"seedrandom": "^3.0.5",
5959
"svg-arc-to-cubic-bezier": "^3.2.0",
6060
"tslib": "^2.2.0"
6161
},
62+
"resolutions": {
63+
"@types/node": "^18.0.0",
64+
"@types/d3-dispatch": "3.0.6"
65+
},
6266
"devDependencies": {
6367
"@types/seedrandom": "^3.0.5",
6468
"ansi-colors": "^4.1.1",

packages/shared/CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,21 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
55
Please note, that this project, while following numbering syntax, it DOES NOT
66
adhere to [Semantic Versioning](http://semver.org/spec/v2.0.0.html) rules.
77

8+
## [5.18.0] - 2026-06-04
9+
10+
### Added
11+
- `fitNodes` (default: `false`) setting added to `Tree` chart. If set to `true`, hidden nodes will excluded from the layout, giving more space for visible ones.
12+
13+
### Changed
14+
- `pdfmake` dependency updated to `^0.3.9`. For those using only amCharts Exporting API, nothing changes. Only if you are accessing pdfmake object directly, there are some breaking API changes. [More info](https://www.amcharts.com/docs/v5/tutorials/pdfmake-upgrade-notice-02-03/).
15+
- Renamed `type` setting to `maType` on moving average indicators (`MovingAverage`, `MovingAverageDeviation`, `MovingAverageEnvelope`, `BollingerBands`). (setting `type` will work as well, but it's deprecated)
16+
- Renamed `type` setting to `shapeType` on `VoronoiTreemap`. (setting `type` will work as well, but it's deprecated)
17+
18+
### Fixed
19+
- `PictorialStackedSeries` was not correctly guarding against `NaN` scale values, which could result in invalid scale being applied to the series mask and graphics.
20+
- Saving/serializing `StockChart` now includes `fontFamily`, `fontWeight`, and `fontStyle` settings for labels.
21+
22+
823
## [5.17.3] - 2026-05-29
924

1025
### Added

src/.internal/charts/funnel/PictorialStackedSeries.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export class PictorialStackedSeries extends PyramidSeries {
7474
else {
7575
scale = h / mh;
7676
}
77-
if (scale != Infinity && scale != NaN) {
77+
if (scale != Infinity && !Number.isNaN(scale)) {
7878
seriesMask.set("scale", scale);
7979
seriesMask.set("x", w / 2);
8080
seriesMask.set("y", h / 2);

src/.internal/charts/hierarchy/HierarchyDefaultTheme.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ export class HierarchyDefaultTheme extends Theme {
459459

460460
{
461461
r("VoronoiTreemap").setAll({
462-
type: "polygon",
462+
shapeType: "polygon",
463463
minWeightRatio: 0.005,
464464
convergenceRatio: 0.005,
465465
maxIterationCount: 100,

src/.internal/charts/hierarchy/Tree.ts

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
import type { DataItem } from "../../core/render/Component";
22
import type { IPoint } from "../../core/util/IPoint";
3+
import type { IHierarchyDataObject, IHierarchyDataItem } from "./Hierarchy";
34

45
import { LinkedHierarchy, ILinkedHierarchyPrivate, ILinkedHierarchySettings, ILinkedHierarchyDataItem, ILinkedHierarchyEvents } from "./LinkedHierarchy";
56

7+
import * as $array from "../../core/util/Array";
8+
import * as $type from "../../core/util/Type";
69
import * as d3hierarchy from "d3-hierarchy";
710

811
export interface ITreeDataObject {
@@ -66,6 +69,15 @@ export interface ITreeSettings extends ILinkedHierarchySettings {
6669
*/
6770
nodeSeparation?: (a: DataItem<ITreeDataItem>, b: DataItem<ITreeDataItem>) => number;
6871

72+
/**
73+
* If set to `true`, hidden or disabled nodes are excluded from the layout
74+
* so that visible nodes spread out to fill the available chart area.
75+
*
76+
* @default false
77+
* @since 5.18.0
78+
*/
79+
fitNodes?: boolean;
80+
6981
}
7082

7183
export interface ITreePrivate extends ILinkedHierarchyPrivate {
@@ -106,6 +118,10 @@ export class Tree extends LinkedHierarchy {
106118
public _packData: ITreeDataObject | undefined;
107119

108120
public _prepareChildren() {
121+
if (this.isDirty("fitNodes")) {
122+
this._valuesDirty = true;
123+
}
124+
109125
super._prepareChildren();
110126

111127
if (this.isDirty("clustered")) {
@@ -118,6 +134,67 @@ export class Tree extends LinkedHierarchy {
118134
}
119135
}
120136

137+
protected _makeHierarchyData(data: IHierarchyDataObject, dataItem: DataItem<IHierarchyDataItem>) {
138+
if (!this.get("fitNodes")) {
139+
super._makeHierarchyData(data, dataItem);
140+
return;
141+
}
142+
143+
data.dataItem = dataItem;
144+
const children = (dataItem as DataItem<ITreeDataItem>).get("children");
145+
if (children) {
146+
const childrenDataArray: Array<IHierarchyDataObject> = [];
147+
data.children = childrenDataArray;
148+
$array.each(children, (childDataItem) => {
149+
if (childDataItem.isHidden()) {
150+
return;
151+
}
152+
const node = childDataItem.get("node");
153+
if (node && node.isHidden()) {
154+
return;
155+
}
156+
const childData = {};
157+
childrenDataArray.push(childData);
158+
this._makeHierarchyData(childData, childDataItem);
159+
});
160+
}
161+
162+
const value = dataItem.get("valueWorking");
163+
if ($type.isNumber(value)) {
164+
data.value = value;
165+
}
166+
}
167+
168+
public async hideDataItem(dataItem: DataItem<this["_dataItemSettings"]>, duration?: number): Promise<void> {
169+
const result = super.hideDataItem(dataItem, duration);
170+
if (this.get("fitNodes")) {
171+
this.markDirtyValues();
172+
}
173+
return result;
174+
}
175+
176+
public async showDataItem(dataItem: DataItem<this["_dataItemSettings"]>, duration?: number): Promise<void> {
177+
const result = super.showDataItem(dataItem, duration);
178+
if (this.get("fitNodes")) {
179+
this.markDirtyValues();
180+
}
181+
return result;
182+
}
183+
184+
public disableDataItem(dataItem: DataItem<this["_dataItemSettings"]>, duration?: number) {
185+
super.disableDataItem(dataItem, duration);
186+
if (this.get("fitNodes")) {
187+
this.markDirtyValues();
188+
}
189+
}
190+
191+
public enableDataItem(dataItem: DataItem<this["_dataItemSettings"]>, maxDepth?: number, depth?: number, duration?: number) {
192+
super.enableDataItem(dataItem, maxDepth, depth, duration);
193+
if (this.get("fitNodes")) {
194+
this.markDirtyValues();
195+
}
196+
}
197+
121198
protected _updateVisuals() {
122199
if (this._rootNode) {
123200
const layout = this._hierarchyLayout;

src/.internal/charts/hierarchy/VoronoiTreemap.ts

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,21 @@ export interface IVoronoiTreemapSettings extends IHierarchySettings {
4646
* @see {@link https://www.amcharts.com/docs/v5/charts/hierarchy/voronoi-treemap/#Diagram_type} for more info
4747
* @default "polygon"
4848
*/
49+
shapeType?: "rectangle" | "polygon"
50+
51+
/**
52+
* Type of the diagram's shape.
53+
* Left for backward compatibility. Please use `shapeType` instead.
54+
* @ignore
55+
*/
4956
type?: "rectangle" | "polygon"
5057

5158
/**
52-
* Number of corners when type is `"polygon"`.
59+
* Number of corners when `shapeType` is `"polygon"`.
5360
*
5461
* `120` means the polygon will look like a circle.
5562
*
56-
* NOTE: this setting is ignored if `type="rectangle"`.
63+
* NOTE: this setting is ignored if `shapeType="rectangle"`.
5764
*
5865
* @default 120
5966
*/
@@ -154,6 +161,11 @@ export class VoronoiTreemap extends Hierarchy {
154161
public _prepareChildren() {
155162
super._prepareChildren();
156163

164+
if (this.isDirty("type") && this.get("type") !== undefined) {
165+
this.set("shapeType", this.get("type"));
166+
this.setRaw("type", undefined);
167+
}
168+
157169
const width = this.innerWidth() / 2;
158170
const height = this.innerHeight() / 2;
159171

@@ -168,15 +180,15 @@ export class VoronoiTreemap extends Hierarchy {
168180
this.voronoi.maxIterationCount((this.get("maxIterationCount", 100)));
169181
this.voronoi.minWeightRatio((this.get("minWeightRatio", 0.005)));
170182

171-
if (this.isDirty("type")) {
172-
if (this.get("type") == "polygon") {
183+
if (this.isDirty("shapeType")) {
184+
if (this.get("shapeType") == "polygon") {
173185
this.voronoi.clip(this.getCirclePolygon(1));
174186
this._updateVisuals();
175187
}
176188
}
177189

178190
if (this._sizeDirty) {
179-
if (this.get("type") == "rectangle") {
191+
if (this.get("shapeType") == "rectangle") {
180192
this.voronoi.prng(seedrandom("X"));
181193
this.voronoi.clip([[-width, -height], [-width, height], [width, height], [width, -height]])(node);
182194
this._updateVisuals();
@@ -199,7 +211,7 @@ export class VoronoiTreemap extends Hierarchy {
199211
let coordinates: any = [];
200212

201213
let d = 1;
202-
if (this.get("type") == "polygon") {
214+
if (this.get("shapeType") == "polygon") {
203215
d = Math.min(this.innerWidth(), this.innerHeight()) / 2;
204216
}
205217

src/.internal/charts/stock/StockChartDefaultTheme.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -765,7 +765,7 @@ export class StockChartDefaultTheme extends Theme {
765765

766766
r("LineSeries", ["indicator", "bollingerbands"]).setAll({
767767
legendValueText: "[{lowerColor} bold]{lower.formatNumber('#.00')}[/] [{seriesColor} bold]{valueY.formatNumber('#.00')}[/] [{upperColor} bold]{upper.formatNumber('#.00')}[/]",
768-
legendLabelText: "{shortName} ({period.formatNumber('#.')},{field},{standardDeviations.formatNumber('#.')},{type})"
768+
legendLabelText: "{shortName} ({period.formatNumber('#.')},{field},{standardDeviations.formatNumber('#.')},{maType})"
769769
})
770770

771771
r("LineSeries", ["indicator", "macross"]).setAll({
@@ -820,7 +820,7 @@ export class StockChartDefaultTheme extends Theme {
820820

821821
r("LineSeries", ["movingaverage"]).setAll({
822822
legendValueText: "[{seriesColor} bold]{valueY.formatNumber('#.00')}[/]",
823-
legendLabelText: "{shortName} ({period.formatNumber('#.')},{field},{type},{offset.formatNumber('#.')})"
823+
legendLabelText: "{shortName} ({period.formatNumber('#.')},{field},{maType},{offset.formatNumber('#.')})"
824824
})
825825

826826
r("ColumnSeries", ["movingaveragedeviation"]).setAll({
@@ -829,7 +829,7 @@ export class StockChartDefaultTheme extends Theme {
829829

830830
r("LineSeries", ["indicator", "movingaverageenvelope"]).setAll({
831831
legendValueText: "[{lowerColor} bold]{lower.formatNumber('#.00')}[/] [{seriesColor} bold]{valueY.formatNumber('#.00')}[/] [{upperColor} bold]{upper.formatNumber('#.00')}[/]",
832-
legendLabelText: "{shortName} ({period.formatNumber('#.')},{field},{shiftType},{shift.formatNumber('#.')},{type})"
832+
legendLabelText: "{shortName} ({period.formatNumber('#.')},{field},{shiftType},{shift.formatNumber('#.')},{maType})"
833833
})
834834

835835
r("LineSeries", ["onbalancevolume"]).setAll({
@@ -974,7 +974,7 @@ export class StockChartDefaultTheme extends Theme {
974974
name: l.translateAny("Moving Average"),
975975
shortName: l.translateAny("MA"),
976976
seriesColor: color(0xab82da),
977-
type: "simple",
977+
maType: "simple",
978978
field: "close",
979979
period: 20,
980980
offset: 0
@@ -1004,7 +1004,7 @@ export class StockChartDefaultTheme extends Theme {
10041004
seriesColor: color(0xff903f),
10051005
upperColor: color(0xffc948),
10061006
lowerColor: color(0xffaf74),
1007-
type: "simple",
1007+
maType: "simple",
10081008
field: "close",
10091009
period: 20,
10101010
offset: 0,
@@ -1017,7 +1017,7 @@ export class StockChartDefaultTheme extends Theme {
10171017
shortName: l.translateAny("MA Dev"),
10181018
increasingColor: ic.get("positive"),
10191019
decreasingColor: ic.get("negative"),
1020-
type: "simple",
1020+
maType: "simple",
10211021
field: "close",
10221022
period: 20
10231023
})

src/.internal/charts/stock/indicators/BollingerBands.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ export class BollingerBands extends MovingAverage {
8181
type: "dropdown",
8282
options: ["open", "close", "low", "high", "hl/2", "hlc/3", "hlcc/4", "ohlc/4"]
8383
}, {
84-
key: "type",
84+
key: "maType",
8585
name: this.root.language.translateAny("Type"),
8686
type: "dropdown",
8787
options: ["simple", "weighted", "exponential", "dema", "tema"]

0 commit comments

Comments
 (0)