Bonjour,

En effet, je suis entrain d'afficher mes données en temps-réel sous amchart. Néanmoins, je voulais calculer un nouveau paramètre en fonction des autres colonnes de mon tableau. Je m'explique, mon tableau contient 4 colonnes et je souhaiterais crée une 5ème colonne et dans cette dernière je calcule un nouveau paramètre comme suit : (colonne 3 + colonne 4)/2.

J'ai beaucoup cherché dans le site "amchart " (https://www.amcharts.com/) mais je ne trouve pas d'exemples pareils !

Je vous remercie d'avance de me donner quelques pistes!

Bien cordialement


Voici mon tableau de données :data.txt
Code TXT : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
201906302058	2.103	0.002	25.822
201906302108	2.102	0.001	25.802
201906302118	2.106	0.002	26.154
201906302128	2.085	0.001	26.08
201906302138	2.088	0.004	26.183
201906302148	2.105	0.003	26.176
201906302158	2.098	0.002	26.331
201906302208	2.1	0.002	26.357
201906302218	2.077	0.003	26.291
201906302228	2.072	0.004	26.267
201906302238	2.068	0.004	26.17
201906302248	2.057	0.003	26.206
201906302258	2.037	0.001	26.176
201906302308	2.023	0.002	25.96
201906302318	2.044	0.003	25.9
201906302328	2.036	0.002	25.869
201906302338	2.041	0.005	25.954
201906302348	2.04	0.003	26.007
201906302358	2.038	0.004	25.877
201907010008	2.043	0.005	25.871
201907010018	2.039	0.003	25.898
201907010028	2.037	0.004	25.908
201907010038	2.041	0.002	25.955
201907010048	2.035	0.004	26.004
201907010058	2.029	0.002	26.021
201907010108	2.023	0.002	26.038
201907010118	2.035	0.002	25.873
201907010128	2.034	0.002	26.05
201907010138	2.013	0.002	25.726
201907010148	2.031	0.001	25.77
201907010158	2.022	0.002	25.966
201907010208	2.03	0.005	26.037
201907010218	2.035	0.002	25.976
201907010228	2.051	0.002	25.811
201907010238	2.066	0.002	25.642
201907010248	2.064	0.001	25.758
201907010258	2.047	0.001	25.835
201907010308	2.05	0.002	25.929
201907010318	2.076	0.002	25.631
201907010328	2.074	0.001	25.95
201907010338	2.081	0.002	25.959
201907010348	2.092	0.003	25.955
201907010358	2.112	0.003	25.992
201907010408	2.102	0.002	25.947
201907010418	2.111	0.003	25.974
201907010428	2.09	0.003	25.979
201907010438	2.117	0.002	25.941
201907010448	2.107	0.002	25.927
201907010458	2.105	0.001	25.928
201907010508	2.12	0.003	25.925
201907010518	2.122	0.003	25.915
201907010528	2.118	0.003	25.911
201907010538	2.095	0.003	25.902
201907010548	2.119	0.002	25.926
201907010558	2.118	0.005	26
201907010608	2.132	0.003	26.017
201907010618	2.124	0.002	25.926
201907010628	2.112	0.001	25.919
201907010638	2.122	0.006	25.907
201907010648	2.109	0.003	25.909
201907010658	2.093	0.002	25.982
201907010708	2.083	0.003	25.942


Voici mon code ci-dessous :

Code HTML : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<script src="//www.amcharts.com/lib/4/core.js"></script>
<script src="//www.amcharts.com/lib/4/charts.js"></script>
<div id="chartdiv"></div>
 
<style>
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
}
 
#chartdiv {
  width: 100%;
  height: 300px;
}
</style>
 
<script>
// Create chart instance
var chart = am4core.create("chartdiv", am4charts.XYChart);
 
// Set up data source
 
chart.dataSource.url = "https://..../amchart/data.txt";
chart.dataSource.parser = new am4core.CSVParser();
 
 
chart.dataSource.parser.options.useColumnNames = false;
 
// Create axes
 
var categoryAxis = chart.xAxes.push(new am4charts.CategoryAxis());
categoryAxis.dataFields.category = "col0";
 
// Create value axis
var valueAxis = chart.yAxes.push(new am4charts.ValueAxis());
 
// Create series
var series1 = chart.series.push(new am4charts.LineSeries());
series1.dataFields.valueY = "col1";
series1.dataFields.categoryX = "col0";
series1.name = "P";
series1.strokeWidth = 1;
series1.tensionX = 0.7;
series1.bullets.push(new am4charts.CircleBullet());
 
var series2 = chart.series.push(new am4charts.LineSeries());
series2.dataFields.valueY = "col2";
series2.dataFields.categoryX = "col0";
series2.name = "T";
series2.strokeWidth = 1;
series2.tensionX = 0.7;
series2.bullets.push(new am4charts.CircleBullet());
 
var series3 = chart.series.push(new am4charts.LineSeries());
series3.dataFields.valueY = "col3";
series3.dataFields.categoryX = "col0";
series3.name = "V";
series3.strokeWidth = 1;
series3.tensionX = 0.7;
series3.bullets.push(new am4charts.CircleBullet());
 
// Add legend
chart.legend = new am4charts.Legend();
</script>