@amcharts/amcharts5 5.2.16 → 5.2.19
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/map/MapChart.d.ts +14 -0
- package/.internal/charts/map/MapChart.d.ts.map +1 -1
- package/.internal/charts/map/MapChart.js +31 -0
- package/.internal/charts/map/MapChart.js.map +1 -1
- package/.internal/charts/map/MapPointSeries.d.ts.map +1 -1
- package/.internal/charts/map/MapPointSeries.js +4 -0
- package/.internal/charts/map/MapPointSeries.js.map +1 -1
- package/.internal/charts/map/MapSeries.d.ts +2 -0
- package/.internal/charts/map/MapSeries.d.ts.map +1 -1
- package/.internal/charts/map/MapSeries.js.map +1 -1
- package/.internal/charts/stock/drawing/DrawingSeries.d.ts +10 -10
- package/.internal/charts/stock/drawing/DrawingSeries.d.ts.map +1 -1
- package/.internal/charts/stock/drawing/DrawingSeries.js +1 -1
- package/.internal/charts/stock/drawing/DrawingSeries.js.map +1 -1
- package/.internal/charts/stock/indicators/Indicator.d.ts.map +1 -1
- package/.internal/charts/stock/indicators/Indicator.js +15 -0
- package/.internal/charts/stock/indicators/Indicator.js.map +1 -1
- package/.internal/charts/stock/indicators/MovingAverage.d.ts +0 -1
- package/.internal/charts/stock/indicators/MovingAverage.d.ts.map +1 -1
- package/.internal/charts/stock/indicators/MovingAverage.js +0 -20
- package/.internal/charts/stock/indicators/MovingAverage.js.map +1 -1
- package/.internal/charts/stock/indicators/StochasticOscillator.d.ts +2 -2
- package/.internal/charts/stock/indicators/StochasticOscillator.js.map +1 -1
- package/.internal/charts/stock/indicators/VWAP.d.ts +0 -1
- package/.internal/charts/stock/indicators/VWAP.d.ts.map +1 -1
- package/.internal/charts/stock/indicators/VWAP.js +0 -20
- package/.internal/charts/stock/indicators/VWAP.js.map +1 -1
- package/.internal/charts/stock/toolbar/DropdownList.d.ts +1 -0
- package/.internal/charts/stock/toolbar/DropdownList.d.ts.map +1 -1
- package/.internal/charts/stock/toolbar/DropdownList.js +13 -8
- package/.internal/charts/stock/toolbar/DropdownList.js.map +1 -1
- package/.internal/charts/stock/toolbar/IndicatorControl.d.ts +9 -3
- package/.internal/charts/stock/toolbar/IndicatorControl.d.ts.map +1 -1
- package/.internal/charts/stock/toolbar/IndicatorControl.js +33 -6
- package/.internal/charts/stock/toolbar/IndicatorControl.js.map +1 -1
- package/.internal/charts/stock/toolbar/StockToolbarCSS.d.ts.map +1 -1
- package/.internal/charts/stock/toolbar/StockToolbarCSS.js +5 -0
- package/.internal/charts/stock/toolbar/StockToolbarCSS.js.map +1 -1
- package/.internal/charts/xy/XYChart.d.ts +17 -3
- package/.internal/charts/xy/XYChart.d.ts.map +1 -1
- package/.internal/charts/xy/XYChart.js +18 -6
- package/.internal/charts/xy/XYChart.js.map +1 -1
- package/.internal/charts/xy/axes/Axis.d.ts +1 -2
- package/.internal/charts/xy/axes/Axis.d.ts.map +1 -1
- package/.internal/charts/xy/axes/Axis.js +1 -0
- package/.internal/charts/xy/axes/Axis.js.map +1 -1
- package/.internal/charts/xy/axes/CategoryAxis.d.ts.map +1 -1
- package/.internal/charts/xy/axes/CategoryAxis.js +25 -0
- package/.internal/charts/xy/axes/CategoryAxis.js.map +1 -1
- package/.internal/charts/xy/series/XYSeries.d.ts +2 -2
- package/.internal/charts/xy/series/XYSeries.d.ts.map +1 -1
- package/.internal/charts/xy/series/XYSeries.js +35 -35
- package/.internal/charts/xy/series/XYSeries.js.map +1 -1
- package/.internal/core/Root.d.ts.map +1 -1
- package/.internal/core/Root.js +3 -2
- package/.internal/core/Root.js.map +1 -1
- package/.internal/core/render/Container.d.ts.map +1 -1
- package/.internal/core/render/Container.js +12 -0
- package/.internal/core/render/Container.js.map +1 -1
- package/.internal/core/render/HorizontalLayout.d.ts.map +1 -1
- package/.internal/core/render/HorizontalLayout.js +10 -2
- package/.internal/core/render/HorizontalLayout.js.map +1 -1
- package/.internal/core/render/VerticalLayout.d.ts.map +1 -1
- package/.internal/core/render/VerticalLayout.js +10 -2
- package/.internal/core/render/VerticalLayout.js.map +1 -1
- package/.internal/core/util/Color.d.ts +1 -1
- package/.internal/core/util/Color.js +1 -1
- package/.internal/core/util/Color.js.map +1 -1
- package/CHANGELOG.md +34 -0
- 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/jest/README.md +6 -0
- package/examples/javascript/jest/babel.config.js +6 -0
- package/examples/javascript/jest/index.css +11 -0
- package/examples/javascript/jest/index.html +12 -0
- package/examples/javascript/jest/index.js +3 -0
- package/examples/javascript/jest/package.json +30 -0
- package/examples/javascript/jest/src/chart.js +118 -0
- package/examples/javascript/jest/src/chart.test.js +16 -0
- package/examples/javascript/jest/webpack.config.js +38 -0
- package/examples/javascript/json/package.json +1 -1
- package/examples/javascript/map-animating-along-lines/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/index.js +24 -4
- 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-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/jest/README.md +6 -0
- package/examples/typescript/jest/babel.config.js +6 -0
- package/examples/typescript/jest/index.css +11 -0
- package/examples/typescript/jest/index.html +12 -0
- package/examples/typescript/jest/index.ts +3 -0
- package/examples/typescript/jest/package.json +32 -0
- package/examples/typescript/jest/src/chart.test.js +16 -0
- package/examples/typescript/jest/src/chart.ts +118 -0
- package/examples/typescript/jest/tsconfig.json +12 -0
- package/examples/typescript/jest/webpack.config.js +45 -0
- package/examples/typescript/json/package.json +1 -1
- package/examples/typescript/map-animating-along-lines/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/index.ts +24 -4
- 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/index.d.ts +1 -1
- package/index.d.ts.map +1 -1
- package/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<title>amCharts 5 Example - jest</title>
|
|
6
|
+
<link rel="stylesheet" href="index.css" />
|
|
7
|
+
</head>
|
|
8
|
+
<body>
|
|
9
|
+
<div id="chartdiv"></div>
|
|
10
|
+
<script src="dist/index.js"></script>
|
|
11
|
+
</body>
|
|
12
|
+
</html>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"private": true,
|
|
3
|
+
"name": "amcharts5-example-jest",
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"devDependencies": {
|
|
6
|
+
"@amcharts/amcharts5": "^5.2.19",
|
|
7
|
+
"source-map-loader": "^3.0.0",
|
|
8
|
+
"webpack": "^5.1.3",
|
|
9
|
+
"webpack-cli": "^4.1.0",
|
|
10
|
+
"webpack-dev-server": "^3.11.0",
|
|
11
|
+
"@babel/core": "^7.18.10",
|
|
12
|
+
"@babel/preset-env": "^7.18.10",
|
|
13
|
+
"@babel/preset-typescript": "^7.18.6",
|
|
14
|
+
"babel-jest": "^28.1.3",
|
|
15
|
+
"jest-environment-jsdom": "^28.1.3",
|
|
16
|
+
"jest": "^28.1.3",
|
|
17
|
+
"canvas": "^2.9.3"
|
|
18
|
+
},
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "webpack",
|
|
21
|
+
"start": "webpack serve --mode development",
|
|
22
|
+
"test": "jest"
|
|
23
|
+
},
|
|
24
|
+
"jest": {
|
|
25
|
+
"testEnvironment": "jsdom",
|
|
26
|
+
"transformIgnorePatterns": [
|
|
27
|
+
"/node_modules/(?!@amcharts|d3-)"
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import * as am5 from "@amcharts/amcharts5";
|
|
2
|
+
import * as am5xy from "@amcharts/amcharts5/xy";
|
|
3
|
+
import am5themes_Animated from "@amcharts/amcharts5/themes/Animated";
|
|
4
|
+
|
|
5
|
+
export function makeChart() {
|
|
6
|
+
// Create root element
|
|
7
|
+
// https://www.amcharts.com/docs/v5/getting-started/#Root_element
|
|
8
|
+
const root = am5.Root.new("chartdiv");
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
// Set themes
|
|
12
|
+
// https://www.amcharts.com/docs/v5/concepts/themes/
|
|
13
|
+
root.setThemes([
|
|
14
|
+
am5themes_Animated.new(root)
|
|
15
|
+
]);
|
|
16
|
+
|
|
17
|
+
// Specify date fields, so that they are formatted accordingly in tooltips
|
|
18
|
+
// https://www.amcharts.com/docs/v5/concepts/formatters/data-placeholders/#Formatting_placeholders
|
|
19
|
+
root.dateFormatter.setAll({
|
|
20
|
+
dateFields: ["valueX"]
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
// Create chart
|
|
25
|
+
// https://www.amcharts.com/docs/v5/charts/xy-chart/
|
|
26
|
+
const chart = root.container.children.push(am5xy.XYChart.new(root, {
|
|
27
|
+
panX: false,
|
|
28
|
+
panY: false,
|
|
29
|
+
wheelX: "panX",
|
|
30
|
+
wheelY: "zoomX"
|
|
31
|
+
}));
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
// Add cursor
|
|
35
|
+
// https://www.amcharts.com/docs/v5/charts/xy-chart/cursor/
|
|
36
|
+
const cursor = chart.set("cursor", am5xy.XYCursor.new(root, {
|
|
37
|
+
behavior: "zoomX"
|
|
38
|
+
}));
|
|
39
|
+
cursor.lineY.set("visible", false);
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
// Generate random data
|
|
43
|
+
let date = new Date();
|
|
44
|
+
date.setHours(0, 0, 0, 0);
|
|
45
|
+
let value = 100;
|
|
46
|
+
|
|
47
|
+
function generateData() {
|
|
48
|
+
value = Math.round((Math.random() * 10 - 5) + value);
|
|
49
|
+
am5.time.add(date, "day", 1);
|
|
50
|
+
return {
|
|
51
|
+
date: date.getTime(),
|
|
52
|
+
value: value
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function generateDatas(count) {
|
|
57
|
+
const data = [];
|
|
58
|
+
for (let i = 0; i < count; ++i) {
|
|
59
|
+
data.push(generateData());
|
|
60
|
+
}
|
|
61
|
+
return data;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
// Create axes
|
|
66
|
+
// https://www.amcharts.com/docs/v5/charts/xy-chart/axes/
|
|
67
|
+
const xAxis = chart.xAxes.push(am5xy.DateAxis.new(root, {
|
|
68
|
+
maxDeviation: 0.5,
|
|
69
|
+
baseInterval: {
|
|
70
|
+
timeUnit: "day",
|
|
71
|
+
count: 1
|
|
72
|
+
},
|
|
73
|
+
renderer: am5xy.AxisRendererX.new(root, {
|
|
74
|
+
pan:"zoom"
|
|
75
|
+
}),
|
|
76
|
+
tooltip: am5.Tooltip.new(root, {})
|
|
77
|
+
}));
|
|
78
|
+
|
|
79
|
+
const yAxis = chart.yAxes.push(am5xy.ValueAxis.new(root, {
|
|
80
|
+
maxDeviation:1,
|
|
81
|
+
renderer: am5xy.AxisRendererY.new(root, {
|
|
82
|
+
pan:"zoom"
|
|
83
|
+
})
|
|
84
|
+
}));
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
// Add series
|
|
88
|
+
// https://www.amcharts.com/docs/v5/charts/xy-chart/series/
|
|
89
|
+
const series = chart.series.push(am5xy.LineSeries.new(root, {
|
|
90
|
+
name: "Series",
|
|
91
|
+
xAxis: xAxis,
|
|
92
|
+
yAxis: yAxis,
|
|
93
|
+
valueYField: "value",
|
|
94
|
+
valueXField: "date",
|
|
95
|
+
tooltip: am5.Tooltip.new(root, {
|
|
96
|
+
labelText: "{valueX}: {valueY}"
|
|
97
|
+
})
|
|
98
|
+
}));
|
|
99
|
+
|
|
100
|
+
// Add scrollbar
|
|
101
|
+
// https://www.amcharts.com/docs/v5/charts/xy-chart/scrollbars/
|
|
102
|
+
chart.set("scrollbarX", am5.Scrollbar.new(root, {
|
|
103
|
+
orientation: "horizontal"
|
|
104
|
+
}));
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
// Set data
|
|
108
|
+
let data = generateDatas(1200);
|
|
109
|
+
series.data.setAll(data);
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
// Make stuff animate on load
|
|
113
|
+
// https://www.amcharts.com/docs/v5/concepts/animations/#Forcing_appearance_animation
|
|
114
|
+
series.appear(1000);
|
|
115
|
+
chart.appear(1000, 100);
|
|
116
|
+
|
|
117
|
+
return { root, chart };
|
|
118
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Import chart code
|
|
2
|
+
import { makeChart } from "./chart";
|
|
3
|
+
|
|
4
|
+
beforeEach(() => {
|
|
5
|
+
// Create <div> which is needed by the chart
|
|
6
|
+
document.body.innerHTML = `<div id="chartdiv"></div>`;
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
test("chart exists", () => {
|
|
10
|
+
const { root, chart } = makeChart();
|
|
11
|
+
|
|
12
|
+
// Test chart
|
|
13
|
+
expect(root).toBeDefined();
|
|
14
|
+
expect(chart).toBeDefined();
|
|
15
|
+
expect(chart.get("wheelX")).toBe("panX");
|
|
16
|
+
});
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
var $path = require("path");
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
mode: "production",
|
|
5
|
+
|
|
6
|
+
devtool: "source-map",
|
|
7
|
+
|
|
8
|
+
stats: "errors-warnings",
|
|
9
|
+
|
|
10
|
+
target: ["web", "es5"],
|
|
11
|
+
|
|
12
|
+
entry: {
|
|
13
|
+
index: "./index.js",
|
|
14
|
+
},
|
|
15
|
+
|
|
16
|
+
devServer: {
|
|
17
|
+
publicPath: "/dist/",
|
|
18
|
+
liveReload: true,
|
|
19
|
+
overlay: true,
|
|
20
|
+
noInfo: true,
|
|
21
|
+
open: true
|
|
22
|
+
},
|
|
23
|
+
|
|
24
|
+
output: {
|
|
25
|
+
path: $path.join(__dirname, "dist"),
|
|
26
|
+
publicPath: "dist/",
|
|
27
|
+
filename: "[name].js",
|
|
28
|
+
chunkFilename: "[name].js"
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
module: {
|
|
32
|
+
rules: [{
|
|
33
|
+
test: /.js$/,
|
|
34
|
+
use: ["source-map-loader"],
|
|
35
|
+
enforce: "pre"
|
|
36
|
+
}]
|
|
37
|
+
}
|
|
38
|
+
};
|
|
@@ -88,7 +88,7 @@ let valueSeries = mainPanel.series.push(am5xy.CandlestickSeries.new(root, {
|
|
|
88
88
|
xAxis: dateAxis,
|
|
89
89
|
yAxis: valueAxis,
|
|
90
90
|
legendValueText: "open: [bold]{openValueY}[/] high: [bold]{highValueY}[/] low: [bold]{lowValueY}[/] close: [bold]{valueY}[/]",
|
|
91
|
-
legendRangeValueText:""
|
|
91
|
+
legendRangeValueText: ""
|
|
92
92
|
}));
|
|
93
93
|
|
|
94
94
|
|
|
@@ -226,7 +226,27 @@ let comparisonControl = am5stock.ComparisonControl.new(root, {
|
|
|
226
226
|
stockChart: stockChart,
|
|
227
227
|
searchable: true,
|
|
228
228
|
searchCallback: (query) => {
|
|
229
|
-
|
|
229
|
+
var compared = stockChart.getPrivate("comparedSeries", []);
|
|
230
|
+
if (compared.length > 4) {
|
|
231
|
+
return [{
|
|
232
|
+
label: "A maximum of 5 comparisons is already selected. Remove some to add new ones.",
|
|
233
|
+
id: "count",
|
|
234
|
+
info: true
|
|
235
|
+
}];
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
var comparedIds = [];
|
|
239
|
+
am5.array.each(compared, function(series) {
|
|
240
|
+
comparedIds.push(series.get("name"));
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
var list = getTicker(query);
|
|
244
|
+
am5.array.each(list, function(item) {
|
|
245
|
+
if (comparedIds.indexOf(item.id) !== -1) {
|
|
246
|
+
item.disabled = true;
|
|
247
|
+
}
|
|
248
|
+
})
|
|
249
|
+
return list;
|
|
230
250
|
}
|
|
231
251
|
});
|
|
232
252
|
|
|
@@ -234,7 +254,7 @@ comparisonControl.events.on("selected", function(ev) {
|
|
|
234
254
|
addComparingSeries(ev.item.subLabel);
|
|
235
255
|
});
|
|
236
256
|
|
|
237
|
-
function addComparingSeries(label){
|
|
257
|
+
function addComparingSeries(label) {
|
|
238
258
|
let series = am5xy.LineSeries.new(root, {
|
|
239
259
|
name: label,
|
|
240
260
|
valueYField: "Close",
|
|
@@ -245,7 +265,7 @@ function addComparingSeries(label){
|
|
|
245
265
|
legendValueText: "{valueY.formatNumber('#.00')}"
|
|
246
266
|
});
|
|
247
267
|
let comparingSeries = stockChart.addComparingSeries(series);
|
|
248
|
-
loadData(label, [comparingSeries], currentGranularity);
|
|
268
|
+
loadData(label, [comparingSeries], currentGranularity);
|
|
249
269
|
}
|
|
250
270
|
|
|
251
271
|
function getTicker(search) {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"name": "amcharts5-example-xy-animated-bullet-at-the-end-of-the-series",
|
|
4
4
|
"version": "0.1.0",
|
|
5
5
|
"devDependencies": {
|
|
6
|
-
"@amcharts/amcharts5": "^5.2.
|
|
6
|
+
"@amcharts/amcharts5": "^5.2.19",
|
|
7
7
|
"source-map-loader": "^3.0.0",
|
|
8
8
|
"webpack": "^5.1.3",
|
|
9
9
|
"webpack-cli": "^4.1.0",
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"name": "amcharts5-example-xy-comparing-series-google-analytics-style",
|
|
4
4
|
"version": "0.1.0",
|
|
5
5
|
"devDependencies": {
|
|
6
|
-
"@amcharts/amcharts5": "^5.2.
|
|
6
|
+
"@amcharts/amcharts5": "^5.2.19",
|
|
7
7
|
"source-map-loader": "^3.0.0",
|
|
8
8
|
"webpack": "^5.1.3",
|
|
9
9
|
"webpack-cli": "^4.1.0",
|