mascot-vis 1.11.1 → 1.11.2

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/dist/mascot.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable */
2
- // version: 1.11.1
2
+ // version: 1.11.2
3
3
  (function (global, factory) {
4
4
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3'), require('pixi.js')) :
5
5
  typeof define === 'function' && define.amd ? define(['exports', 'd3', 'pixi.js'], factory) :
@@ -2181,9 +2181,12 @@
2181
2181
  while(item) {
2182
2182
  if (item.classId && classIds.indexOf(item.classId) < 0)
2183
2183
  classIds.push(item.classId);
2184
- if (item.children)
2184
+ if (item.type === ItemType.Glyph) {
2185
+ item.children.forEach(d => classIds.push(d.classId));
2186
+ break;
2187
+ } else if (item.children) {
2185
2188
  item = item.children[0];
2186
- else
2189
+ } else
2187
2190
  break;
2188
2191
  }
2189
2192
  let result = [];
@@ -3277,6 +3280,9 @@
3277
3280
  let lineDS = p.dataScope ? p.dataScope : new DataScope(datatable);
3278
3281
  let ds = datatable.getFieldSummary(field).unique.map(d => lineDS.cross(field, d));
3279
3282
  ds = ds.filter(d => !d.isEmpty());
3283
+ if (ds.length === 1) {
3284
+ ds.push(ds[0].clone());
3285
+ }
3280
3286
 
3281
3287
  let args = Object.assign({}, p.styles);
3282
3288
  for (let vs of Vertex.styles){
@@ -3326,6 +3332,9 @@
3326
3332
  let areaDS = p.dataScope ? p.dataScope : new DataScope(datatable);
3327
3333
  let ds = datatable.getFieldSummary(field).unique.map(d => areaDS.cross(field, d));
3328
3334
  ds = ft == DataType.Number? ds : ds.filter(d => !d.isEmpty());
3335
+ if (ds.length === 1) {
3336
+ ds.push(ds[0].clone());
3337
+ }
3329
3338
 
3330
3339
  if (ft == DataType.Number || ft == DataType.Date) {
3331
3340
  // sorting ds
@@ -3895,7 +3904,11 @@
3895
3904
  max = Math.max(...this.data);
3896
3905
  domain = [min, max];
3897
3906
  if (this.scale) {
3898
- let domainValues = domain.concat(this.scale.domain);
3907
+ // let domainValues = domain.concat(this.scale.domain);
3908
+ let domainValues = this.data;
3909
+ for (let enc of this.scale.encodings) {
3910
+ domainValues = domainValues.concat(enc.data);
3911
+ }
3899
3912
  domain = [Math.min(...domainValues), Math.max(...domainValues)];
3900
3913
  //extent = Math.abs(this.scale.map(domain[0]) - this.scale.map(domain[1]));
3901
3914
  range = this.scale.range;
@@ -3933,9 +3946,12 @@
3933
3946
 
3934
3947
  if (this.scale) {
3935
3948
  //where zero is included depends on the existing scale
3936
- let domainValues = domain.concat(this.scale._scale.domain());
3937
- domain = [Math.min(...domainValues), Math.max(...domainValues)]; //Scale.mergeDomain(domain, this.scale.domain);
3938
- //extent = Math.abs(this.scale.map(domain[0]) - this.scale.map(domain[1]));
3949
+ let domainValues = this.data;
3950
+ for (let enc of this.scale.encodings) {
3951
+ domainValues = domainValues.concat(enc.data);
3952
+ }
3953
+ // let domainValues = domain.concat(this.scale._scale.domain());
3954
+ domain = [Math.min(...domainValues), Math.max(...domainValues)];
3939
3955
 
3940
3956
  range = this.scale.range;
3941
3957
  } else {
@@ -4739,7 +4755,7 @@
4739
4755
 
4740
4756
  set aggregator(a) {
4741
4757
  this._aggregator = a;
4742
- this.scale = undefined;
4758
+ //this.scale = undefined;
4743
4759
  this.run();
4744
4760
  }
4745
4761
 
@@ -6408,7 +6424,7 @@
6408
6424
  }
6409
6425
  }
6410
6426
 
6411
- if (this._item.type == ItemType.Area)
6427
+ if (this._item.type === ItemType.Area || this._item.parent.type === ItemType.Area)
6412
6428
  c = getCellBoundsInGridLayout(this._item);
6413
6429
 
6414
6430
  if (c === undefined) {
@@ -8343,7 +8359,7 @@
8343
8359
  }
8344
8360
 
8345
8361
  for (let enc of scale.encodings) {
8346
- enc.scene._updateAncestorBounds(enc.item, enc.items);
8362
+ enc.scene._relayoutAncestors(enc.item, enc.items);
8347
8363
  }
8348
8364
  //reapply constraints
8349
8365
  let items = scale.encodings.map( d => d.anyItem), classId2item = {};
@@ -9450,7 +9466,7 @@
9450
9466
  if (!("datatable" in args))
9451
9467
  args.datatable = item.dataScope ? item.dataScope.dataTable : item.parent.dataScope.dataTable;
9452
9468
  if (!("aggregator" in args))
9453
- args.aggregator = "sum";
9469
+ args.aggregator = "mean";
9454
9470
  if (!("flipScale" in args))
9455
9471
  args.flipScale = false;
9456
9472
  if (!("includeZero" in args))
@@ -9595,7 +9611,7 @@
9595
9611
  axis(channel, field, params) {
9596
9612
  //need to figure out if item has the corresponding encoding, or if item position is determined by layout
9597
9613
  let args = params ? params : {}, enc = args.item ? this.getEncodingByItem(args.item, channel) : this.getEncodingByField(field, channel);
9598
- if (enc) {
9614
+ if (enc && enc.field === field) {
9599
9615
  if (enc.datatable.getFieldType(field) === DataType.Date && !("labelFormat" in args)) {
9600
9616
  args.labelFormat = "%m/%d/%y";
9601
9617
  }
@@ -9627,8 +9643,8 @@
9627
9643
  let item = args.item? args.item : findItems(this, [{"field": field}])[0];
9628
9644
  if (item === undefined) {
9629
9645
  console.warn(Warnings.INCORRECT_AXIS_INFO + field);
9646
+ return;
9630
9647
  }
9631
-
9632
9648
  let layout = getClosestLayout(item);
9633
9649
  if (!layout || (layout.type !== LayoutType.Grid && layout.type !== LayoutType.Stack)) return;
9634
9650
 
@@ -9674,7 +9690,7 @@
9674
9690
  let p = c._item, found = false;
9675
9691
  while (p.children && p.children.length > 0) {
9676
9692
  for (let ic of p.children) {
9677
- if (ic.classId === item.classId) {
9693
+ if (ic.classId === getEncodingKey(item).split("_")[0]) {
9678
9694
  found = true;
9679
9695
  axes.push(c);
9680
9696
  break;
@@ -11839,6 +11855,7 @@
11839
11855
  //let item = scene.getItem(enc.anyItem);
11840
11856
  let items = enc.items.map(d => scene.getItem(d));
11841
11857
  scene._doEncode(items, enc.args);
11858
+ scene._relayoutAncestors(items[0], items);
11842
11859
  }
11843
11860
 
11844
11861
  _createGuide(scene, guide) {
@@ -24115,7 +24132,13 @@
24115
24132
  }
24116
24133
 
24117
24134
  function canRepeat(compnt) {
24118
- if ((isMark(compnt) || compnt.type == ItemType.Glyph) && !compnt.dataScope) {
24135
+ if (Array.isArray(compnt)) {
24136
+ for (let c of compnt) {
24137
+ if (!isMark(c) || c.dataScope)
24138
+ return false;
24139
+ }
24140
+ return true;
24141
+ } else if ((isMark(compnt) || compnt.type == ItemType.Glyph) && !compnt.dataScope) {
24119
24142
  return true;
24120
24143
  } else if (compnt.type == ItemType.Collection) {
24121
24144
  //TODO: check if repeatable
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mascot-vis",
3
- "version": "1.11.1",
3
+ "version": "1.11.2",
4
4
  "description": "Manipulable Semantic Components in Data Visualization",
5
5
  "scripts": {
6
6
  "build": "rollup --config",