Skip to content

Commit

Permalink
Version 5.0.0-beta.17
Browse files Browse the repository at this point in the history
  • Loading branch information
martynasma committed Sep 15, 2021
1 parent 2fca5cf commit 3192aca
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": true,
"name": "@amcharts/amcharts5",
"version": "5.0.0-beta.16",
"version": "5.0.0-beta.17",
"author": "amCharts <[email protected]> (https://www.amcharts.com/)",
"description": "amCharts 5",
"homepage": "https://www.amcharts.com/",
Expand Down
10 changes: 10 additions & 0 deletions packages/shared/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
Please note, that this project, while following numbering syntax, it DOES NOT
adhere to [Semantic Versioning](http://semver.org/spec/v2.0.0.html) rules.

## [5.0.0-beta.17] - 2021-09-15

### Changed
- Default for `Treemap` setting `layoutAlgorithm` changed to `"squarify"`.
- Providing value in Hierarchy node's data will override sum of its children (except for `Pack`).

### Fixed
- `ForceDirected` nodes were linked to invisible top node even though `topLevel` was set to `1` meaning top node should not be visible. This was causing issues with the layout of such nodes.


## [5.0.0-beta.16] - 2021-09-14

### Fixed
Expand Down
15 changes: 13 additions & 2 deletions src/.internal/charts/hierarchy/Hierarchy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export interface IHierarchyDataObject {
value?: number,
children?: IHierarchyDataObject[],
dataItem?: DataItem<IHierarchyDataItem>
customValue?: boolean;
};

export interface IHierarchyDataItem extends ISeriesDataItem {
Expand Down Expand Up @@ -410,7 +411,6 @@ export abstract class Hierarchy extends Series {
node.setAll({ toggleKey: undefined, cursorOverStyle: "default" });
}


if (dataItem.get("disabled") == null) {
if (depth >= topDepth + initialDepth) {
this.disableDataItem(dataItem, 0);
Expand Down Expand Up @@ -438,7 +438,13 @@ export abstract class Hierarchy extends Series {

dataItem.get("node").set("disabled", dataItem.get("disabled"));

const value = d3HierarchyNode.value;
let dataValue = d3HierarchyNode.data.value;
let value = d3HierarchyNode.value

if(dataValue != null){
value = dataValue;
}

if ($type.isNumber(value)) {
dataItem.setRaw("sum", value);

Expand Down Expand Up @@ -474,6 +480,11 @@ export abstract class Hierarchy extends Series {
childrenDataArray.push(childData);
this._makeHierarchyData(childData, childDataItem);
})

const value = dataItem.get("valueWorking");
if ($type.isNumber(value)) {
data.value = value;
}
}
else {
const value = dataItem.get("valueWorking");
Expand Down
2 changes: 1 addition & 1 deletion src/.internal/charts/hierarchy/LinkedHierarchy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ export abstract class LinkedHierarchy extends Hierarchy {
super._processDataItem(dataItem);

const parentDataItem = dataItem.get("parent");
if (parentDataItem) {
if (parentDataItem && parentDataItem.get("depth") >= this.get("topDepth")) {
const link = this.linkDataItems(parentDataItem, dataItem);
dataItem.setRaw("parentLink", link);
}
Expand Down
2 changes: 1 addition & 1 deletion src/.internal/charts/hierarchy/Treemap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export interface ITreemapSettings extends IHierarchySettings {
* An algorithm to use when laying out node rectangles.
*
* @see {@link }
* @default "binary"
* @default "squarify"
*/
layoutAlgorithm?: "binary" | "squarify" | "slice" | "dice" | "sliceDice";

Expand Down
6 changes: 3 additions & 3 deletions src/.internal/themes/DefaultTheme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2188,8 +2188,8 @@ export class DefaultTheme extends Theme {
minRadius: percent(1),
maxRadius: percent(8),
initialFrames: 500,
centerStrength: 0.5,
manyBodyStrength: -15,
centerStrength: 0.8,
manyBodyStrength: -14,
velocityDecay: 0.5,
linkWithStrength: 0.5,
showOnFrame: 10,
Expand Down Expand Up @@ -2280,7 +2280,7 @@ export class DefaultTheme extends Theme {

this.rule("Treemap").setAll({
upDepth: 0,
layoutAlgorithm: "binary"
layoutAlgorithm: "squarify"
});

{
Expand Down

0 comments on commit 3192aca

Please sign in to comment.