linny-r 1.9.2 → 2.0.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.
Files changed (37) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +4 -4
  3. package/package.json +1 -1
  4. package/server.js +1 -1
  5. package/static/images/eq-negated.png +0 -0
  6. package/static/images/power.png +0 -0
  7. package/static/images/tex.png +0 -0
  8. package/static/index.html +225 -10
  9. package/static/linny-r.css +458 -8
  10. package/static/scripts/linny-r-ctrl.js +6 -4
  11. package/static/scripts/linny-r-gui-actor-manager.js +1 -1
  12. package/static/scripts/linny-r-gui-chart-manager.js +20 -13
  13. package/static/scripts/linny-r-gui-constraint-editor.js +410 -50
  14. package/static/scripts/linny-r-gui-controller.js +127 -12
  15. package/static/scripts/linny-r-gui-dataset-manager.js +28 -20
  16. package/static/scripts/linny-r-gui-documentation-manager.js +11 -3
  17. package/static/scripts/linny-r-gui-equation-manager.js +1 -1
  18. package/static/scripts/linny-r-gui-experiment-manager.js +1 -1
  19. package/static/scripts/linny-r-gui-expression-editor.js +7 -1
  20. package/static/scripts/linny-r-gui-file-manager.js +31 -13
  21. package/static/scripts/linny-r-gui-finder.js +1 -1
  22. package/static/scripts/linny-r-gui-model-autosaver.js +1 -1
  23. package/static/scripts/linny-r-gui-monitor.js +1 -1
  24. package/static/scripts/linny-r-gui-paper.js +108 -25
  25. package/static/scripts/linny-r-gui-power-grid-manager.js +529 -0
  26. package/static/scripts/linny-r-gui-receiver.js +1 -1
  27. package/static/scripts/linny-r-gui-repository-browser.js +1 -1
  28. package/static/scripts/linny-r-gui-scale-unit-manager.js +1 -1
  29. package/static/scripts/linny-r-gui-sensitivity-analysis.js +1 -1
  30. package/static/scripts/linny-r-gui-tex-manager.js +110 -0
  31. package/static/scripts/linny-r-gui-undo-redo.js +1 -1
  32. package/static/scripts/linny-r-milp.js +1 -1
  33. package/static/scripts/linny-r-model.js +1016 -155
  34. package/static/scripts/linny-r-utils.js +3 -3
  35. package/static/scripts/linny-r-vm.js +714 -248
  36. package/static/show-diff.html +1 -1
  37. package/static/show-png.html +1 -1
@@ -11,7 +11,7 @@ for the Linny-R Chart Manager dialog.
11
11
  */
12
12
 
13
13
  /*
14
- Copyright (c) 2017-2023 Delft University of Technology
14
+ Copyright (c) 2017-2024 Delft University of Technology
15
15
 
16
16
  Permission is hereby granted, free of charge, to any person obtaining a copy
17
17
  of this software and associated documentation files (the "Software"), to deal
@@ -495,10 +495,15 @@ class GUIChartManager extends ChartManager {
495
495
  yfract = (c.plot_oy - y / scale) / c.plot_height,
496
496
  yval = c.plot_min_y + yfract * (c.plot_max_y - c.plot_min_y),
497
497
  yhigh = Math.max(Math.abs(c.plot_min_y), Math.abs(c.plot_max_y)),
498
- yres = (yhigh > 1000 ? Math.round(yhigh / 500) : 1),
499
- ytrunc = Math.round(yval / yres) * yres,
498
+ yres = (yhigh > 1000 ? Math.round(yhigh / 500) :
499
+ (yhigh < 100 ? 0.0001 : 1)),
500
+ ysign = (yval < 0 ? '-' : ''),
501
+ ytrunc = Math.abs(Math.round(yval / yres) * yres),
502
+ yprec = (ytrunc >= 10000 || ytrunc < 0.0001 ?
503
+ ytrunc.toExponential(1) : ytrunc.toPrecision(2)),
504
+ ystr = (Math.abs(parseFloat(yprec)) === 0 ? '0' : ysign + yprec),
500
505
  ylbl = (yfract < 0 || yfract > 1 || c.plot_min_y >= c.plot_max_y ?
501
- '' : 'y = ' + VM.sig2Dig(parseFloat(ytrunc.toPrecision(2))));
506
+ '' : 'y = ' + ystr);
502
507
  let n = '';
503
508
  if(c.histogram) {
504
509
  let vv = [];
@@ -807,16 +812,17 @@ class GUIChartManager extends ChartManager {
807
812
  }
808
813
 
809
814
  editVariable() {
810
- // Shows the edit (or rather: format) variable dialog
815
+ // Show the edit (or rather: format) variable dialog.
811
816
  if(this.chart_index >= 0 && this.variable_index >= 0) {
812
817
  const cv = MODEL.charts[this.chart_index].variables[this.variable_index];
813
818
  document.getElementById('variable-dlg-name').innerHTML = cv.displayName;
814
819
  UI.setBox('variable-stacked', cv.stacked);
815
- this.variable_modal.element('scale').value = VM.sig4Dig(cv.scale_factor);
820
+ // Pass TRUE tiny flag to permit very small scaling factors.
821
+ this.variable_modal.element('scale').value = VM.sig4Dig(cv.scale_factor, true);
816
822
  this.variable_modal.element('width').value = VM.sig4Dig(cv.line_width);
817
823
  this.variable_modal.element('color').style.backgroundColor = cv.color;
818
824
  this.setColorPicker(cv.color);
819
- // Show change equation buttons only for equation variables
825
+ // Show change equation buttons only for equation variables.
820
826
  if(cv.object === MODEL.equations_dataset || cv.object instanceof DatasetModifier) {
821
827
  this.change_equation_btns.style.display = 'block';
822
828
  } else {
@@ -827,7 +833,7 @@ class GUIChartManager extends ChartManager {
827
833
  }
828
834
 
829
835
  showPasteColor() {
830
- // Show last copied color (if any) as smaller square next to color box
836
+ // Show last copied color (if any) as smaller square next to color box.
831
837
  if(this.paste_color) {
832
838
  const pc = this.variable_modal.element('paste-color');
833
839
  pc.style.backgroundColor = this.paste_color;
@@ -836,13 +842,13 @@ class GUIChartManager extends ChartManager {
836
842
  }
837
843
 
838
844
  hidePasteColor() {
839
- // Hide paste color box
845
+ // Hide paste color box.
840
846
  this.variable_modal.element('paste-color').style.display = 'none';
841
847
  }
842
848
 
843
849
  copyPasteColor(event) {
844
850
  // Store the current color as past color, or set it to the current
845
- // paste color if this is defined and the Shift key was pressed
851
+ // paste color if this is defined and the Shift key was pressed.
846
852
  event.stopPropagation();
847
853
  const cbox = this.variable_modal.element('color');
848
854
  if(event.shiftKey && this.paste_color) {
@@ -896,9 +902,10 @@ class GUIChartManager extends ChartManager {
896
902
  cv = c.variables[this.variable_index];
897
903
  cv.stacked = UI.boxChecked('variable-stacked');
898
904
  cv.scale_factor = s;
899
- cv.line_width = w;
905
+ // Prevent negative or near-zero line width.
906
+ cv.line_width = Math.max(0.001, w);
900
907
  cv.color = this.color_picker.color.hexString;
901
- // NOTE: clear the vector so it will be recalculated
908
+ // NOTE: Clear the vector so it will be recalculated.
902
909
  cv.vector.length = 0;
903
910
  }
904
911
  this.variable_modal.hide();
@@ -970,7 +977,7 @@ class GUIChartManager extends ChartManager {
970
977
  }
971
978
  }
972
979
  if(nr == 0 || this.drawing_chart) {
973
- this.table_panel.html = '<div id="no-chart-data">No data</div>';
980
+ this.table_panel.innerHTML = '<div id="no-chart-data">No data</div>';
974
981
  return;
975
982
  }
976
983
  // Process each of 5 columns separately