-
Notifications
You must be signed in to change notification settings - Fork 0
/
equation-of-time-100.html
794 lines (663 loc) · 24.2 KB
/
equation-of-time-100.html
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
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
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
<!DOCTYPE html>
<html>
<head>
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r125/three.min.js"></script>
<script src="solar.js"></script>
<script src="meuusjs.1.0.3.min.js"></script>
<script src="meeus-easy.js"></script>
<title>Equazione del Tempo - Equation of time</title>
</head>
<body>
<center><big><big><big>Equazione del Tempo - Equation of time</big></big></big><br>
<i>
v. 1.0.0 - 27/06/2023<br>
<a href="https://github.com/jumpjack/heliostat/blob/main/equation-of-time.html">Source code</a><br>
<br>
<br>
</i></center>
<table border = 1>
<tr>
<td>
Equazione del tempo in coordinate cartesiane
</td>
<td>
Camma "a rene" ("kidney cam")
</td>
<td>
Camma Greubel/Forsey
</td>
</tr>
<tr>
<td>
<span id="cartesian-chart" style="width:600px;height:400px;"></span>
</td>
<td>
<span id="polar-chart" style="width:400px;"></span>
<br>
<button onclick="downloadCamProfile(1)">DOWNLOAD PROFILE</button><a target="#" href="https://anyconv.com/it/convertitore-da-png-a-stl/">Click here to convert to STL</a>
</td>
<td>
<span id="polar-chart2" style="width:400px;"></span><br>
<button onclick="downloadCamProfile(2)">DOWNLOAD PROFILE</button><a target="#" href="https://anyconv.com/it/convertitore-da-png-a-stl/">Click here to convert to STL</a>
</td>
</tr>
<tr>
<td>
Equazione del tempo - componente 1<br>
<span id="eot1-chart" style="width:400px;"></span><br>
<br>
<button onclick="downloadCamProfile(4)">DOWNLOAD PROFILE</button><a target="#" href="https://anyconv.com/it/convertitore-da-png-a-stl/">Click here to convert to STL</a>
</td>
<td>
Equazione del tempo - componente 2<br>
<span id="eot2-chart" style="width:400px;"></span><br>
<br>
<button onclick="downloadCamProfile(5)">DOWNLOAD PROFILE</button><a target="#" href="https://anyconv.com/it/convertitore-da-png-a-stl/">Click here to convert to STL</a>
</td>
<td>
</td>
</tr>
<tr>
<td>
Declinazione in coordinate cartesiane:<br>
<span id="cartesian-chart2" style="width:600px;height:400px;"></span>
</td>
<td>
Camma declinazione:<br>
<span id="polar-chart3" style="width:400px;"></span>
<br>
<button onclick="downloadCamProfile(3)">DOWNLOAD PROFILE</button><a target="#" href="https://anyconv.com/it/convertitore-da-png-a-stl/">Click here to convert to STL</a>
</td>
<td>
</td>
</tr>
<tr>
<td>
Analemma Decl/EoT:<br>
<span id="analemma-chart" style="width:400px;"></span>
</td>
<td>
Analemma Alt/Az:<br>
<span id="analemma-chart2" style="width:400px;"></span>
</td>
</tr>
</table><br>
JSON cam profile:<br>
<textarea id="camProfileJSON" cols = 50 rows = 20></textarea><br>
Use this site to import the JSON cam profile above and simulate cam/follower mechanism: <a href="https://jumpjack.github.io/CamFollowerJS/">link</a><br>
<br>
References:<br>
<ul>
<a href="https://equation-of-time.info/">Theory and real mechanisms (cams, gears, clocks,...)</a><br>
<a href="https://www.wikiwand.com/en/equation_of_time">Wikiwand</a><br>
<a href="https://equation-of-time.info/copy-of-equation-clocks-forerunners">Kidney cam, Greubel/Forsey cam</a><br>
<a href="https://equation-of-time.info/cams">Obliquity and Eccentricity cams mechanically summed up</a><br>
<a href="https://www.renatoweb.it/renatomeridiane/gnomon13.htm">Formula di Cooper per declinazione solare</a><br>
<a href="https://www.tecnologica.altervista.org/php5/index.php?title=Declinazione_solare">Formula e valori tabulati</a><br>
<a href="https://www.desmos.com/calculator/hbsrvo4bkv?lang=it">Grafico su Desmos</a><br>
<a href="https://anyconv.com/it/convertitore-da-png-a-stl/">PNG to STL converter</a><br>
</ul>
<script>
// min/max in second column have been manually set after first run of the script
minVal = 9999; minC = -15;
maxVal = -9999; maxC = 16
minValG = 9999; minG = -16;
maxValG = -9999; maxG = 0;
minValK = 9999; minK = -15;
maxValK = -9999; maxK = 16;
minValDc = 9999; minDc = -23;
maxValDc = -9999; maxDc = 23;
minValD = 9999; minD = 15;
maxValD = -9999; maxD = 53;
minValEot1 = 9999; minEot1 = -10;
maxValEot1 = -9999; maxEot1 = 10;
minValEot2 = 9999; minEot2 = -8;
maxValEot2 = -9999; maxEot2 = 8;
const ZERO_OFFSET = 5;
const step = 10;
thisYear = new Date().getFullYear();
capodanno = new Date(thisYear + "/01/01 00:00");
var cartesianData = [];
var cartesianDataDeclination = [];
var polarData = [];
var polarData2 = [];
var polarData3 = [];
var EoTcompo1 = [];
var EoTcompo2 = [];
var analemmaData = [];
var analemmaDataAltAz = [];
var colors = []; // Array di colori per ogni punto
var colorsDownload = [];
downloadPolarLayout = {
polar: {
radialaxis: {
showline: false, showgrid: false, showticklabels: false, ticks: ""
},
angularaxis: {
showline: false, showgrid: false, showticklabels: false, ticks: ""
}
},
mode : "lines",
}
function restoreLayout(c) {
return {
polar: {
radialaxis: {
title: "",
//range: [0, ZERO_OFFSET + 20],
showline: true,
showgrid: true,
showticklabels: true
},
angularaxis: {
showline: true,
showgrid: true,
showticklabels: true
}
},
showlegend : false,
marker :{
symbol: "circle",
size: 4,
colors: c,
}
}
};
function generateData() {
var data = [];
var originalLayout;
for (var dayOfYear = 0; dayOfYear <= 365; dayOfYear += step) {
// 81 is 22nd March
var BB = (2 * Math.PI * (dayOfYear - 81))/365;
var cart1 = 9.87 * Math.sin(2*BB);
var cart2 = 7.53 * Math.cos(BB) + 1.5 * Math.sin(BB);
var cartesianVal = cart1 - cart2;
var B = 360 * (dayOfYear - 81) / 365; // B is in degrees; 360 are degrees; 81 is 22nd March
var compo1 = 9.87 * Math.sin(2*B*Math.PI/180);
var compo2 = 7.53 * Math.cos(B*Math.PI/180) + 1.5 * Math.sin(B*Math.PI/180)
var cartesianVal2 = compo1 - compo2;
var y = 2023;
var component1 = 9.863 * Math.sin( 2 *(6.24004077 + 0.01720197 * (365.25*(y-2000) + dayOfYear)) + 3.5932 );
var component2 = -7.659 * Math.sin( 6.24004077 + 0.01720197 * (365.25*(y-2000) + dayOfYear)) ;
var preciseEoT = component1 + component2;
cartesianVal = preciseEoT;
///// Find EoT min/max values:
if (component1 < minValEot1) {
minValEot1 = component1
}
if (component1 > maxValEot1) {
maxValEot1 = component1
}
if (component2 < minValEot2) {
minValEot2 = component2
}
if (component2 > maxValEot2) {
maxValEot2 = component2
}
///// Find cartesian min/max values:
if (cartesianVal < minVal) {
minVal = cartesianVal
}
if (cartesianVal > maxVal) {
maxVal = cartesianVal
}
///////// kidney /////////
kidneyVal = cartesianVal + ZERO_OFFSET - minK;
///// Find kidney polar min/max values:
if (kidneyVal < minValK) {
minValK = kidneyVal
}
if (kidneyVal > maxValK) {
maxValK = kidneyVal
}
/////// Greubel /////
if (cartesianVal>0) {
var GreubelForseyVal = -cartesianVal + ZERO_OFFSET - minG;
colors.push('red'); // Colore rosso per punti con y > 0
} else {
var GreubelForseyVal = cartesianVal + ZERO_OFFSET - minG;
colors.push('blue'); // Colore blu per punti con y <= 0
}
if (GreubelForseyVal < minValG) {
minValG = GreubelForseyVal
}
if (GreubelForseyVal > maxValG) {
maxValG = GreubelForseyVal
}
///// declination /////
declination = 23.45 * Math.sin(((360*3.14/180)/365) * (284 + dayOfYear)); // Day 284 is 11th October
declinationPolar = declination + ZERO_OFFSET - minDc;
if (declination < minValDc) {
minValDc = declination
}
if (declination > maxValDc) {
maxValDc = declination
}
if (declinationPolar < minValD) {
minValD = declinationPolar
}
if (declinationPolar > maxValD) {
maxValD = declinationPolar
}
lat = 42; // debug
lon = 12; // debug
declinationRad = declination*3.14/180;
T0 = 12;
EoT = cartesianVal;
HA = (15 * (T0 - 12) + EoT)*3.14/180; // Angolo orario
//elevation = (Math.asin(Math.sin(lat) * Math.sin(declinationRad) + Math.cos(lat) * Math.cos(declinationRad) * Math.cos(HA)));
//azimuth = (Math.acos((Math.sin(declinationRad) - Math.sin(elevation) * Math.sin(lat)) / (Math.cos(elevation) * Math.cos(lat))));
sunData = suncalcMeeus(new Date(capodanno.getTime() + dayOfYear * 86400000 +86400000/2), lat,lon, 100);
elevation = sunData.sunAltitudeDegrees;
azimuth = sunData.sunAzimuthDegrees;
colorsDownload = "#AAAAAA";
cartesianData.push({
x: dayOfYear,
y: cartesianVal
});
cartesianDataDeclination.push({
x: dayOfYear,
y: declination
});
polarData.push({ r: kidneyVal, theta: dayOfYear });
polarData2.push({ r: GreubelForseyVal, theta: dayOfYear });
polarData3.push({ r: declinationPolar, theta: dayOfYear });
EoTcompo1.push({ r: component1 + ZERO_OFFSET - minEot1, theta: dayOfYear });
EoTcompo2.push({ r: component2 + ZERO_OFFSET - minEot2, theta: dayOfYear });
analemmaData.push({
x: cartesianVal,
y: declination
});
analemmaDataAltAz.push({
x: azimuth,
y: elevation
});
}
// Cartesian EoT
data.push({
type: "scatter",
mode: 'lines',
marker: {
symbol: 'circle', // Imposta la forma del marcatore a cerchio
size: 2 // Dimensione del cerchietto
},
name: "Cartesian",
x: cartesianData.map((point) => point.x),
y: cartesianData.map((point) => point.y),
});
// kidney cam
data.push({
type: "scatterpolar",
mode: "lines+markers",
marker: {
symbol: 'circle', // Imposta la forma del marcatore a cerchio
size: 4, // Dimensione del cerchietto
color: colors,
},
name: "Polar",
r: polarData.map((point) => point.r),
theta: polarData.map((point) => point.theta),
fill: "toself",
fillcolor: '#AAAAAA'
});
console.log(colors);
// Greubel cam
data.push({
type: "scatterpolar",
mode: "lines+markers",
/* line : {
color: colors,
width : 2,
},
*/
marker: {
symbol: 'circle', // Imposta la forma del marcatore a cerchio
size: 4, // Dimensione del cerchietto
color: colors, // Assegna l'array di colori ai punti
},
name: "Polar2",
r: polarData2.map((point) => point.r),
theta: polarData2.map((point) => point.theta),
fill: "toself",
fillcolor: '#AAAAAA',
});
// declination cartesian
data.push({
type: "scatter",
mode: 'lines',
marker: {
symbol: 'circle', // Imposta la forma del marcatore a cerchio
size: 2 // Dimensione del cerchietto
},
name: "Cartesian",
x: cartesianDataDeclination.map((point) => point.x),
y: cartesianDataDeclination.map((point) => point.y),
});
// declination cam
data.push({
type: "scatterpolar",
mode: "lines+markers",
marker: {
symbol: 'circle', // Imposta la forma del marcatore a cerchio
size: 2, // Dimensione del cerchietto
color: colors, // Assegna l'array di colori ai punti
},
name: "Polar3",
r: polarData3.map((point) => point.r),
theta: polarData3.map((point) => point.theta),
fill: "toself",
fillcolor: '#AAAAAA',
});
// analemma cartesian
data.push({
type: "scatter",
mode: 'lines',
marker: {
symbol: 'circle', // Imposta la forma del marcatore a cerchio
size: 2 // Dimensione del cerchietto
},
name: "Analemma",
x: analemmaData.map((point) => point.x),
y: analemmaData.map((point) => point.y),
});
// analemma cartesian Alt/Az
data.push({
type: "scatter",
mode: 'lines',
marker: {
symbol: 'circle', // Imposta la forma del marcatore a cerchio
size: 2 // Dimensione del cerchietto
},
name: "Analemma alt/az",
x: analemmaDataAltAz.map((point) => point.x),
y: analemmaDataAltAz.map((point) => point.y),
});
// EoT component 1 cam
data.push({
type: "scatterpolar",
mode: "lines+markers",
marker: {
symbol: 'circle', // Imposta la forma del marcatore a cerchio
size: 2, // Dimensione del cerchietto
color: colors, // Assegna l'array di colori ai punti
},
name: "EoT1",
r: EoTcompo1.map((point) => point.r),
theta: EoTcompo1.map((point) => point.theta),
fill: "toself",
fillcolor: '#AAAAAA',
});
// EoT component 2 cam
data.push({
type: "scatterpolar",
mode: "lines+markers",
marker: {
symbol: 'circle', // Imposta la forma del marcatore a cerchio
size: 2, // Dimensione del cerchietto
color: colors, // Assegna l'array di colori ai punti
},
name: "EoT2",
r: EoTcompo2.map((point) => point.r),
theta: EoTcompo2.map((point) => point.theta),
fill: "toself",
fillcolor: '#AAAAAA',
});
return data;
}
function createCartesianChart() {
allData = generateData();
originalCartesianLayout = {
title: "",
xaxis: { title: "Giorno dell'anno" },
yaxis: { title: "" },
};
Plotly.newPlot("cartesian-chart", [allData[0]], originalCartesianLayout).then(function(gd) {
gdCartesian = gd;
// Aggiungi l'evento plotly_hover al primo grafico
gd.on('plotly_hover', function(eventData) {
// Recupera l'indice del marker selezionato nel primo grafico
var indiceMarker = eventData.points[0].pointNumber;
// Recupera le coordinate del marker evidenziato
var x = eventData.points[0].x;
var y = eventData.points[0].y;
// Aggiunge linea verticale nel grafico cartesiano quando passa il mouse:
var lineLayoutUpdate = {
shapes: [
{
type: 'line',
x0: x,
y0: 0,
x1: x,
y1: y ,
line: {
color: 'red',
width: 2
}
}
]
};
Plotly.relayout('cartesian-chart', lineLayoutUpdate);
// Aggiungi la linea dal centro al marker evidenziato nel grafico polare Kidney/1
Plotly.addTraces('polar-chart', {
r: [0, allData[1].r[indiceMarker] ], // Coordinate r della linea (0 per il centro)
theta: [0, x], // Coordinate theta della linea (0 per il centro)
mode: 'lines',
type: "scatterpolar",
line: {
color: 'red',
width: 2
}
});
if (y>0) {
var G = -y;
} else {
var G = y;
}
// Aggiungi la linea dal centro al marker evidenziato nel grafico polare Greubel/2
Plotly.addTraces('polar-chart2', {
r: [0, allData[2].r[indiceMarker] ], // Coordinate r della linea (0 per il centro)
theta: [0, x], // Coordinate theta della linea (0 per il centro)
mode: 'lines',
type: "scatterpolar",
line: {
color: 'red',
width: 2
}
});
});
// Aggiungi l'evento plotly_unhover al primo grafico
gd.on('plotly_unhover', function(eventData) {
Plotly.deleteTraces('polar-chart', [-1]); // Rimuove l'ultima traccia aggiunta
Plotly.deleteTraces('polar-chart2', [-1]); // Rimuove l'ultima traccia aggiunta
});
});
Plotly.newPlot("cartesian-chart2", [allData[3]], originalCartesianLayout);
}
function createPolarChart() {
// Kidney cam
//var data = generateData();
originalPolarLayout = restoreLayout();
Plotly.newPlot("polar-chart", [allData[1]], originalPolarLayout).then(function (gd) {
gdPolar1 = gd;
Plotly.relayout(gd, {aspectratio:1, polar : { radialaxis : {range : [0, maxValK]}}});
addAxis(gd);
});
}
function createPolarChart2() {
// Greubel/Forsey cam
// www.youtube.com/watch?v=hs4Jt44x6Pw
// It can't be used as a real cam because some arcs represent negative values, other represent positive ones, depending on arc color!
//var data = generateData();
originalPolarLayout = restoreLayout();
Plotly.newPlot("polar-chart2", [allData[2]], originalPolarLayout).then(function (gd) {
gdPolar2 = gd;
Plotly.relayout(gd, {aspectratio:1, polar : { radialaxis : {range : [0, maxValG]}} });
//Plotly.restyle(gd, { 'line.color': colors, 'line.width' : 3});
addAxis(gd);
});
}
function createPolarChart3() {
// Declination cam
//var data = generateData();
originalPolarLayout = restoreLayout();
Plotly.newPlot("polar-chart3", [allData[4]], originalPolarLayout).then(function (gd) {
gdPolar3 = gd;
Plotly.relayout(gd, {aspectratio:1, polar : { radialaxis : {range : [0, maxValD]}}});
addAxis(gd);
});
}
function createPolarChartEot1() {
// Declination cam
//var data = generateData();
originalPolarLayout = restoreLayout();
Plotly.newPlot("eot1-chart", [allData[7]], originalPolarLayout).then(function (gd) {
gdPolarEoT1 = gd;
Plotly.relayout(gd, {aspectratio:1, polar : { radialaxis : {range : [0, maxEot1 + ZERO_OFFSET - minEot1]}}});
addAxis(gd);
});
}
function createPolarChartEot2() {
// Declination cam
//var data = generateData();
originalPolarLayout = restoreLayout();
Plotly.newPlot("eot2-chart", [allData[8]], originalPolarLayout).then(function (gd) {
gdPolarEoT2 = gd;
Plotly.relayout(gd, {aspectratio:1, polar : { radialaxis : {range : [0, maxEot2 + ZERO_OFFSET - minEot2]}}});
addAxis(gd);
});
}
function createAnalemmaChart() {
originalCartesianLayout = {
title: "",
xaxis: { title: "EoT" },
yaxis: { title: "Declination" },
};
Plotly.newPlot("analemma-chart", [allData[5]], originalCartesianLayout).then(function(gd) {
gdAnalemma = gd;
});
}
function createAnalemmaAltAzChart() {
originalCartesianLayout = {
title: "",
xaxis: { title: "Azimuth" },
yaxis: { title: "Elevation" },
};
Plotly.newPlot("analemma-chart2", [allData[6]], originalCartesianLayout).then(function(gd) {
gdAnalemmaAltAz = gd;
});
}
function downloadCamProfile(sel) {
if(sel === 1) {
gd = gdPolar1;
name = "kidneyCam";
dataIndex = 1;
JSONexportData = polarData;
}
if(sel === 2) {
gd = gdPolar2;
name = "GreubelCam";
dataIndex = 2;
JSONexportData = polarData2;
}
if(sel === 3) {
gd = gdPolar3;
name = "declinationCam";
dataIndex = 4;
JSONexportData = polarData3;
}
if(sel === 4) {
gd = gdPolarEoT1;
name = "EoT1cam";
dataIndex = 7;
JSONexportData = EoTcompo1;
}
if(sel === 5) {
gd = gdPolarEoT2;
name = "EoT2cam";
dataIndex = 8;
JSONexportData = EoTcompo2;
}
/*
Cam profile format:
{
"segments" : [
{"x" : 30, "y" : 25},
{"x" : 60, "y" : 60},
{"x" : 90, "y" : 50},
{"x" : 95, "y" : 70},
{"x" : 150, "y" : 50},
{"x" : 180, "y" : 70},
{"x" : 210, "y" : 40},
{"x" : 240, "y" : 50},
{"x" : 270, "y" : 20},
{"x" : 300, "y" : 10},
{"x" : 330, "y" : 5},
{"x" : 360, "y" : 0}
],
"rotSpeed": 2,
"stepsWidth": 10,
"rotationDir": 1
}
*/
camProfileJSON.value='{ "segments" : [\n';
for (var i=0; i < JSONexportData.length-1; i++) {
camProfileJSON.value += '{"x" : ' + parseInt(JSONexportData[i].theta.toFixed(0)) + ', "y" : ' + parseInt(JSONexportData[i].r.toFixed(0)) + '},\n';
}
camProfileJSON.value += '{"x" : ' + parseInt(JSONexportData[i].theta.toFixed(0)) + ', "y" : ' + parseInt(JSONexportData[i].r.toFixed(0)) + '}\n'; // without final comma
camProfileJSON.value +=' ],\n "rotSpeed": 2,\n "stepsWidth": ' + step + ', \n"rotationDir": 1}';
// Rimuovi gli assi dal layout del grafico
Plotly.relayout(gd, downloadPolarLayout)
Plotly.update(gd, { mode : "lines" } );
Plotly.restyle(gd , {marker : { color : colorsDownload } });
if (gd.data.length > 1) { // Elimina la linea radiale che punta al marker, se presente
Plotly.deleteTraces(gd, [1]);
}
addAxis(gd);
// Scarica l'immagine del grafico
Plotly.downloadImage(gd, { format: 'png', width: 800, height: 600, filename: name }).then( function() {
// Applica il layout originale per ripristinare gli assi e la griglia visibili
originalPolarLayout = restoreLayout();
Plotly.update(gd, {
marker: {
size : 2, color: colors
},
});
Plotly.update(gd, { mode : "lines+markers" } )
Plotly.relayout(gd, restoreLayout())
Plotly.restyle(gd , {marker : { color : colors, size : 4 } });
console.log("Tracce:",gd.data.length);
});
}
function addAxis(gd) {
// Aggiunge punto al centro della camma:
Plotly.addTraces(gd, {
r: [0], // Coordinata r del punto (0 = centro)
theta: [0], // Coordinata theta del punto (0 = angolo 0)
mode: 'markers',
marker: {
color: 'white',
size: 8
},
type: 'scatterpolar',
hoverinfo: 'none'
});
}
createCartesianChart();
createPolarChart();
createPolarChart2();
createPolarChart3();
createAnalemmaChart();
createAnalemmaAltAzChart();
createPolarChartEot1();
createPolarChartEot2();
console.log("Cartesian min, max, range:", minVal.toFixed(0),maxVal.toFixed(0),(maxVal - minVal).toFixed(0));
console.log("Kidney min, max, range:", minValK.toFixed(0),maxValK.toFixed(0),(maxValK - minValK).toFixed(0));
console.log("Greubel min, max, range:", minValG.toFixed(0),maxValG.toFixed(0),(maxValG - minValG).toFixed(0));
console.log("Declination cartesian min, max, range:", minValDc.toFixed(0),maxValDc.toFixed(0),(maxValDc - minValDc).toFixed(0));
console.log("Declination min, max, range:", minValD.toFixed(0),maxValD.toFixed(0),(maxValD - minValD).toFixed(0));
console.log("Eot1 min, max, range:", minValEot1.toFixed(0),maxValEot1.toFixed(0),(maxValEot1 - minValEot1).toFixed(0));
console.log("Eot2 min, max, range:", minValEot2.toFixed(0),maxValEot2.toFixed(0),(maxValEot2 - minValEot2).toFixed(0));
</script>
</body>
</html>