Skip to content

Commit

Permalink
Version 5.0.0-beta.41
Browse files Browse the repository at this point in the history
  • Loading branch information
martynasma committed Oct 31, 2021
1 parent 50bd76f commit 39a026e
Show file tree
Hide file tree
Showing 11 changed files with 77 additions and 19 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.40",
"version": "5.0.0-beta.41",
"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.41] - 2021-10-31

### Added
- `dRadius` and `dInnerRadius` settings added to `Slice` (default: `0`). Allows tweaking `radius`/`innerRadius` values in charts where these settings are set by the chart (`PieSeries`, circular/radial axis fills, etc.).
- `adjustBulletPosition` added to `BaseColumnSeries` (default: `true`). If set to `false`, bullets will be positioned relatively to whole width/height of the column, rather then the portion that is currently visible.

### Fixed
- `RadarChart` with `RadarLineSeries` could result a JS error when zoomed.


## [5.0.0-beta.40] - 2021-10-30

### Fixed
Expand Down
6 changes: 3 additions & 3 deletions src/.internal/charts/radar/RadarLineSeries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ export class RadarLineSeries extends LineSeries {
const yAxis = this.get("yAxis");
const xAxis = this.get("xAxis");

const rendererY = xAxis.get("renderer") as AxisRendererRadial;
const rendererY = yAxis.get("renderer") as AxisRendererRadial;

const radius = yAxis.get("renderer").positionToCoordinate(positionY) + rendererY.getPrivate("innerRadius", 0);
const radius = rendererY.positionToCoordinate(positionY) + rendererY.getPrivate("innerRadius", 0);

const rendererX = xAxis.get("renderer") as AxisRendererCircular;
const angle = rendererX.positionToAngle(positionX);
Expand All @@ -77,7 +77,7 @@ export class RadarLineSeries extends LineSeries {
}

protected _endLine(points: Array<Array<number>>, firstPoint: Array<number>) {
if (this.get("connectEnds")) {
if (this.get("connectEnds") && firstPoint) {
points.push(firstPoint);
}
}
Expand Down
4 changes: 4 additions & 0 deletions src/.internal/charts/xy/XYChartDefaultTheme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,10 @@ export class XYChartDefaultTheme extends Theme {
seriesTooltipTarget:"series"
});

r("BaseColumnSeries").setAll({
adjustBulletPosition:true
});

r("ColumnSeries").setAll({
clustered: true
});
Expand Down
6 changes: 5 additions & 1 deletion src/.internal/charts/xy/axes/Axis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,11 @@ export interface IAxisSettings<R extends AxisRenderer> extends IComponentSetting
*/
fixAxisSize?: boolean;

// @todo review
/**
* A function that will be used to create bullets on each cell.
*
* @see {@link https://www.amcharts.com/docs/v5/charts/xy-chart/axes/#Axis_bullets} for more info
*/
bullet?: (root: Root, axis: Axis<AxisRenderer>, dataItem: DataItem<IAxisDataItem>) => AxisBullet;

}
Expand Down
25 changes: 18 additions & 7 deletions src/.internal/charts/xy/series/BaseColumnSeries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,15 @@ export interface IBaseColumnSeriesSettings extends IXYSeriesSettings {
*/
clustered?: boolean;

/**
* Whether positions of bullets should be calculated based on portion of
* column currently visual (`true`) or the whole length/height of the
* column (`false`).
*
* @default true
*/
adjustBulletPosition?:boolean;

}

export interface IBaseColumnSeriesPrivate extends IXYSeriesPrivate { }
Expand Down Expand Up @@ -464,14 +473,16 @@ export abstract class BaseColumnSeries extends XYSeries {
b -= offset;
}

if (fitW) {
r = Math.min(Math.max(0, r), this._pw);
l = Math.min(Math.max(0, l), this._pw);
}
if(this.get("adjustBulletPosition")){
if (fitW) {
r = Math.min(Math.max(0, r), this._pw);
l = Math.min(Math.max(0, l), this._pw);
}

if (fitH) {
t = Math.min(Math.max(0, t), this._ph);
b = Math.min(Math.max(0, b), this._ph);
if (fitH) {
t = Math.min(Math.max(0, t), this._ph);
b = Math.min(Math.max(0, b), this._ph);
}
}

dataItem.setRaw("left", l);
Expand Down
8 changes: 6 additions & 2 deletions src/.internal/charts/xy/series/XYSeries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -407,9 +407,13 @@ export interface IXYSeriesSettings extends ISeriesSettings {
maskBullets?: boolean;

/**
* @todo review
* Whether series' tooltip should inherit its color from series or its first
* bullet.
*
* @default "series"
*/
seriesTooltipTarget?: "series" | "bullet"
seriesTooltipTarget?: "series" | "bullet";

}

export interface IXYSeriesPrivate extends ISeriesPrivate {
Expand Down
24 changes: 23 additions & 1 deletion src/.internal/core/render/Slice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,16 @@ export interface ISliceSettings extends IGraphicsSettings {
*/
shiftRadius?: number;

/**
* @todo review
*/
dRadius?: number;

/**
* @todo review
*/
dInnerRadius?: number;

}

export interface ISlicePrivate extends IGraphicsPrivate {
Expand Down Expand Up @@ -85,6 +95,12 @@ export class Slice extends Graphics {
let radius = this.get("radius", 0);
let innerRadius = this.get("innerRadius", 0);

let dRadius = this.get("dRadius", 0);
let dInnerRadius = this.get("dInnerRadius", 0);

radius += dRadius;
innerRadius += dInnerRadius;

if (innerRadius < 0) {
innerRadius = radius + innerRadius;
}
Expand All @@ -108,7 +124,7 @@ export class Slice extends Graphics {
public _beforeChanged() {
super._beforeChanged();

if (this.isDirty("radius") || this.isDirty("arc") || this.isDirty("innerRadius") || this.isDirty("startAngle") || this.isDirty("cornerRadius")) {
if (this.isDirty("radius") || this.isDirty("arc") || this.isDirty("innerRadius") || this.isDirty("startAngle") || this.isDirty("dRadius") || this.isDirty("dInnerRadius") || this.isDirty("cornerRadius")) {
this._clear = true;
}
}
Expand All @@ -127,6 +143,12 @@ export class Slice extends Graphics {
let radius = this.get("radius", 0);
let innerRadius = this.get("innerRadius", 0);

let dRadius = this.get("dRadius", 0);
let dInnerRadius = this.get("dInnerRadius", 0);

radius += dRadius;
innerRadius += dInnerRadius;

if (innerRadius < 0) {
innerRadius = radius + innerRadius;
}
Expand Down
3 changes: 2 additions & 1 deletion src/.internal/core/render/Sprite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -489,14 +489,15 @@ export interface ISpritePrivate extends IEntityPrivate {
focusElement?: HTMLDivElement;

/**
* @todo review
* An element tooltip should inherit its colors from.
*/
tooltipTarget?: Graphics;

/**
* @ignore
*/
list?: ListTemplate<Sprite>;

}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/.internal/core/util/List.ts
Original file line number Diff line number Diff line change
Expand Up @@ -428,8 +428,8 @@ export class List<T> {


/**
* A version of a [[List]] where the elements are disposed automatically when removed from the list, unless autoDispose is set to false.
* @todo review
* A version of a [[List]] where the elements are disposed automatically when
* removed from the list, unless `autoDispose` is set to `false`.
*/
export class ListAutoDispose<A extends IDisposer> extends List<A> implements IDisposer {
/**
Expand Down
4 changes: 3 additions & 1 deletion src/.internal/themes/DefaultTheme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,9 @@ export class DefaultTheme extends Theme {
});

r("Slice").setAll({
shiftRadius: 0
shiftRadius: 0,
dRadius:0,
dInnerRadius:0
});

{
Expand Down

0 comments on commit 39a026e

Please sign in to comment.