Skip to content

Commit

Permalink
Version 5.5.2
Browse files Browse the repository at this point in the history
  • Loading branch information
martynasma committed Oct 27, 2023
1 parent 9c9ac8b commit 3085229
Show file tree
Hide file tree
Showing 47 changed files with 1,496 additions and 1,125 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.5.1",
"version": "5.5.2",
"author": "amCharts <contact@amcharts.com> (https://www.amcharts.com/)",
"description": "amCharts 5",
"homepage": "https://www.amcharts.com/",
Expand Down
3 changes: 3 additions & 0 deletions packages/geodata/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ adhere to [Semantic Versioning](http://semver.org/spec/v2.0.0.html) rules.
### Changed
- Updated Hormozgan province name in the maps of Iran.

### Fixed
- Fixed the ID of the Dādra and Nagar Haveli and Damān and Diu province in India 2020 maps.


## [5.1.1] - 2023-06-01

Expand Down
22 changes: 22 additions & 0 deletions packages/shared/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,28 @@ 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.5.2] - 2023-10-27

### Added
- `customValue` added to `ISeriesDataItem` and `customValueField` to `Series`. Allows storing additional numeric information which could be used for heat rules and other purposes.
- A middle line between oversold and overbought added to `StockChart`'s RSI indicator.
- While drawing polygon in a `StockChart`, a line is drawn from the previous point to mouse pointer.
- New setting `scrollable` (default: `false`) added to `StockChart`'s `DropdownList` and `DropdownListControl` (as well as other controls that extend those, e.g. `ComparisonControl`). If set to `true`, will autoamtically limit dropdown height to fit into chart, and will show scrollbar if the contents do not fit.
- Measure tool added to `StockChart` (as a drawing item).
- `toolSettings` setting added to `DrawingControl`. Allows passing in default settings for each drawing tool. [More info](https://www.amcharts.com/docs/v5/charts/stock/toolbar/drawing-control/#Tool_settings).

### Changed
- Printing via `ExportingMenu` print functionality using "CSS" print method will now temporarily remove all margins and padding on `body` so that images that do not fit into single page do not produce a blank page.
- `StockChart`'s Fibonacci drawing tool now draws from initial click point to the mouse pointer instead of to the right of the plot area.
- `StockChart`'s Fibonacci drawing tool's click point is now at 1 value (was at 0).
- Most of drawing tools of `StockChart` now support snapping to data items.
- Snapping to data items in `StockChart` drawing tools is now turned off by default.

### Fixed
- If an axis range was created for a `ColumnSeries` after series was inited, columns for the range were not being created.
- `GaplessDateAxis` valueToPosition method was returning wrong position if value was less than min value of the axis.
- Unserializing indicators and drawings that create separate panel in a `StockChart` would not restore drawings in indicator's panel.


## [5.5.1] - 2023-10-19

Expand Down
65 changes: 50 additions & 15 deletions src/.internal/charts/stock/StockChartDefaultTheme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,10 @@ export class StockChartDefaultTheme extends Theme {
* ------------------------------------------------------------------------
*/

r("DrawingSeries").setAll({
field: "value"
})


// bullet of all drawing series
{
Expand Down Expand Up @@ -531,6 +535,21 @@ export class StockChartDefaultTheme extends Theme {
rule.states.create("hover", { fillOpacity: 0 })
}

{
const rule = r("Graphics", ["series", "stroke", "drawing", "measure"])
rule.setAll({
strokeOpacity: 0
});
}

r("Line", ["drawing", "measure"]).setAll({
strokeDasharray: [],
strokeWidth: 1,
crisp: true,
strokeOpacity: 0.7,
draggable: false
});

{
const rule = r("Graphics", ["line", "series", "stroke", "drawing"]);
rule.setAll({
Expand Down Expand Up @@ -560,6 +579,19 @@ export class StockChartDefaultTheme extends Theme {
centerY: p50
});

r("Label", ["drawing", "measure"]).setAll({
centerX: p50,
centerY: p50,
fill: ic.get("alternativeText"),
textAlign: "center"
});

r("RoundedRectangle", ["background", "drawing", "measure"]).setAll({
centerX: p50,
centerY: p50,
fillOpacity:0.7
});

r("PointedRectangle", ["drawing", "callout"]).setAll({
fillOpacity: 1,
strokeOpacity: 0
Expand Down Expand Up @@ -601,10 +633,6 @@ export class StockChartDefaultTheme extends Theme {
]
})

r("IconSeries").setAll({
snapToData: true
})

r("Graphics", ["line", "series", "stroke", "drawing", "fibonacci"]).setAll({
forceInactive: true,
strokeWidth: 0.5,
Expand All @@ -627,15 +655,16 @@ export class StockChartDefaultTheme extends Theme {

r("Label", ["fibonaccitimezone"]).setAll({
populateText: true,
text: "{value}",
centerX: p50,
text: "{value.formatNumber('#')}",
centerX: 0,
centerY: p100,
paddingBottom: 2,
paddingLeft:3,
fontSize: "0.8em"
})

r("FibonacciTimezoneSeries").setAll({
sequence: [1, 2, 3, 5, 8, 13, 21, 34, 55, 89],
sequence: [0, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89],
colors: []
})

Expand All @@ -655,15 +684,14 @@ export class StockChartDefaultTheme extends Theme {


r("Grid", ["overbought"]).setAll({
strokeOpacity: 0.3
strokeOpacity: 0.4
});


r("Grid", ["oversold"]).setAll({
strokeOpacity: 0.3,
strokeOpacity: 0.4,
});


// series fill below oversold
r("Graphics", ["rsi", "oversold", "fill"]).setAll({
visible: true,
Expand Down Expand Up @@ -735,7 +763,7 @@ export class StockChartDefaultTheme extends Theme {
r("LineSeries", ["momentum"]).setAll({
legendValueText: "[{seriesColor} bold]{valueY.formatNumber('#.000a')}[/]",
legendLabelText: "{shortName} ({period.formatNumber('#.')},{field})"
})
})

r("LineSeries", ["williamsr"]).setAll({
legendValueText: "[{seriesColor} bold]{valueY.formatNumber('#.000a')}[/]",
Expand Down Expand Up @@ -1070,7 +1098,7 @@ export class StockChartDefaultTheme extends Theme {
period: 14,
field: "close",
seriesColor: color(0xab82da)
})
})

r("WilliamsR").setAll({
name: "Williams %R",
Expand Down Expand Up @@ -1288,7 +1316,7 @@ export class StockChartDefaultTheme extends Theme {
r("DrawingControl").setAll({
name: l.translateAny("Draw"),
tool: "Line",
tools: ["Average", "Callout", "Doodle", "Ellipse", "Fibonacci", "Fibonacci Timezone", "Horizontal Line", "Horizontal Ray", "Arrows &amp; Icons", "Label", "Line", "Polyline", "Quadrant Line", "Rectangle", "Regression", "Trend Line", "Vertical Line"],
tools: ["Arrows &amp; Icons", "Average", "Callout", "Doodle", "Ellipse", "Fibonacci", "Fibonacci Timezone", "Horizontal Line", "Horizontal Ray", "Label", "Line", "Measure", "Polyline", "Quadrant Line", "Rectangle", "Regression", "Trend Line", "Vertical Line"],
togglable: true,
strokeColor: color(0x882dff),
strokeWidth: 2,
Expand All @@ -1298,7 +1326,7 @@ export class StockChartDefaultTheme extends Theme {
strokeOpacity: 1,
showExtension: true,
fillColor: color(0xad6eff),
fillOpacity: 0.5,
fillOpacity: 0.2,
labelFill: color(0x000000),
labelFontSize: "12px",
labelFontSizes: ["8px", "10px", "11px", "12px", "14px", "16px", "20px", "24px", "36px", "48px"],
Expand All @@ -1308,7 +1336,7 @@ export class StockChartDefaultTheme extends Theme {
labelFontFamilies: ["Arial", "Courier New", "Garamond", "Georgia", "Times New Roman"],
drawingIcon: drawingIcons[0],
drawingIcons: drawingIcons,
snapToData: true
snapToData: false
});

r("ColorControl").setAll({
Expand Down Expand Up @@ -1447,5 +1475,12 @@ export class StockChartDefaultTheme extends Theme {
label: l.translateAny("Logarithmic")
}]
});

r("Measure").setAll({
labelText: "{value} ({percent})\n{count.formatNumber('#,###.')} " + l.translateAny("bars") + " {intervalCount.formatNumber('#,###.')} {intervalUnit}",
labelVolumeText: "\nVolume: {volume.formatNumber('#.##a')}",
});

}

}
30 changes: 9 additions & 21 deletions src/.internal/charts/stock/drawing/AverageSeries.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,9 @@
import { SimpleLineSeries, ISimpleLineSeriesSettings, ISimpleLineSeriesPrivate, ISimpleLineSeriesDataItem } from "./SimpleLineSeries";
import * as $math from "../../../core/util/Math";

export interface IAverageSeriesDataItem extends ISimpleLineSeriesDataItem {

}

export interface IAverageSeriesSettings extends ISimpleLineSeriesSettings {

/**
* Value field to use for calculations.
*
* @default "value"
*/
field: "open" | "value" | "low" | "high";

}

export interface IAverageSeriesPrivate extends ISimpleLineSeriesPrivate {
Expand All @@ -30,6 +20,12 @@ export class AverageSeries extends SimpleLineSeries {

protected _tag = "average";

protected _afterNew() {
super._afterNew();
this.setPrivate("allowChangeSnap", false);
this.set("snapToData", true);
}

protected _updateSegment(index: number) {
const dataPoints = this._di[index];
if (dataPoints) {
Expand All @@ -39,13 +35,10 @@ export class AverageSeries extends SimpleLineSeries {
const series = this.get("series");
if (series && diP1 && diP2) {

const xAxis = this.get("xAxis");
let x1 = this._getXValue(diP1.get("valueX" as any));
let x2 = this._getXValue(diP2.get("valueX" as any));

const min = xAxis.getPrivate("min", 0) + 1;
const max = xAxis.getPrivate("max", 1) - 1;

let x1 = Math.round($math.fitToRange(diP1.get("valueX" as any), min, max));
let x2 = Math.round($math.fitToRange(diP2.get("valueX" as any), min, max));
const xAxis = this.get("xAxis");

const di1 = xAxis.getSeriesItem(series, Math.max(0, xAxis.valueToPosition(x1)));
const di2 = xAxis.getSeriesItem(series, Math.min(1, xAxis.valueToPosition(x2)));
Expand Down Expand Up @@ -89,9 +82,4 @@ export class AverageSeries extends SimpleLineSeries {
this._updateElements();
}
}

// need to override so that location would not be set
protected _setXLocation() {

}
}
24 changes: 0 additions & 24 deletions src/.internal/charts/stock/drawing/CalloutSeries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,10 @@ import * as $ease from "../../../core/util/Ease";

export interface ICalloutSeriesDataItem extends ILabelSeriesDataItem {

/**
* Indicates whether callout will attach itself to the closest data item, as
* opposed to exact location of the click.
*/
snapToData?: boolean;

}

export interface ICalloutSeriesSettings extends ILabelSeriesSettings {

/**
* If set to `true`, callout will attach itself to the closest data item, as
* opposed to exact location of the click.
*
* @default true
*/
snapToData?: boolean;

}

export interface ICalloutSeriesPrivate extends ILabelSeriesPrivate {
Expand All @@ -43,10 +29,6 @@ export class CalloutSeries extends LabelSeries {

protected _tag = "callout";

protected _afterNew() {
super._afterNew();
}

protected _tweakBullet2(label: Label, dataItem: DataItem<ICalloutSeriesDataItem>) {
const dataContext = dataItem.dataContext as any;
label.set("background", PointedRectangle.new(this._root, { themeTags: ["callout"] }, dataContext.bgSettings));
Expand Down Expand Up @@ -134,10 +116,4 @@ export class CalloutSeries extends LabelSeries {

return Template.new(template);
}

protected _setXLocation(dataItem: DataItem<this["_dataItemSettings"]>, value: number) {
if (!this.get("snapToData")) {
this._setXLocationReal(dataItem, value);
}
}
}
4 changes: 2 additions & 2 deletions src/.internal/charts/stock/drawing/DoodleSeries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class DoodleSeries extends DrawingSeries {

protected _afterNew() {
super._afterNew();
this.addTag("doodle");
this.setPrivate("allowChangeSnap", false);
this.bullets.clear();
}

Expand All @@ -50,7 +50,7 @@ export class DoodleSeries extends DrawingSeries {
const point = chart.plotContainer.toLocal(event.point);

const valueX = this._getXValue(xAxis.positionToValue(xAxis.coordinateToPosition(point.x)));
const valueY = this._getYValue(yAxis.positionToValue(yAxis.coordinateToPosition(point.y)));
const valueY = this._getYValue(yAxis.positionToValue(yAxis.coordinateToPosition(point.y)), valueX);

const index = this._index;
this.data.push({ valueY: valueY, valueX: valueX, index:index, corner:this._pIndex });
Expand Down
Loading

0 comments on commit 3085229

Please sign in to comment.