Skip to content

Commit

Permalink
Version 5.9.12
Browse files Browse the repository at this point in the history
  • Loading branch information
martynasma committed Jun 12, 2024
1 parent 08527b7 commit 87761cc
Show file tree
Hide file tree
Showing 11 changed files with 106 additions and 40 deletions.
4 changes: 3 additions & 1 deletion build/tasks/docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ module.exports = async (state) => {
"--exclude", "src/geodata/**/*",
"--tsconfig", state.dir("tsconfig.json"),
state.dir("src"),
]);
], {
shell: true
});

const [json] = await Promise.all([
readJson($path.join(dir, "docs.json")),
Expand Down
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.11",
"version": "5.9.12",
"author": "amCharts <contact@amcharts.com> (https://www.amcharts.com/)",
"description": "amCharts 5",
"homepage": "https://www.amcharts.com/",
Expand Down
2 changes: 1 addition & 1 deletion packages/geodata/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ 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.

## [UNRELEASED] - ????-??-??
## [5.1.3] - 2024-06-03

### Added
- New map of Nepal: `nepal2020*`. Contains updated borders as per Nepal's guidance.
Expand Down
2 changes: 1 addition & 1 deletion packages/geodata/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@amcharts/amcharts5-geodata",
"version": "5.1.2",
"version": "5.1.3",
"author": "amCharts <contact@amcharts.com> (https://www.amcharts.com/)",
"description": "amCharts 5 Geo Data",
"homepage": "https://www.amcharts.com/",
Expand Down
12 changes: 12 additions & 0 deletions packages/shared/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@ 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.12] - 2024-06-12

### Changed
- `ClusteredPointSeries` now re-clusters points only when zoom level changes. This improves performance when paning/rotating the map.

### Fixed
- `NumberFormatter` would incorrectly round numbers smaller than 0 due to floating point issue in some cases.
- An error could occur when enabling drawing mode if there were previously disposed chart indicators.
- Truncated or wrapped labels were not properly sizing underline and line-trhough decorations.
- While wheel-zooming bothg X and Y axes simultaneously, the chart could fully zoom out in some cases.


## [5.9.11] - 2024-05-30

### Added
Expand Down
64 changes: 39 additions & 25 deletions src/.internal/charts/map/ClusteredPointSeries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,13 @@ export interface IClusteredPointSeriesSettings extends IMapPointSeriesSettings {


/**
* Delay in milliseconds before clustering is made. This is useful if you have many data items and want to avoid clustering on every zoom/position change.
* Delay in milliseconds before clustering is made.
*
* This is useful if you have many data items and want to avoid re-clustering
* on every zoom/position change.
*
* @default 0
* @since 5.9.11
*/
clusterDelay?: number;
}
Expand Down Expand Up @@ -164,6 +169,8 @@ export class ClusteredPointSeries extends MapPointSeries {

protected _clusterDP?: IDisposer;

protected _previousZL: number = 0;

protected _afterNew() {
this.fields.push("groupId");
this._setRawDefault("groupIdField", "groupId");
Expand All @@ -178,35 +185,42 @@ export class ClusteredPointSeries extends MapPointSeries {
this._spiral = $math.spiralPoints(0, 0, 300, 300, 0, 3, 3, 0, 0)
}

const clusterDelay = this.get("clusterDelay", 0);
if (clusterDelay) {
if (this._clusterDP) {
this._clusterDP.dispose();
const chart = this.chart;

this._clusterDP = this.setTimeout(() => {
this._doTheCluster();
}, clusterDelay)
}
else {
// first time without delay
this._doTheCluster();
this._clusterDP = this.setTimeout(() => { }, 0);
}
}
else {
this._doTheCluster();
}
if (chart) {

$array.each(this.clusteredDataItems, (dataItem) => {
const bullet = dataItem.get("bullet" as any);
if (bullet) {
const sprite = bullet.get("sprite");
const point = this.chart!.convert({ longitude: dataItem.get("longitude", 0), latitude: dataItem.get("latitude", 0) });
const zoomLevel = chart.get("zoomLevel", 1);

if (zoomLevel != this._previousZL) {
const clusterDelay = this.get("clusterDelay", 0);
if (clusterDelay) {
if (this._clusterDP) {
this._clusterDP.dispose();

this._clusterDP = this.setTimeout(() => {
this._doTheCluster();
}, clusterDelay)
}
else {
// first time without delay
this._doTheCluster();
this._clusterDP = this.setTimeout(() => { }, 0);
}
}
else {
this._doTheCluster();
}

sprite.setAll({ x: point.x, y: point.y });
this._previousZL = zoomLevel;
}
})

$array.each(this.clusteredDataItems, (dataItem) => {
const bullet = dataItem.get("bullet" as any);
const longitude = dataItem.get("longitude", 0);
const latitude = dataItem.get("latitude", 0);
this._positionBulletReal(bullet, { type: "Point", coordinates: [longitude, latitude] }, [longitude, latitude]);
})
}
}


Expand Down
12 changes: 8 additions & 4 deletions src/.internal/charts/stock/toolbar/DrawingControl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1142,10 +1142,15 @@ export class DrawingControl extends StockControl {
const targetSeries = this._getPanelMainSeries(panel);
if (targetSeries) {
$object.each(this._drawingSeries, (_tool, seriesList) => {
$array.each(seriesList, (series) => {
$array.eachReverse(seriesList, (series) => {
if (series.chart == panel) {
series.set("series", targetSeries);
series.setPrivate("baseValueSeries", targetSeries);
if (panel.isDisposed()) {
$array.remove(seriesList, series);
}
else {
series.set("series", targetSeries);
series.setPrivate("baseValueSeries", targetSeries);
}
}
})
})
Expand Down Expand Up @@ -1182,7 +1187,6 @@ export class DrawingControl extends StockControl {
strokeDasharray: this.get("strokeDasharray"),
});
});

})
}

Expand Down
32 changes: 28 additions & 4 deletions src/.internal/charts/xy/axes/ValueAxis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,31 @@ export class ValueAxis<R extends AxisRenderer> extends Axis<R> {
this._handleSizeDirty();

if (this._dirtySelectionExtremes && !this._isPanning && this.get("autoZoom", true)) {
this._getSelectionMinMax();

const chart = this.chart;
let getMM = false;
// #1563
if (chart) {
const letter = this.get("renderer").getPrivate("letter");
if (letter == "Y") {
chart.xAxes.each((axis) => {
if (axis.className != "ValueAxis") {
getMM = true;
}
})
}
else if (letter == "X") {
chart.yAxes.each((axis) => {
if (axis.className != "ValueAxis") {
getMM = true;
}
})
}
}

if (getMM) {
this._getSelectionMinMax();
}
this._dirtySelectionExtremes = false;
}

Expand Down Expand Up @@ -1324,7 +1348,7 @@ export class ValueAxis<R extends AxisRenderer> extends Axis<R> {
return;
}

if(min > max){
if (min > max) {
[min, max] = [max, min];
}

Expand Down Expand Up @@ -1585,11 +1609,11 @@ export class ValueAxis<R extends AxisRenderer> extends Axis<R> {

let maxPrecision = this.get("maxPrecision");
if ($type.isNumber(maxPrecision)) {

let ceiledStep = $math.ceil(step, maxPrecision);
if (maxPrecision < Number.MAX_VALUE && step !== ceiledStep) {
step = ceiledStep;
if(step == 0){
if (step == 0) {
step = 1;
}
}
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.11";
readonly version: string = "5.9.12";

/**
* List of applied licenses.
Expand Down
7 changes: 7 additions & 0 deletions src/.internal/core/render/backend/CanvasRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1796,6 +1796,13 @@ export class CanvasText extends CanvasDisplayObject implements IText {
let offset = 1;
let fontSize = chunk.height;

const oversizedBehavior = this.style.oversizedBehavior || "";
if (["truncate", "wrap", "wrap-no-break"].indexOf(oversizedBehavior) > -1) {
// Measure actual width of the text so the line fits
const metrics = this._measureText(chunk.text, context);
chunk.width = metrics.actualBoundingBoxLeft + metrics.actualBoundingBoxRight;
}

let offsetX = chunk.offsetX;
switch (this.style.textAlign) {
case "right":
Expand Down
7 changes: 5 additions & 2 deletions src/.internal/core/util/NumberFormatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -515,8 +515,11 @@ export class NumberFormatter extends Entity {
value = Math.round(value);
}
else if (details.decimals.passive > 0) {
let d: number = Math.pow(10, details.decimals.passive);
value = Math.round(value * d) / d;
const decimals = $utils.decimalPlaces(value);
if (decimals > 0) {
const d = Math.pow(10, details.decimals.passive);
value = Math.round(parseFloat((value * d).toFixed(decimals))) / d;
}
}

// Init return value
Expand Down

0 comments on commit 87761cc

Please sign in to comment.