Skip to content

Commit

Permalink
Version 5.9.13
Browse files Browse the repository at this point in the history
  • Loading branch information
martynasma committed Jul 3, 2024
1 parent 87761cc commit ed138e6
Show file tree
Hide file tree
Showing 8 changed files with 102 additions and 12 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.9.12",
"version": "5.9.13",
"author": "amCharts <contact@amcharts.com> (https://www.amcharts.com/)",
"description": "amCharts 5",
"homepage": "https://www.amcharts.com/",
Expand Down
9 changes: 9 additions & 0 deletions packages/shared/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@ 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.9.13] - 2024-07-03

### Fixed
- If start and end values of a `HeatLegend` were the same, the tooltip was shown in the top/left corner of the chart.
- If a linked hierarchy had bullets on links, they remained visible when nodes and links were hidden.
- Zoom-out button could be visibile initially with some specific setups.
- `ZoomableContainer` would not react to pans in some of its sections if its contents was panned outside the its bounds.


## [5.9.12] - 2024-06-12

### Changed
Expand Down
24 changes: 24 additions & 0 deletions src/.internal/charts/hierarchy/HierarchyLink.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,30 @@ export class HierarchyLink extends Graphics {
}
}

public hide(duration?: number){
$array.each(this.bullets, (bullet) => {
if(bullet){
const sprite = bullet.get("sprite");
if(sprite){
sprite.hide(duration);
}
}
})
return super.hide();
}

public show(duration?: number){
$array.each(this.bullets, (bullet) => {
if(bullet){
const sprite = bullet.get("sprite");
if(sprite){
sprite.show(duration);
}
}
})
return super.show();
}

public _beforeChanged() {
super._beforeChanged();

Expand Down
5 changes: 3 additions & 2 deletions src/.internal/charts/xy/XYChart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import * as $type from "../../core/util/Type";
import * as $order from "../../core/util/Order";
import * as $object from "../../core/util/Object";
import * as $utils from "../../core/util/Utils";
import * as $math from "../../core/util/Math";
import type { Animation } from "../../core/util/Entity";
import type { CategoryAxis } from "./axes/CategoryAxis";
import type { DateAxis } from "./axes/DateAxis";
Expand Down Expand Up @@ -1471,12 +1472,12 @@ export class XYChart extends SerialChart {
if (zoomOutButton && zoomOutButton.parent) {
let visible = false;
this.xAxes.each((axis) => {
if (axis.get("start") != 0 || axis.get("end") != 1) {
if ($math.round(axis.get("start", 0), 6) != 0 || $math.round(axis.get("end", 1), 6) != 1) {
visible = true;
}
})
this.yAxes.each((axis) => {
if (axis.get("start") != 0 || axis.get("end") != 1) {
if ($math.round(axis.get("start", 0), 6) != 0 || $math.round(axis.get("end", 1), 6) != 1) {
visible = true;
}
})
Expand Down
49 changes: 42 additions & 7 deletions src/.internal/charts/xy/axes/ValueAxis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ export interface IValueAxisSettings<R extends AxisRenderer> extends IAxisSetting
* like `valueYChangeSelection` as it helps to avoid frequent jumping of
* series to adjusted min and max of the axis.
*
* This will not work if strictMinMax is set to true (the axis will not zoom at all in this case).
*
* Use `extraMin` and `extraMax` to add extra "padding".
*
* @since 5.1.11
Expand Down Expand Up @@ -1172,8 +1174,10 @@ export class ValueAxis<R extends AxisRenderer> extends Axis<R> {
let selectionMinReal = selectionMin;
let selectionMaxReal = selectionMax;

selectionMin -= (selectionMax - selectionMin) * extraMin;
selectionMax += (selectionMax - selectionMin) * extraMax;
let delta = selectionMax - selectionMin;

selectionMin -= delta * extraMin;
selectionMax += delta * extraMax;

let minMaxStep: IMinMaxStep = this._adjustMinMax(selectionMin, selectionMax, gridCount);

Expand Down Expand Up @@ -1206,23 +1210,48 @@ export class ValueAxis<R extends AxisRenderer> extends Axis<R> {
selectionMin = minMaxStep.min;
selectionMax = minMaxStep.max;
}

if (strictMinMax) {
if ($type.isNumber(minDefined)) {
selectionMin = Math.max(selectionMin, minDefined);
}

if ($type.isNumber(maxDefined)) {
selectionMax = Math.min(selectionMax, maxDefined);
}

}
}

if (selectionStrictMinMax) {
selectionMin = selectionMinReal - (selectionMaxReal - selectionMinReal) * extraMin;
selectionMax = selectionMaxReal + (selectionMaxReal - selectionMinReal) * extraMax;
}

if (strictMinMax) {
if ($type.isNumber(minDefined)) {
selectionMin = minDefined;
}
else {
selectionMin = selectionMinReal;
}

if ($type.isNumber(maxDefined)) {
selectionMax = maxDefined;
}
else {
selectionMax = selectionMaxReal;
}

if (selectionMax - selectionMin <= 0.00000001) {
selectionMin -= this._deltaMinMax;
selectionMax += this._deltaMinMax;
}

let delta = selectionMax - selectionMin;

selectionMin -= delta * extraMin;
selectionMax += delta * extraMax;
}

if (this.get("logarithmic")) {

if (selectionMin <= 0) {
Expand Down Expand Up @@ -1449,8 +1478,9 @@ export class ValueAxis<R extends AxisRenderer> extends Axis<R> {
max += this._deltaMinMax;
}

min -= (max - min) * extraMin;
max += (max - min) * extraMax;
let delta = max - min;
min -= delta * extraMin;
max += delta * extraMax;
}

minAdapted = this.adapters.fold("min", min);
Expand All @@ -1474,13 +1504,16 @@ export class ValueAxis<R extends AxisRenderer> extends Axis<R> {
min = $math.round(min, decCount);
max = $math.round(max, decCount);



const syncWithAxis = this.get("syncWithAxis");
if (syncWithAxis) {
minMaxStep = this._syncAxes(min, max, minMaxStep.step, syncWithAxis.getPrivate("minFinal", syncWithAxis.getPrivate("min", 0)), syncWithAxis.getPrivate("maxFinal", syncWithAxis.getPrivate("max", 1)), syncWithAxis.getPrivate("step", 1));
min = minMaxStep.min;
max = minMaxStep.max;
}


this.setPrivateRaw("maxZoomFactor", Math.max(1, Math.ceil((max - min) / minDiff * this.get("maxZoomFactor", 100))));
this._fixZoomFactor();

Expand All @@ -1494,9 +1527,11 @@ export class ValueAxis<R extends AxisRenderer> extends Axis<R> {
}
}



if ($type.isNumber(min) && $type.isNumber(max)) {
if (this.getPrivate("minFinal") !== min || this.getPrivate("maxFinal") !== max) {

this.setPrivate("minFinal", min);
this.setPrivate("maxFinal", max);
this._saveMinMax(min, max);
Expand Down
2 changes: 1 addition & 1 deletion src/.internal/core/Registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export class Registry {
/**
* Currently running version of amCharts.
*/
readonly version: string = "5.9.12";
readonly version: string = "5.9.13";

/**
* List of applied licenses.
Expand Down
7 changes: 6 additions & 1 deletion src/.internal/core/render/HeatLegend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,12 @@ export class HeatLegend extends Container {
const startValue = this.get("startValue", 0);
const endValue = this.get("endValue", 1);

const c = (value - startValue) / (endValue - startValue);
let c = (value - startValue) / (endValue - startValue);

if(c == Infinity || c == -Infinity || isNaN(c)) {
c = 0.5;
}

const startColor = this.get("startColor")!;
const endColor = this.get("endColor")!;

Expand Down
16 changes: 16 additions & 0 deletions src/.internal/core/render/ZoomableContainer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,22 @@ export class ZoomableContainer extends Container {
this._disposers.push(events.on("globalpointermove", (event) => {
this._handleThisMove(event);
}));

const bg = this.contents.get("background");
if(bg){
bg.adapters.add("width", (width) => {
return Number(width) * 5;
})
bg.adapters.add("height", (height) => {
return Number(height) * 5;
})
bg.adapters.add("x", (x) => {
return Number(x) - bg.width() / 5 * 2;
})
bg.adapters.add("y", (y) => {
return Number(y) - bg.height() / 5 * 2;
})
}
}

public _prepareChildren() {
Expand Down

0 comments on commit ed138e6

Please sign in to comment.