mol_plot_all 1.2.117 → 1.2.121

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/node.test.js CHANGED
@@ -2772,6 +2772,9 @@ var $;
2772
2772
  }
2773
2773
  return distance;
2774
2774
  }
2775
+ transponed() {
2776
+ return this[0].map((_, i) => this.map(row => row[i]));
2777
+ }
2775
2778
  get x() { return this[0]; }
2776
2779
  get y() { return this[1]; }
2777
2780
  get z() { return this[2]; }
@@ -2905,6 +2908,12 @@ var $;
2905
2908
  const obj = new this.$.$mol_vector_2d(this.gap_x(), this.gap_y());
2906
2909
  return obj;
2907
2910
  }
2911
+ repos_x(val) {
2912
+ return 0;
2913
+ }
2914
+ repos_y(val) {
2915
+ return 0;
2916
+ }
2908
2917
  indexes() {
2909
2918
  return [];
2910
2919
  }
@@ -3063,14 +3072,20 @@ var $;
3063
3072
  indexes() {
3064
3073
  return this.series_x().map((_, i) => i);
3065
3074
  }
3075
+ repos_x(val) {
3076
+ return val;
3077
+ }
3078
+ repos_y(val) {
3079
+ return val;
3080
+ }
3066
3081
  points() {
3067
3082
  const [shift_x, shift_y] = this.shift();
3068
3083
  const [scale_x, scale_y] = this.scale();
3069
3084
  const series_x = this.series_x();
3070
3085
  const series_y = this.series_y();
3071
3086
  return this.indexes().map(index => {
3072
- let point_x = Math.round(shift_x + series_x[index] * scale_x);
3073
- let point_y = Math.round(shift_y + series_y[index] * scale_y);
3087
+ let point_x = Math.round(shift_x + this.repos_x(series_x[index]) * scale_x);
3088
+ let point_y = Math.round(shift_y + this.repos_y(series_y[index]) * scale_y);
3074
3089
  point_x = Math.max(Number.MIN_SAFE_INTEGER, Math.min(point_x, Number.MAX_SAFE_INTEGER));
3075
3090
  point_y = Math.max(Number.MIN_SAFE_INTEGER, Math.min(point_y, Number.MAX_SAFE_INTEGER));
3076
3091
  return [point_x, point_y];
@@ -3084,7 +3099,7 @@ var $;
3084
3099
  const series_x = this.series_x();
3085
3100
  const series_y = this.series_y();
3086
3101
  for (let i = 0; i < series_x.length; i++) {
3087
- next = next.expanded1([series_x[i], series_y[i]]);
3102
+ next = next.expanded1([this.repos_x(series_x[i]), this.repos_y(series_y[i])]);
3088
3103
  }
3089
3104
  return next;
3090
3105
  }
@@ -4186,7 +4201,7 @@ var $;
4186
4201
  : point.y > viewport_top ? 1
4187
4202
  : 0);
4188
4203
  for (let i = 0; i < series_x.length - 1; i++) {
4189
- const scaled = new $.$mol_vector_2d(Math.round(shift_x + series_x[i] * scale_x), Math.round(shift_y + series_y[i] * scale_y));
4204
+ const scaled = new $.$mol_vector_2d(Math.round(shift_x + this.repos_x(series_x[i]) * scale_x), Math.round(shift_y + this.repos_y(series_y[i]) * scale_y));
4190
4205
  if (Math.abs(scaled.x - last.x) < threshold
4191
4206
  && Math.abs(scaled.y - last.y) < threshold)
4192
4207
  continue;
@@ -4269,6 +4284,8 @@ var $;
4269
4284
  graph.cursor_position = () => this.cursor_position();
4270
4285
  graph.gap = () => this.gap();
4271
4286
  graph.title = () => this.title();
4287
+ graph.repos_x = val => this.repos_x(val);
4288
+ graph.repos_y = val => this.repos_y(val);
4272
4289
  }
4273
4290
  return graphs;
4274
4291
  }
@@ -4436,8 +4453,8 @@ var $;
4436
4453
  do {
4437
4454
  indexes = [];
4438
4455
  for (let i = 0; i < series_x.length; i++) {
4439
- const point_x = series_x[i];
4440
- const point_y = series_y[i];
4456
+ const point_x = this.repos_x(series_x[i]);
4457
+ const point_y = this.repos_y(series_y[i]);
4441
4458
  const scaled_x = Math.round(shift_x + point_x * scale_x);
4442
4459
  const scaled_y = Math.round(shift_y + point_y * scale_y);
4443
4460
  if (Math.abs(scaled_x - last_x) < radius