@amcharts/amcharts5 5.7.0 → 5.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.internal/charts/stock/indicators/VWAP.d.ts.map +1 -1
- package/.internal/charts/stock/indicators/VWAP.js +17 -15
- package/.internal/charts/stock/indicators/VWAP.js.map +1 -1
- package/.internal/charts/stock/indicators/VolumeProfile.d.ts +5 -0
- package/.internal/charts/stock/indicators/VolumeProfile.d.ts.map +1 -1
- package/.internal/charts/stock/indicators/VolumeProfile.js +197 -191
- package/.internal/charts/stock/indicators/VolumeProfile.js.map +1 -1
- package/.internal/charts/stock/toolbar/DataSaveControl.d.ts +2 -0
- package/.internal/charts/stock/toolbar/DataSaveControl.d.ts.map +1 -1
- package/.internal/charts/stock/toolbar/DataSaveControl.js +39 -23
- package/.internal/charts/stock/toolbar/DataSaveControl.js.map +1 -1
- package/.internal/charts/stock/toolbar/SettingsControl.d.ts.map +1 -1
- package/.internal/charts/stock/toolbar/SettingsControl.js +22 -20
- package/.internal/charts/stock/toolbar/SettingsControl.js.map +1 -1
- package/.internal/core/Registry.js +1 -1
- package/.internal/core/Registry.js.map +1 -1
- package/CHANGELOG.md +10 -0
- package/examples/javascript/flow-arc-horizontal/package.json +1 -1
- package/examples/javascript/flow-arc-vertical/package.json +1 -1
- package/examples/javascript/flow-chord/package.json +1 -1
- package/examples/javascript/flow-chord-directed/package.json +1 -1
- package/examples/javascript/flow-chord-non-ribbon/package.json +1 -1
- package/examples/javascript/flow-sankey/package.json +1 -1
- package/examples/javascript/gauge/package.json +1 -1
- package/examples/javascript/gauge-bands/package.json +1 -1
- package/examples/javascript/hierarchy-force-directed/package.json +1 -1
- package/examples/javascript/hierarchy-pack/package.json +1 -1
- package/examples/javascript/hierarchy-partition/package.json +1 -1
- package/examples/javascript/hierarchy-sunburst/package.json +1 -1
- package/examples/javascript/hierarchy-tree/package.json +1 -1
- package/examples/javascript/hierarchy-treemap/package.json +1 -1
- package/examples/javascript/hierarchy-voronoi-treemap/package.json +1 -1
- package/examples/javascript/jest/package.json +1 -1
- package/examples/javascript/json-pie/package.json +1 -1
- package/examples/javascript/json-xy/package.json +1 -1
- package/examples/javascript/map-animating-along-lines/package.json +1 -1
- package/examples/javascript/map-clustered-points/package.json +1 -1
- package/examples/javascript/map-day-and-night/package.json +1 -1
- package/examples/javascript/map-globe-rotate-to-country/package.json +1 -1
- package/examples/javascript/map-globe-with-projected-circles/package.json +1 -1
- package/examples/javascript/map-with-bubbles/package.json +1 -1
- package/examples/javascript/map-zoom-to-country/package.json +1 -1
- package/examples/javascript/misc-40-charts/package.json +1 -1
- package/examples/javascript/misc-microchart-grid/package.json +1 -1
- package/examples/javascript/pie-chart/package.json +1 -1
- package/examples/javascript/pie-donut-chart/package.json +1 -1
- package/examples/javascript/pie-variable-radius/package.json +1 -1
- package/examples/javascript/radar-column-iwatch-style/package.json +1 -1
- package/examples/javascript/radar-heat-map/package.json +1 -1
- package/examples/javascript/radar-line/package.json +1 -1
- package/examples/javascript/radar-time-line/package.json +1 -1
- package/examples/javascript/sliced-funnel/package.json +1 -1
- package/examples/javascript/sliced-pictorial-stacked/package.json +1 -1
- package/examples/javascript/sliced-pyramid/package.json +1 -1
- package/examples/javascript/stock-chart/package.json +1 -1
- package/examples/javascript/stock-chart-comparing-stocks/package.json +1 -1
- package/examples/javascript/stock-chart-data-granularity/package.json +1 -1
- package/examples/javascript/stock-chart-data-grouping/package.json +1 -1
- package/examples/javascript/stock-chart-intraday/package.json +1 -1
- package/examples/javascript/stock-chart-live/package.json +1 -1
- package/examples/javascript/stock-chart-volume-separate-panel/package.json +1 -1
- package/examples/javascript/venn-diagram/package.json +1 -1
- package/examples/javascript/wordcloud-with-data/package.json +1 -1
- package/examples/javascript/wordcloud-with-text/package.json +1 -1
- package/examples/javascript/xy-100-percent-stacked-column/package.json +1 -1
- package/examples/javascript/xy-animated-bullet-at-the-end-of-the-series/package.json +1 -1
- package/examples/javascript/xy-bubble/package.json +1 -1
- package/examples/javascript/xy-candlestick/package.json +1 -1
- package/examples/javascript/xy-clustered-column/package.json +1 -1
- package/examples/javascript/xy-column/package.json +1 -1
- package/examples/javascript/xy-comparing-series-google-analytics-style/package.json +1 -1
- package/examples/javascript/xy-data-grouping/package.json +1 -1
- package/examples/javascript/xy-draggable-range/package.json +1 -1
- package/examples/javascript/xy-drawing-series-with-mouse-or-touch/package.json +1 -1
- package/examples/javascript/xy-dumbbell plot/package.json +1 -1
- package/examples/javascript/xy-evenly-spaced-date-axis/package.json +1 -1
- package/examples/javascript/xy-line/package.json +1 -1
- package/examples/javascript/xy-line-highlight-on-legend-hover/package.json +1 -1
- package/examples/javascript/xy-live-data/package.json +1 -1
- package/examples/javascript/xy-multiple-synced-value-axes/package.json +1 -1
- package/examples/javascript/xy-ohlc/package.json +1 -1
- package/examples/javascript/xy-real-time-data-sorting/package.json +1 -1
- package/examples/javascript/xy-smoothed-line/package.json +1 -1
- package/examples/javascript/xy-stacked-and-clustered-column/package.json +1 -1
- package/examples/javascript/xy-stacked-column/package.json +1 -1
- package/examples/javascript/xy-stacked-step/package.json +1 -1
- package/examples/javascript/xy-stock/package.json +1 -1
- package/examples/javascript/xy-stock-comparing/package.json +1 -1
- package/examples/typescript/flow-arc-horizontal/package.json +1 -1
- package/examples/typescript/flow-arc-vertical/package.json +1 -1
- package/examples/typescript/flow-chord/package.json +1 -1
- package/examples/typescript/flow-chord-directed/package.json +1 -1
- package/examples/typescript/flow-chord-non-ribbon/package.json +1 -1
- package/examples/typescript/flow-sankey/package.json +1 -1
- package/examples/typescript/gauge/package.json +1 -1
- package/examples/typescript/gauge-bands/package.json +1 -1
- package/examples/typescript/hierarchy-force-directed/package.json +1 -1
- package/examples/typescript/hierarchy-pack/package.json +1 -1
- package/examples/typescript/hierarchy-partition/package.json +1 -1
- package/examples/typescript/hierarchy-sunburst/package.json +1 -1
- package/examples/typescript/hierarchy-tree/package.json +1 -1
- package/examples/typescript/hierarchy-treemap/package.json +1 -1
- package/examples/typescript/hierarchy-voronoi-treemap/package.json +1 -1
- package/examples/typescript/jest/package.json +1 -1
- package/examples/typescript/json-pie/package.json +1 -1
- package/examples/typescript/json-xy/package.json +1 -1
- package/examples/typescript/map-animating-along-lines/package.json +1 -1
- package/examples/typescript/map-clustered-points/package.json +1 -1
- package/examples/typescript/map-day-and-night/package.json +1 -1
- package/examples/typescript/map-globe-rotate-to-country/package.json +1 -1
- package/examples/typescript/map-globe-with-projected-circles/package.json +1 -1
- package/examples/typescript/map-with-bubbles/package.json +1 -1
- package/examples/typescript/map-zoom-to-country/package.json +1 -1
- package/examples/typescript/misc-40-charts/package.json +1 -1
- package/examples/typescript/misc-microchart-grid/package.json +1 -1
- package/examples/typescript/pie-chart/package.json +1 -1
- package/examples/typescript/pie-donut-chart/package.json +1 -1
- package/examples/typescript/pie-variable-radius/package.json +1 -1
- package/examples/typescript/radar-column-iwatch-style/package.json +1 -1
- package/examples/typescript/radar-heat-map/package.json +1 -1
- package/examples/typescript/radar-line/package.json +1 -1
- package/examples/typescript/radar-time-line/package.json +1 -1
- package/examples/typescript/sliced-funnel/package.json +1 -1
- package/examples/typescript/sliced-pictorial-stacked/package.json +1 -1
- package/examples/typescript/sliced-pyramid/package.json +1 -1
- package/examples/typescript/stock-chart/package.json +1 -1
- package/examples/typescript/stock-chart-comparing-stocks/package.json +1 -1
- package/examples/typescript/stock-chart-data-granularity/package.json +1 -1
- package/examples/typescript/stock-chart-data-grouping/package.json +1 -1
- package/examples/typescript/stock-chart-intraday/package.json +1 -1
- package/examples/typescript/stock-chart-live/package.json +1 -1
- package/examples/typescript/stock-chart-volume-separate-panel/package.json +1 -1
- package/examples/typescript/venn-diagram/package.json +1 -1
- package/examples/typescript/wordcloud-with-data/package.json +1 -1
- package/examples/typescript/wordcloud-with-text/package.json +1 -1
- package/examples/typescript/xy-100-percent-stacked-column/package.json +1 -1
- package/examples/typescript/xy-animated-bullet-at-the-end-of-the-series/package.json +1 -1
- package/examples/typescript/xy-bubble/package.json +1 -1
- package/examples/typescript/xy-candlestick/package.json +1 -1
- package/examples/typescript/xy-clustered-column/package.json +1 -1
- package/examples/typescript/xy-column/package.json +1 -1
- package/examples/typescript/xy-comparing-series-google-analytics-style/package.json +1 -1
- package/examples/typescript/xy-data-grouping/package.json +1 -1
- package/examples/typescript/xy-draggable-range/package.json +1 -1
- package/examples/typescript/xy-drawing-series-with-mouse-or-touch/package.json +1 -1
- package/examples/typescript/xy-dumbbell plot/package.json +1 -1
- package/examples/typescript/xy-evenly-spaced-date-axis/package.json +1 -1
- package/examples/typescript/xy-line/package.json +1 -1
- package/examples/typescript/xy-line-highlight-on-legend-hover/package.json +1 -1
- package/examples/typescript/xy-live-data/package.json +1 -1
- package/examples/typescript/xy-multiple-synced-value-axes/package.json +1 -1
- package/examples/typescript/xy-ohlc/package.json +1 -1
- package/examples/typescript/xy-real-time-data-sorting/package.json +1 -1
- package/examples/typescript/xy-smoothed-line/package.json +1 -1
- package/examples/typescript/xy-stacked-and-clustered-column/package.json +1 -1
- package/examples/typescript/xy-stacked-column/package.json +1 -1
- package/examples/typescript/xy-stacked-step/package.json +1 -1
- package/examples/typescript/xy-stock/package.json +1 -1
- package/examples/typescript/xy-stock-comparing/package.json +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VWAP.d.ts","sourceRoot":"","sources":["../../../../../../src/.internal/charts/stock/indicators/VWAP.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAC5H,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAIxD,MAAM,WAAW,aAAc,SAAQ,kBAAkB;CAExD;AAED,MAAM,WAAW,YAAa,SAAQ,iBAAiB;CACtD;AAED,MAAM,WAAW,WAAY,SAAQ,gBAAgB;CACpD;AAED;;;;GAIG;AACH,qBAAa,IAAK,SAAQ,SAAS;IAClC,OAAc,SAAS,EAAE,MAAM,CAAU;IACzC,OAAc,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,CAAiD;IAEzE,SAAS,EAAE,aAAa,CAAC;IACzB,gBAAgB,EAAE,YAAY,CAAC;IAC/B,OAAO,EAAE,WAAW,CAAC;IAEpC;;OAEG;IACY,MAAM,EAAE,UAAU,CAAC;IAE3B,iBAAiB,EAAE,yBAAyB,EAAE,CAalD;IAEH,SAAS,CAAC,SAAS;IAyBnB;;OAEG;IACI,WAAW;
|
|
1
|
+
{"version":3,"file":"VWAP.d.ts","sourceRoot":"","sources":["../../../../../../src/.internal/charts/stock/indicators/VWAP.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAC5H,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAIxD,MAAM,WAAW,aAAc,SAAQ,kBAAkB;CAExD;AAED,MAAM,WAAW,YAAa,SAAQ,iBAAiB;CACtD;AAED,MAAM,WAAW,WAAY,SAAQ,gBAAgB;CACpD;AAED;;;;GAIG;AACH,qBAAa,IAAK,SAAQ,SAAS;IAClC,OAAc,SAAS,EAAE,MAAM,CAAU;IACzC,OAAc,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,CAAiD;IAEzE,SAAS,EAAE,aAAa,CAAC;IACzB,gBAAgB,EAAE,YAAY,CAAC;IAC/B,OAAO,EAAE,WAAW,CAAC;IAEpC;;OAEG;IACY,MAAM,EAAE,UAAU,CAAC;IAE3B,iBAAiB,EAAE,yBAAyB,EAAE,CAalD;IAEH,SAAS,CAAC,SAAS;IAyBnB;;OAEG;IACI,WAAW;CAiDlB"}
|
|
@@ -67,23 +67,25 @@ export class VWAP extends Indicator {
|
|
|
67
67
|
const volumeDI = volumeSeries.dataItems[i];
|
|
68
68
|
if (volumeDI) {
|
|
69
69
|
const volume = volumeDI.get("valueY", 0);
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
70
|
+
if (volume > 0) {
|
|
71
|
+
const vw = dataItem.value_y * volume;
|
|
72
|
+
dataItem.vw = vw;
|
|
73
|
+
dataItem.volume = volume;
|
|
74
|
+
totalVW += vw;
|
|
75
|
+
totalVolume += volume;
|
|
76
|
+
if (i >= period) {
|
|
77
|
+
let volumeToRemove = data[i - period].volume;
|
|
78
|
+
let vwToRemove = data[i - period].vw;
|
|
79
|
+
if (volumeToRemove != null) {
|
|
80
|
+
totalVolume -= volumeToRemove;
|
|
81
|
+
}
|
|
82
|
+
if (vwToRemove != null) {
|
|
83
|
+
totalVW -= vwToRemove;
|
|
84
|
+
}
|
|
83
85
|
}
|
|
86
|
+
dataItem.totalVW = totalVW;
|
|
87
|
+
dataItem.vwap = totalVW / totalVolume;
|
|
84
88
|
}
|
|
85
|
-
dataItem.totalVW = totalVW;
|
|
86
|
-
dataItem.vwap = totalVW / totalVolume;
|
|
87
89
|
}
|
|
88
90
|
i++;
|
|
89
91
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VWAP.js","sourceRoot":"","sources":["../../../../../../src/.internal/charts/stock/indicators/VWAP.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAsF,MAAM,aAAa,CAAC;AAC5H,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAExD,OAAO,KAAK,MAAM,MAAM,0BAA0B,CAAC;AAYnD;;;;GAIG;AACH,MAAM,OAAO,IAAK,SAAQ,SAAS;IAAnC;;QAaC;;;;mBAAwD,CAAC;oBACxD,GAAG,EAAE,QAAQ;oBACb,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,Q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AAC,CAAC,CAAA;gBACF,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;aAC9B;SACD;IACF,CAAC;;AAvGD;;;;WAAkC,MAAM;GAAC;AACzC;;;;WAA0C,SAAS,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;GAAC","sourcesContent":["import { Indicator, IIndicatorSettings, IIndicatorPrivate, IIndicatorEvents, IIndicatorEditableSetting } from \"./Indicator\";\r\nimport { LineSeries } from \"../../xy/series/LineSeries\";\r\n\r\nimport * as $array from \"../../../core/util/Array\";\r\n\r\nexport interface IVWAPSettings extends IIndicatorSettings {\r\n\r\n}\r\n\r\nexport interface IVWAPPrivate extends IIndicatorPrivate {\r\n}\r\n\r\nexport interface IVWAPEvents extends IIndicatorEvents {\r\n}\r\n\r\n/**\r\n * An implementation of a [[StockChart]] indicator.\r\n *\r\n * @see {@link https://www.amcharts.com/docs/v5/charts/stock/indicators/} for more info\r\n */\r\nexport class VWAP extends Indicator {\r\n\tpublic static className: string = \"VWAP\";\r\n\tpublic static classNames: Array<string> = Indicator.classNames.concat([VWAP.className]);\r\n\r\n\tdeclare public _settings: IVWAPSettings;\r\n\tdeclare public _privateSettings: IVWAPPrivate;\r\n\tdeclare public _events: IVWAPEvents;\r\n\r\n\t/**\r\n\t * Indicator series.\r\n\t */\r\n\tdeclare public series: LineSeries;\r\n\r\n\tpublic _editableSettings: IIndicatorEditableSetting[] = [{\r\n\t\tkey: \"period\",\r\n\t\tname: this.root.language.translateAny(\"Period\"),\r\n\t\ttype: \"number\"\r\n\t}, {\r\n\t\tkey: \"seriesColor\",\r\n\t\tname: this.root.language.translateAny(\"Color\"),\r\n\t\ttype: \"color\"\r\n\t}, {\r\n\t\tkey: \"field\",\r\n\t\tname: this.root.language.translateAny(\"Field\"),\r\n\t\ttype: \"dropdown\",\r\n\t\toptions: [\"open\", \"close\", \"low\", \"high\", \"hl/2\", \"hlc/3\", \"hlcc/4\", \"ohlc/4\"]\r\n\t}];\r\n\r\n\tprotected _afterNew() {\r\n\t\tsuper._afterNew();\r\n\r\n\t\tconst stockSeries = this.get(\"stockSeries\");\r\n\t\tconst chart = stockSeries.chart;\r\n\r\n\t\tif (chart) {\r\n\t\t\tconst series = chart.series.push(LineSeries.new(this._root, {\r\n\t\t\t\tvalueXField: \"valueX\",\r\n\t\t\t\tvalueYField: \"vwap\",\r\n\t\t\t\tgroupDataDisabled: true,\r\n\t\t\t\tcalculateAggregates: true,\r\n\t\t\t\txAxis: stockSeries.get(\"xAxis\"),\r\n\t\t\t\tyAxis: stockSeries.get(\"yAxis\"),\r\n\t\t\t\tthemeTags: [\"indicator\", \"vwap\"],\r\n\t\t\t\tname: \"VWAP\"\r\n\t\t\t}))\r\n\r\n\t\t\tseries.setPrivate(\"baseValueSeries\", stockSeries);\r\n\t\t\tthis.series = series;\r\n\r\n\t\t\tthis._handleLegend(series);\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * @ignore\r\n\t */\r\n\tpublic prepareData() {\r\n\t\tif (this.series) {\r\n\t\t\tlet period = this.get(\"period\", Infinity);\r\n\t\t\tconst stockSeries = this.get(\"stockSeries\");\r\n\t\t\tconst volumeSeries = this.get(\"volumeSeries\");\r\n\r\n\t\t\tconst dataItems = stockSeries.dataItems;\r\n\r\n\t\t\tif (volumeSeries) {\r\n\t\t\t\tlet data = this._getDataArray(dataItems);\r\n\t\t\t\tlet i = 0;\r\n\t\t\t\tlet totalVolume = 0;\r\n\t\t\t\tlet totalVW = 0;\r\n\r\n\t\t\t\t$array.each(data, (dataItem) => {\r\n\t\t\t\t\tconst volumeDI = volumeSeries.dataItems[i];\r\n\t\t\t\t\tif (volumeDI) {\r\n\t\t\t\t\t\tconst volume = volumeDI.get(\"valueY\", 0);\r\n\t\t\t\t\t\tif (volume > 0) {\r\n\t\t\t\t\t\t\tconst vw = dataItem.value_y * volume;\r\n\r\n\t\t\t\t\t\t\tdataItem.vw = vw;\r\n\t\t\t\t\t\t\tdataItem.volume = volume;\r\n\r\n\t\t\t\t\t\t\ttotalVW += vw;\r\n\t\t\t\t\t\t\ttotalVolume += volume;\r\n\r\n\t\t\t\t\t\t\tif (i >= period) {\r\n\t\t\t\t\t\t\t\tlet volumeToRemove = data[i - period].volume;\r\n\t\t\t\t\t\t\t\tlet vwToRemove = data[i - period].vw;\r\n\t\t\t\t\t\t\t\tif (volumeToRemove != null) {\r\n\t\t\t\t\t\t\t\t\ttotalVolume -= volumeToRemove;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\tif (vwToRemove != null) {\r\n\t\t\t\t\t\t\t\t\ttotalVW -= vwToRemove;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\tdataItem.totalVW = totalVW;\r\n\t\t\t\t\t\t\tdataItem.vwap = totalVW / totalVolume;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\ti++;\r\n\t\t\t\t})\r\n\t\t\t\tthis.series.data.setAll(data);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Color } from "../../../core/util/Color";
|
|
2
2
|
import type { Graphics } from "../../../core/render/Graphics";
|
|
3
|
+
import type { XYSeries } from "../../xy/series/XYSeries";
|
|
3
4
|
import { AxisRendererX } from "../../xy/axes/AxisRendererX";
|
|
4
5
|
import { ValueAxis } from "../../xy/axes/ValueAxis";
|
|
5
6
|
import { Indicator, IIndicatorSettings, IIndicatorPrivate, IIndicatorEvents, IIndicatorEditableSetting } from "./Indicator";
|
|
@@ -43,6 +44,10 @@ export interface IVolumeProfileSettings extends IIndicatorSettings {
|
|
|
43
44
|
* @default .7
|
|
44
45
|
*/
|
|
45
46
|
valueAreaOpacity?: number;
|
|
47
|
+
/**
|
|
48
|
+
* Chart's main volume series.
|
|
49
|
+
*/
|
|
50
|
+
volumeSeries: XYSeries;
|
|
46
51
|
}
|
|
47
52
|
export interface IVolumeProfilePrivate extends IIndicatorPrivate {
|
|
48
53
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VolumeProfile.d.ts","sourceRoot":"","sources":["../../../../../../src/.internal/charts/stock/indicators/VolumeProfile.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"VolumeProfile.d.ts","sourceRoot":"","sources":["../../../../../../src/.internal/charts/stock/indicators/VolumeProfile.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEzD,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAC5H,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAK5D,MAAM,WAAW,sBAAuB,SAAQ,kBAAkB;IACjE;;OAEG;IACH,OAAO,CAAC,EAAE,KAAK,CAAC;IAEhB;;OAEG;IACH,SAAS,CAAC,EAAE,KAAK,CAAC;IAElB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAE7B;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B;;OAEG;IACH,YAAY,EAAE,QAAQ,CAAC;CACvB;AAED,MAAM,WAAW,qBAAsB,SAAQ,iBAAiB;CAC/D;AAED,MAAM,WAAW,oBAAqB,SAAQ,gBAAgB;CAC7D;AAED;;;;;GAKG;AACH,qBAAa,aAAc,SAAQ,SAAS;IAC3C,OAAc,SAAS,EAAE,MAAM,CAAmB;IAClD,OAAc,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,CAA0D;IAElF,SAAS,EAAE,sBAAsB,CAAC;IAClC,gBAAgB,EAAE,qBAAqB,CAAC;IACxC,OAAO,EAAE,oBAAoB,CAAC;IAE7C;;OAEG;IACY,MAAM,EAAE,YAAY,CAAC;IAE7B,iBAAiB,EAAE,yBAAyB,EAAE,CA4BlD;IAEI,KAAK,EAAG,SAAS,CAAC,aAAa,CAAC,CAAC;IAEjC,QAAQ,EAAG,YAAY,CAAC;IAE/B,SAAS,CAAC,eAAe,CAAC,EAAE,QAAQ,CAAC;IAErC,SAAS,CAAC,SAAS;IA6EnB,SAAS,CAAC,iBAAiB,CAAC,MAAM,EAAE,YAAY;IAmDzC,eAAe,IAAI,IAAI;IA4B9B;;OAEG;IACI,WAAW;IAwQlB,SAAS,CAAC,QAAQ;CAUlB"}
|
|
@@ -88,6 +88,8 @@ export class VolumeProfile extends Indicator {
|
|
|
88
88
|
this.xAxis = chart.xAxes.push(ValueAxis.new(root, {
|
|
89
89
|
zoomable: false,
|
|
90
90
|
strictMinMax: true,
|
|
91
|
+
panX: false,
|
|
92
|
+
panY: false,
|
|
91
93
|
renderer: xRenderer
|
|
92
94
|
}));
|
|
93
95
|
if (yAxis.get("renderer").get("opposite")) {
|
|
@@ -174,24 +176,26 @@ export class VolumeProfile extends Indicator {
|
|
|
174
176
|
});
|
|
175
177
|
}
|
|
176
178
|
_updateChildren() {
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
this.
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
179
|
+
if (this.series) {
|
|
180
|
+
super._updateChildren();
|
|
181
|
+
if (this.isDirty("count") || this.isDirty("countType") || this.isDirty("valueArea")) {
|
|
182
|
+
this.markDataDirty();
|
|
183
|
+
}
|
|
184
|
+
if (this.isDirty("upColor")) {
|
|
185
|
+
const upColor = this.get("upColor");
|
|
186
|
+
this.upSeries.set("fill", upColor);
|
|
187
|
+
this.upSeries.set("stroke", upColor);
|
|
188
|
+
this.setCustomData("upColor", upColor);
|
|
189
|
+
}
|
|
190
|
+
if (this.isDirty("downColor")) {
|
|
191
|
+
const downColor = this.get("downColor");
|
|
192
|
+
this.series.set("fill", downColor);
|
|
193
|
+
this.series.set("stroke", downColor);
|
|
194
|
+
this.setCustomData("downColor", downColor);
|
|
195
|
+
}
|
|
196
|
+
if (this.isDirty("axisWidth")) {
|
|
197
|
+
this.xAxis.set("width", percent(this.get("axisWidth", 40)));
|
|
198
|
+
}
|
|
195
199
|
}
|
|
196
200
|
}
|
|
197
201
|
/**
|
|
@@ -200,7 +204,7 @@ export class VolumeProfile extends Indicator {
|
|
|
200
204
|
prepareData() {
|
|
201
205
|
const volumeSeries = this.get("volumeSeries");
|
|
202
206
|
const stockSeries = this.get("stockSeries");
|
|
203
|
-
if (volumeSeries) {
|
|
207
|
+
if (volumeSeries && this.series) {
|
|
204
208
|
let startIndex = volumeSeries.startIndex();
|
|
205
209
|
let endIndex = volumeSeries.endIndex();
|
|
206
210
|
const count = this.get("count", 20);
|
|
@@ -222,209 +226,211 @@ export class VolumeProfile extends Indicator {
|
|
|
222
226
|
}
|
|
223
227
|
}
|
|
224
228
|
}
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
index
|
|
253
|
-
|
|
254
|
-
if ($type.isNumber(index)) {
|
|
255
|
-
if (previousDataItem && previousDataItem.get("valueY", close) < close) {
|
|
256
|
-
rowDataDown[index] += volume;
|
|
229
|
+
if (min != Infinity) {
|
|
230
|
+
let rows;
|
|
231
|
+
if (type == "ticks") {
|
|
232
|
+
step = count / 100;
|
|
233
|
+
min = Math.floor(min / step) * step;
|
|
234
|
+
max = Math.ceil(max / step) * step;
|
|
235
|
+
rows = (max - min) / step;
|
|
236
|
+
}
|
|
237
|
+
else {
|
|
238
|
+
step = (max - min) / count;
|
|
239
|
+
rows = count;
|
|
240
|
+
}
|
|
241
|
+
const rowDataDown = [];
|
|
242
|
+
const rowDataUp = [];
|
|
243
|
+
for (let i = 0; i < rows; i++) {
|
|
244
|
+
rowDataDown[i] = 0;
|
|
245
|
+
rowDataUp[i] = 0;
|
|
246
|
+
}
|
|
247
|
+
let previousDataItem;
|
|
248
|
+
for (let i = startIndex; i < endIndex; i++) {
|
|
249
|
+
const dataItem = stockSeries.dataItems[i];
|
|
250
|
+
const volumeDataItem = volumeSeries.dataItems[i];
|
|
251
|
+
if (dataItem && volumeDataItem) {
|
|
252
|
+
const close = dataItem.get("valueY");
|
|
253
|
+
const volume = volumeDataItem.get("valueY");
|
|
254
|
+
if ($type.isNumber(close) && $type.isNumber(volume)) {
|
|
255
|
+
let index = Math.floor((close - min) / step);
|
|
256
|
+
if (index == count) {
|
|
257
|
+
index = count - 1;
|
|
257
258
|
}
|
|
258
|
-
|
|
259
|
-
|
|
259
|
+
if ($type.isNumber(index)) {
|
|
260
|
+
if (previousDataItem && previousDataItem.get("valueY", close) < close) {
|
|
261
|
+
rowDataDown[index] += volume;
|
|
262
|
+
}
|
|
263
|
+
else {
|
|
264
|
+
rowDataUp[index] += volume;
|
|
265
|
+
}
|
|
260
266
|
}
|
|
261
267
|
}
|
|
268
|
+
previousDataItem = dataItem;
|
|
262
269
|
}
|
|
263
|
-
previousDataItem = dataItem;
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
const dataDown = [];
|
|
267
|
-
let sum = 0;
|
|
268
|
-
for (let i = 0; i < rows; i++) {
|
|
269
|
-
let total = rowDataUp[i] + rowDataDown[i];
|
|
270
|
-
sum += total;
|
|
271
|
-
dataDown.push({
|
|
272
|
-
yOpen: min + i * step,
|
|
273
|
-
y: min + (i + 1) * step,
|
|
274
|
-
up: rowDataUp[i],
|
|
275
|
-
down: rowDataDown[i],
|
|
276
|
-
total: total,
|
|
277
|
-
xOpen: 0,
|
|
278
|
-
area: false
|
|
279
|
-
});
|
|
280
|
-
}
|
|
281
|
-
let len = this.series.data.length;
|
|
282
|
-
if (len == dataDown.length) {
|
|
283
|
-
for (let i = 0; i < len; i++) {
|
|
284
|
-
this.series.data.setIndex(i, dataDown[i]);
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
else {
|
|
288
|
-
this.series.data.setAll(dataDown);
|
|
289
|
-
}
|
|
290
|
-
const dataUp = [];
|
|
291
|
-
let highest = 0;
|
|
292
|
-
let hi = 0;
|
|
293
|
-
for (let i = 0; i < rows; i++) {
|
|
294
|
-
let total = rowDataUp[i] + rowDataDown[i];
|
|
295
|
-
dataUp.push({
|
|
296
|
-
yOpen: min + i * step,
|
|
297
|
-
y: min + (i + 1) * step,
|
|
298
|
-
up: rowDataUp[i],
|
|
299
|
-
down: rowDataDown[i],
|
|
300
|
-
total: total,
|
|
301
|
-
area: false
|
|
302
|
-
});
|
|
303
|
-
if (total > highest) {
|
|
304
|
-
highest = total;
|
|
305
|
-
hi = i;
|
|
306
270
|
}
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
let sumAbove = 0
|
|
322
|
-
if (rowAbove1 < dlen) {
|
|
323
|
-
sumAbove += dataUp[rowAbove1].total;
|
|
271
|
+
const dataDown = [];
|
|
272
|
+
let sum = 0;
|
|
273
|
+
for (let i = 0; i < rows; i++) {
|
|
274
|
+
let total = rowDataUp[i] + rowDataDown[i];
|
|
275
|
+
sum += total;
|
|
276
|
+
dataDown.push({
|
|
277
|
+
yOpen: min + i * step,
|
|
278
|
+
y: min + (i + 1) * step,
|
|
279
|
+
up: rowDataUp[i],
|
|
280
|
+
down: rowDataDown[i],
|
|
281
|
+
total: total,
|
|
282
|
+
xOpen: 0,
|
|
283
|
+
area: false
|
|
284
|
+
});
|
|
324
285
|
}
|
|
325
|
-
|
|
326
|
-
|
|
286
|
+
let len = this.series.data.length;
|
|
287
|
+
if (len && len == dataDown.length) {
|
|
288
|
+
for (let i = 0; i < len; i++) {
|
|
289
|
+
this.series.data.setIndex(i, dataDown[i]);
|
|
290
|
+
}
|
|
327
291
|
}
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
let rowBelow2 = hi - cd - 1;
|
|
331
|
-
|
|
332
|
-
let sumBelow = 0
|
|
333
|
-
if (rowBelow1 >= 0) {
|
|
334
|
-
sumBelow += dataUp[rowBelow1].total;
|
|
292
|
+
else {
|
|
293
|
+
this.series.data.setAll(dataDown);
|
|
335
294
|
}
|
|
336
|
-
|
|
337
|
-
|
|
295
|
+
const dataUp = [];
|
|
296
|
+
let highest = 0;
|
|
297
|
+
let hi = 0;
|
|
298
|
+
for (let i = 0; i < rows; i++) {
|
|
299
|
+
let total = rowDataUp[i] + rowDataDown[i];
|
|
300
|
+
dataUp.push({
|
|
301
|
+
yOpen: min + i * step,
|
|
302
|
+
y: min + (i + 1) * step,
|
|
303
|
+
up: rowDataUp[i],
|
|
304
|
+
down: rowDataDown[i],
|
|
305
|
+
total: total,
|
|
306
|
+
area: false
|
|
307
|
+
});
|
|
308
|
+
if (total > highest) {
|
|
309
|
+
highest = total;
|
|
310
|
+
hi = i;
|
|
311
|
+
}
|
|
338
312
|
}
|
|
313
|
+
let valueArea = sum * this.get("valueArea", 70) / 100;
|
|
314
|
+
let area = highest;
|
|
315
|
+
let cd = 1;
|
|
316
|
+
let cu = 1;
|
|
317
|
+
let dlen = dataUp.length;
|
|
318
|
+
dataUp[hi].area = true;
|
|
319
|
+
dataDown[hi].area = true;
|
|
320
|
+
/*
|
|
321
|
+
// with two rows
|
|
322
|
+
while (area < valueArea) {
|
|
323
|
+
let rowAbove1 = hi + cu;
|
|
324
|
+
let rowAbove2 = hi + cu + 1;
|
|
339
325
|
|
|
340
|
-
|
|
341
|
-
area += sumAbove;
|
|
326
|
+
let sumAbove = 0
|
|
342
327
|
if (rowAbove1 < dlen) {
|
|
343
|
-
|
|
344
|
-
dataUp[rowAbove1].area = true;
|
|
345
|
-
cu++;
|
|
328
|
+
sumAbove += dataUp[rowAbove1].total;
|
|
346
329
|
}
|
|
347
330
|
if (rowAbove2 < dlen) {
|
|
348
|
-
|
|
349
|
-
dataUp[rowAbove2].area = true;
|
|
350
|
-
cu++;
|
|
331
|
+
sumAbove += dataUp[rowAbove2].total;
|
|
351
332
|
}
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
333
|
+
|
|
334
|
+
let rowBelow1 = hi - cd;
|
|
335
|
+
let rowBelow2 = hi - cd - 1;
|
|
336
|
+
|
|
337
|
+
let sumBelow = 0
|
|
355
338
|
if (rowBelow1 >= 0) {
|
|
356
|
-
|
|
357
|
-
dataUp[rowBelow1].area = true;
|
|
358
|
-
cd++;
|
|
339
|
+
sumBelow += dataUp[rowBelow1].total;
|
|
359
340
|
}
|
|
360
341
|
if (rowBelow2 >= 0) {
|
|
361
|
-
|
|
362
|
-
dataUp[rowBelow2].area = true;
|
|
363
|
-
cd++;
|
|
342
|
+
sumBelow += dataUp[rowBelow2].total;
|
|
364
343
|
}
|
|
365
|
-
}
|
|
366
344
|
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
345
|
+
if (sumBelow <= sumAbove) {
|
|
346
|
+
area += sumAbove;
|
|
347
|
+
if (rowAbove1 < dlen) {
|
|
348
|
+
dataDown[rowAbove1].area = true;
|
|
349
|
+
dataUp[rowAbove1].area = true;
|
|
350
|
+
cu++;
|
|
351
|
+
}
|
|
352
|
+
if (rowAbove2 < dlen) {
|
|
353
|
+
dataDown[rowAbove2].area = true;
|
|
354
|
+
dataUp[rowAbove2].area = true;
|
|
355
|
+
cu++;
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
else {
|
|
359
|
+
area += sumBelow;
|
|
360
|
+
if (rowBelow1 >= 0) {
|
|
361
|
+
dataDown[rowBelow1].area = true;
|
|
362
|
+
dataUp[rowBelow1].area = true;
|
|
363
|
+
cd++;
|
|
364
|
+
}
|
|
365
|
+
if (rowBelow2 >= 0) {
|
|
366
|
+
dataDown[rowBelow2].area = true;
|
|
367
|
+
dataUp[rowBelow2].area = true;
|
|
368
|
+
cd++;
|
|
369
|
+
}
|
|
370
|
+
}
|
|
373
371
|
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
372
|
+
if (sumBelow == 0) {
|
|
373
|
+
cd++;
|
|
374
|
+
}
|
|
375
|
+
if (sumAbove == 0) {
|
|
376
|
+
cu++;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
if ((cd > dlen && cu > dlen)) {
|
|
380
|
+
break;
|
|
381
|
+
}
|
|
377
382
|
|
|
378
|
-
}
|
|
379
|
-
*/
|
|
380
|
-
// single row
|
|
381
|
-
while (area < valueArea) {
|
|
382
|
-
let rowAbove1 = hi + cu;
|
|
383
|
-
let sumAbove = 0;
|
|
384
|
-
if (rowAbove1 < dlen) {
|
|
385
|
-
sumAbove += dataUp[rowAbove1].total;
|
|
386
|
-
}
|
|
387
|
-
let rowBelow1 = hi - cd;
|
|
388
|
-
let sumBelow = 0;
|
|
389
|
-
if (rowBelow1 >= 0) {
|
|
390
|
-
sumBelow += dataUp[rowBelow1].total;
|
|
391
383
|
}
|
|
392
|
-
|
|
393
|
-
|
|
384
|
+
*/
|
|
385
|
+
// single row
|
|
386
|
+
while (area < valueArea) {
|
|
387
|
+
let rowAbove1 = hi + cu;
|
|
388
|
+
let sumAbove = 0;
|
|
394
389
|
if (rowAbove1 < dlen) {
|
|
395
|
-
|
|
396
|
-
dataUp[rowAbove1].area = true;
|
|
397
|
-
cu++;
|
|
390
|
+
sumAbove += dataUp[rowAbove1].total;
|
|
398
391
|
}
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
area += sumBelow;
|
|
392
|
+
let rowBelow1 = hi - cd;
|
|
393
|
+
let sumBelow = 0;
|
|
402
394
|
if (rowBelow1 >= 0) {
|
|
403
|
-
|
|
404
|
-
|
|
395
|
+
sumBelow += dataUp[rowBelow1].total;
|
|
396
|
+
}
|
|
397
|
+
if (sumBelow <= sumAbove) {
|
|
398
|
+
area += sumAbove;
|
|
399
|
+
if (rowAbove1 < dlen) {
|
|
400
|
+
dataDown[rowAbove1].area = true;
|
|
401
|
+
dataUp[rowAbove1].area = true;
|
|
402
|
+
cu++;
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
else {
|
|
406
|
+
area += sumBelow;
|
|
407
|
+
if (rowBelow1 >= 0) {
|
|
408
|
+
dataDown[rowBelow1].area = true;
|
|
409
|
+
dataUp[rowBelow1].area = true;
|
|
410
|
+
cd++;
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
if (sumBelow == 0) {
|
|
405
414
|
cd++;
|
|
406
415
|
}
|
|
416
|
+
if (sumAbove == 0) {
|
|
417
|
+
cu++;
|
|
418
|
+
}
|
|
419
|
+
if ((cd > dlen && cu > dlen)) {
|
|
420
|
+
break;
|
|
421
|
+
}
|
|
407
422
|
}
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
if ((cd > dlen && cu > dlen)) {
|
|
415
|
-
break;
|
|
423
|
+
area = Math.ceil(area);
|
|
424
|
+
len = this.upSeries.data.length;
|
|
425
|
+
if (len > 0 && len == dataUp.length) {
|
|
426
|
+
for (let i = 0; i < len; i++) {
|
|
427
|
+
this.upSeries.data.setIndex(i, dataUp[i]);
|
|
428
|
+
}
|
|
416
429
|
}
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
len = this.upSeries.data.length;
|
|
420
|
-
if (len == dataUp.length) {
|
|
421
|
-
for (let i = 0; i < len; i++) {
|
|
422
|
-
this.upSeries.data.setIndex(i, dataUp[i]);
|
|
430
|
+
else {
|
|
431
|
+
this.upSeries.data.setAll(dataUp);
|
|
423
432
|
}
|
|
424
433
|
}
|
|
425
|
-
else {
|
|
426
|
-
this.upSeries.data.setAll(dataUp);
|
|
427
|
-
}
|
|
428
434
|
}
|
|
429
435
|
}
|
|
430
436
|
_dispose() {
|