@sailingrotevista/rotevista-dash 4.0.18 → 4.0.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.
Files changed (2) hide show
  1. package/app.js +25 -27
  2. package/package.json +1 -1
package/app.js CHANGED
@@ -616,6 +616,10 @@ function updateScaleLabels(t, min, max) {
616
616
  * drawGraph: Disegna i grafici con griglia temporale intelligente
617
617
  * Usa un Gradiente Lineare SVG dinamico per eliminare le giunzioni dei poligoni.
618
618
  */
619
+ /**
620
+ * drawGraph: Disegna i grafici con griglia temporale intelligente
621
+ * Versione bilanciata: 1.5px per allarmi critici, 1px per il resto.
622
+ */
619
623
  function drawGraph(d, id, min, max, isTws, isHercules) {
620
624
  const svg = document.getElementById(id);
621
625
  if (!svg || d.length < 2) return;
@@ -625,7 +629,7 @@ function drawGraph(d, id, min, max, isTws, isHercules) {
625
629
  const isDepth = (id === 'depth-graph');
626
630
  const samples = CONFIG.graphs.samples;
627
631
 
628
- // 1. Griglia
632
+ // 1. Griglia (Sottile 0.5px)
629
633
  let grids = "";
630
634
  [0.25, 0.5, 0.75].forEach(p => {
631
635
  grids += `<line x1="0" y1="${h-(p*h)}" x2="${w}" y2="${h-(p*h)}" stroke="rgba(0,0,0,0.12)" stroke-width="0.5" />`;
@@ -636,7 +640,7 @@ function drawGraph(d, id, min, max, isTws, isHercules) {
636
640
  grids += `<line x1="${x}" y1="0" x2="${x}" y2="${h}" stroke="rgba(0,0,0,0.08)" stroke-width="0.5" />`;
637
641
  }
638
642
 
639
- // 2. Colori (Tavolozza Vivida)
643
+ // 2. Tavolozza Colori Vividi
640
644
  const baseColorTws = "#2c3e50";
641
645
  const baseColorDepth = "#0088cc";
642
646
 
@@ -656,49 +660,43 @@ function drawGraph(d, id, min, max, isTws, isHercules) {
656
660
  let areaPath = `M 0 ${h} `;
657
661
 
658
662
  for (let i = 1; i < d.length; i++) {
659
- // Calcolo Percentuali per il gradiente
660
663
  const percentPrev = ((i - 1) / (samples - 1)) * 100;
661
664
  const percentCurr = (i / (samples - 1)) * 100;
662
665
 
663
- // Coordinate geometriche
664
666
  const x1 = ((i - 1) / (samples - 1)) * w;
665
667
  const y1 = h - (Math.max(0, Math.min(1, (d[i - 1] - min) / range)) * h);
666
668
  const x2 = (i / (samples - 1)) * w;
667
669
  const y2 = h - (Math.max(0, Math.min(1, (d[i] - min) / range)) * h);
668
670
 
669
671
  const color = getColor(d[i]);
670
-
671
- // Assegnazione specifica di Opacità e Spessore Linea
672
- let fillOpacity = "0.15"; // Default per valori base
673
- let strokeWidth = "1";
674
-
675
- if (color === "#ff3b30") {
676
- // ROSSO (Danger / Reef 2): Molto solido
677
- fillOpacity = "0.85";
678
- strokeWidth = "1.5";
679
- } else if (color === "#ff9800") {
680
- // ARANCIONE (Warning / Reef 1): Più trasparente (Velo)
681
- fillOpacity = "0.45";
682
- strokeWidth = "1"; // Manteniamo la linea spessa per leggerla bene
683
- }
672
+
673
+ // Logica Opacità e Spessore (Tua configurazione)
674
+ let fillOpacity = "0.15";
675
+ let strokeWidth = "1";
676
+
677
+ if (color === "#ff3b30") {
678
+ fillOpacity = "0.85"; // Rosso: Molto visibile
679
+ strokeWidth = "1.5"; // Rosso: Più marcato
680
+ } else if (color === "#ff9800") {
681
+ fillOpacity = "0.45"; // Arancio: Velo medio
682
+ strokeWidth = "1"; // Arancio: Sottile
683
+ }
684
684
 
685
- // GRADIENTE: Due stop alla stessa percentuale per creare uno stacco di colore netto (no sfumature)
685
+ // Costruzione Gradiente (stacchi netti tra i colori)
686
686
  gradientStops += `<stop offset="${percentPrev}%" stop-color="${color}" stop-opacity="${fillOpacity}" />`;
687
687
  gradientStops += `<stop offset="${percentCurr}%" stop-color="${color}" stop-opacity="${fillOpacity}" />`;
688
688
 
689
- // LINEE: Disegnate normalmente sopra l'area
689
+ // Disegno Linea con precisione geometrica
690
690
  lines += `<line x1="${x1}" y1="${y1}" x2="${x2}" y2="${y2}"
691
- style="stroke: ${color}; stroke-width: ${strokeWidth}; stroke-linecap: round;" />`;
691
+ style="stroke: ${color}; stroke-width: ${strokeWidth}; stroke-linecap: round; shape-rendering: geometricPrecision;" />`;
692
692
 
693
- // AGGIORNAMENTO PATH UNICO
694
693
  if (i === 1) areaPath += `L ${x1} ${y1} `;
695
694
  areaPath += `L ${x2} ${y2} `;
696
695
  }
697
696
 
698
- // Chiusura del path dell'area
699
697
  areaPath += `L ${w} ${h} Z`;
700
698
 
701
- // 4. Iniezione del <defs> (Gradiente) nell'SVG
699
+ // 4. Iniezione del Gradiente
702
700
  const gradId = `grad-${id}`;
703
701
  const defs = `
704
702
  <defs>
@@ -709,12 +707,12 @@ function drawGraph(d, id, min, max, isTws, isHercules) {
709
707
  `;
710
708
 
711
709
  // 5. Render Finale
712
- // Se è Depth o Tws applichiamo il gradiente, altrimenti colore standard fisso (per SOG/STW)
713
710
  if (isTws || isDepth) {
714
711
  svg.innerHTML = `${defs}${grids}<path d="${areaPath}" fill="url(#${gradId})" stroke="none" />${lines}`;
715
712
  } else {
716
- const standardColor = getColor(d[d.length - 1]);
717
- svg.innerHTML = `${grids}<path d="${areaPath}" fill="${standardColor}" fill-opacity="0.15" stroke="none" />${lines}`;
713
+ // Per STW/SOG usiamo il colore dell'ultimo punto con area fissa 0.15
714
+ const currentPathColor = getColor(d[d.length - 1]);
715
+ svg.innerHTML = `${grids}<path d="${areaPath}" fill="${currentPathColor}" fill-opacity="0.15" stroke="none" />${lines}`;
718
716
  }
719
717
  }
720
718
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sailingrotevista/rotevista-dash",
3
- "version": "4.0.18",
3
+ "version": "4.0.19",
4
4
  "description": "Public Wind Dashboard with navigation and course aids",
5
5
  "main": "index.js",
6
6
  "publishConfig": {