cx 24.4.8 → 24.4.9

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/charts.css CHANGED
@@ -259,6 +259,11 @@
259
259
  stroke-width: 1px;
260
260
  }
261
261
 
262
+ .cxe-swimlane-lane {
263
+ fill: #f1f1f1;
264
+ stroke: none;
265
+ }
266
+
262
267
  .cxs-color-0 {
263
268
  fill: #fbb4af;
264
269
  stroke: #e2a29e;
package/dist/charts.js CHANGED
@@ -2803,6 +2803,173 @@ Swimlanes.prototype.vertical = false;
2803
2803
  Swimlanes.prototype.styled = true;
2804
2804
  BoundedObject.alias("swimlanes", Swimlanes);
2805
2805
 
2806
+ var Swimlane = /*#__PURE__*/ (function (_BoundedObject) {
2807
+ function Swimlane() {
2808
+ return _BoundedObject.apply(this, arguments) || this;
2809
+ }
2810
+ _inheritsLoose(Swimlane, _BoundedObject);
2811
+ var _proto = Swimlane.prototype;
2812
+ _proto.init = function init() {
2813
+ this.laneStyle = parseStyle(this.laneStyle);
2814
+ _BoundedObject.prototype.init.call(this);
2815
+ };
2816
+ _proto.declareData = function declareData() {
2817
+ var _BoundedObject$protot;
2818
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
2819
+ args[_key] = arguments[_key];
2820
+ }
2821
+ (_BoundedObject$protot = _BoundedObject.prototype.declareData).call.apply(
2822
+ _BoundedObject$protot,
2823
+ [this].concat(args, [
2824
+ {
2825
+ size: undefined,
2826
+ laneOffset: undefined,
2827
+ laneStyle: {
2828
+ structured: true,
2829
+ },
2830
+ vertical: undefined,
2831
+ x: undefined,
2832
+ y: undefined,
2833
+ },
2834
+ ]),
2835
+ );
2836
+ };
2837
+ _proto.explore = function explore(context, instance) {
2838
+ var data = instance.data;
2839
+ _BoundedObject.prototype.explore.call(this, context, instance);
2840
+ instance.xAxis = context.axes[this.xAxis];
2841
+ instance.yAxis = context.axes[this.yAxis];
2842
+ if (data.vertical) {
2843
+ instance.xAxis.acknowledge(data.x, data.size, data.laneOffset);
2844
+ } else {
2845
+ instance.yAxis.acknowledge(data.y, data.size, data.laneOffset);
2846
+ }
2847
+ };
2848
+ _proto.prepare = function prepare(context, instance) {
2849
+ _BoundedObject.prototype.prepare.call(this, context, instance);
2850
+ instance.bounds = this.calculateRect(instance);
2851
+ instance.cache("bounds", instance.bounds);
2852
+ if (!instance.bounds.isEqual(instance.cached.bounds)) instance.markShouldUpdate(context);
2853
+ context.push("parentRect", instance.bounds);
2854
+ };
2855
+ _proto.calculateRect = function calculateRect(instance) {
2856
+ var data = instance.data;
2857
+ var size = data.size,
2858
+ laneOffset = data.laneOffset;
2859
+ if (data.vertical) {
2860
+ var x1 = instance.xAxis.map(data.x, laneOffset - size / 2);
2861
+ var x2 = instance.xAxis.map(data.x, laneOffset + size / 2);
2862
+ var bounds = new Rect({
2863
+ l: Math.min(x1, x2),
2864
+ r: Math.max(x1, x2),
2865
+ t: data.bounds.t,
2866
+ b: data.bounds.b,
2867
+ });
2868
+ } else {
2869
+ var y1 = instance.yAxis.map(data.y, laneOffset - size / 2);
2870
+ var y2 = instance.yAxis.map(data.y, laneOffset + size / 2);
2871
+ var bounds = new Rect({
2872
+ l: data.bounds.l,
2873
+ r: data.bounds.r,
2874
+ t: Math.min(y1, y2),
2875
+ b: Math.max(y1, y2),
2876
+ });
2877
+ }
2878
+ return bounds;
2879
+ };
2880
+ _proto.render = function render(context, instance, key) {
2881
+ var data = instance.data,
2882
+ xAxis = instance.xAxis,
2883
+ yAxis = instance.yAxis,
2884
+ bounds = instance.bounds;
2885
+ var CSS = this.CSS,
2886
+ baseClass = this.baseClass;
2887
+ var axis = this.vertical ? xAxis : yAxis;
2888
+ if (!axis) return null;
2889
+ var min, max, valueFunction;
2890
+ if (axis.scale) {
2891
+ min = axis.scale.min;
2892
+ max = axis.scale.max;
2893
+ var clamp = function clamp(value) {
2894
+ return [Math.max(min, Math.min(max, value)), 0];
2895
+ };
2896
+ valueFunction = function valueFunction(value, offset) {
2897
+ return clamp(value + offset);
2898
+ };
2899
+ } else if (axis.valueList) {
2900
+ min = 0;
2901
+ max = axis.valueList.length;
2902
+ valueFunction = function valueFunction(value, offset) {
2903
+ return [axis.valueList[value], offset];
2904
+ };
2905
+ }
2906
+ if (!(min < max)) return null;
2907
+ var rectClass = CSS.element(baseClass, "lane");
2908
+ if (this.vertical) {
2909
+ var c1 = axis.map.apply(axis, valueFunction(data.x, -data.size / 2 + data.laneOffset));
2910
+ var c2 = axis.map.apply(axis, valueFunction(data.x, +data.size / 2 + data.laneOffset));
2911
+ return /*#__PURE__*/ jsxs(
2912
+ "g",
2913
+ {
2914
+ className: data.classNames,
2915
+ children: [
2916
+ /*#__PURE__*/ jsx(
2917
+ "rect",
2918
+ {
2919
+ x: bounds.l,
2920
+ y: bounds.t,
2921
+ height: bounds.b - bounds.t,
2922
+ width: Math.abs(c1 - c2),
2923
+ className: rectClass,
2924
+ style: data.laneStyle,
2925
+ },
2926
+ key,
2927
+ ),
2928
+ this.renderChildren(context, instance),
2929
+ ";",
2930
+ ],
2931
+ },
2932
+ key,
2933
+ );
2934
+ } else {
2935
+ var _c = axis.map.apply(axis, valueFunction(data.y, -data.size / 2 + data.laneOffset));
2936
+ var _c2 = axis.map.apply(axis, valueFunction(data.y, +data.size / 2 + data.laneOffset));
2937
+ return /*#__PURE__*/ jsxs(
2938
+ "g",
2939
+ {
2940
+ className: data.classNames,
2941
+ children: [
2942
+ /*#__PURE__*/ jsx(
2943
+ "rect",
2944
+ {
2945
+ x: bounds.l,
2946
+ y: bounds.t,
2947
+ width: bounds.r - bounds.l,
2948
+ height: Math.abs(_c - _c2),
2949
+ className: rectClass,
2950
+ style: data.laneStyle,
2951
+ },
2952
+ key,
2953
+ ),
2954
+ this.renderChildren(context, instance),
2955
+ ";",
2956
+ ],
2957
+ },
2958
+ key,
2959
+ );
2960
+ }
2961
+ };
2962
+ return Swimlane;
2963
+ })(BoundedObject);
2964
+ Swimlane.prototype.xAxis = "x";
2965
+ Swimlane.prototype.yAxis = "y";
2966
+ Swimlane.prototype.anchors = "0 1 1 0";
2967
+ Swimlane.prototype.baseClass = "swimlane";
2968
+ Swimlane.prototype.size = 0.5;
2969
+ Swimlane.prototype.laneOffset = 0;
2970
+ Swimlane.prototype.vertical = false;
2971
+ BoundedObject.alias("swimlane", Swimlane);
2972
+
2806
2973
  var RangeMarker = /*#__PURE__*/ (function (_BoundedObject) {
2807
2974
  function RangeMarker() {
2808
2975
  return _BoundedObject.apply(this, arguments) || this;
@@ -5226,6 +5393,7 @@ export {
5226
5393
  RangeMarker,
5227
5394
  ScatterGraph,
5228
5395
  SnapPointFinder,
5396
+ Swimlane,
5229
5397
  Swimlanes,
5230
5398
  TimeAxis,
5231
5399
  ValueAtFinder,