impaktapps-design 0.1.0 → 0.1.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.
@@ -10477,12 +10477,14 @@ const BottomAxis = ({
10477
10477
  yMax,
10478
10478
  value,
10479
10479
  xScale,
10480
- parentWidth
10480
+ parentWidth,
10481
+ left: left2
10481
10482
  }) => {
10482
10483
  var _a2, _b2, _c2, _d, _e2, _f, _g, _h, _i, _j, _k, _l, _m, _n2, _o, _p, _q, _r, _s;
10483
10484
  return /* @__PURE__ */ jsx(AxisBottom$2, {
10484
- numTicks: data.length,
10485
+ numTicks: data == null ? void 0 : data.length,
10485
10486
  top: yMax,
10487
+ left: left2,
10486
10488
  hideTicks: (_a2 = value.main) == null ? void 0 : _a2.hideTicks,
10487
10489
  hideAxisLine: (_b2 = value.main) == null ? void 0 : _b2.hideBottomAxisLine,
10488
10490
  strokeWidth: (_d = (_c2 = value.style) == null ? void 0 : _c2.labelStyle) == null ? void 0 : _d.bottomAxisWidth,
@@ -11169,273 +11171,286 @@ const ToolTip = ({
11169
11171
  })
11170
11172
  }, Math.random());
11171
11173
  };
11172
- const defaultMargin = {
11173
- top: 20,
11174
- right: 0,
11175
- bottom: 40,
11176
- left: 40
11177
- };
11178
- function DrawBarGraph({
11179
- width,
11180
- height,
11181
- events = false,
11182
- margin = defaultMargin,
11183
- value
11184
- }) {
11185
- var _a2, _b2, _c2, _d, _e2, _f, _g, _h, _i, _j;
11186
- const data = (_a2 = value.main) == null ? void 0 : _a2.data;
11187
- const keys2 = Object.keys(data[0]).filter((d2) => d2 !== "label");
11188
- const getDate = (d2) => d2.label;
11189
- const dateScale = createBandScale({
11190
- domain: data.map(getDate),
11191
- padding: 0.2
11192
- });
11193
- const cityScale = createBandScale({
11194
- domain: keys2,
11195
- padding: 0.1
11196
- });
11197
- const tempScale = createLinearScale({
11198
- domain: [0, Math.max(...data.map((d2) => Math.max(...keys2.map((key) => Number(d2[key])))))]
11199
- });
11200
- const colorScale = createOrdinalScale$1({
11201
- domain: keys2,
11202
- range: [((_d = (_c2 = (_b2 = value.style) == null ? void 0 : _b2.barStyle) == null ? void 0 : _c2.color) == null ? void 0 : _d.firstBarColor) || "#aeeef8", ((_g = (_f = (_e2 = value.style) == null ? void 0 : _e2.barStyle) == null ? void 0 : _f.color) == null ? void 0 : _g.secondBarColor) || "e5fd3d", ((_j = (_i = (_h = value.style) == null ? void 0 : _h.barStyle) == null ? void 0 : _i.color) == null ? void 0 : _j.thirdBarColor) || "#9caff6"]
11203
- });
11204
- const xMax = width - margin.left - margin.right;
11205
- const yMax = height - margin.top - margin.bottom;
11206
- dateScale.rangeRound([0, xMax]);
11207
- cityScale.rangeRound([0, dateScale.bandwidth()]);
11208
- tempScale.range([yMax, 0]);
11209
- const {
11210
- tooltipData,
11211
- tooltipLeft,
11212
- tooltipTop,
11213
- tooltipOpen,
11214
- showTooltip,
11215
- hideTooltip
11216
- } = useTooltip();
11217
- const handleMouse = (event, datum2) => {
11218
- console.log(datum2);
11219
- showTooltip({
11220
- tooltipLeft: event.clientX,
11221
- tooltipTop: event.clientY,
11222
- tooltipData: [datum2.key, datum2.value, datum2.color]
11223
- });
11174
+ var _excluded$n = ["flexDirection", "alignItems", "margin", "display", "children"];
11175
+ function _extends$A() {
11176
+ _extends$A = Object.assign ? Object.assign.bind() : function(target) {
11177
+ for (var i2 = 1; i2 < arguments.length; i2++) {
11178
+ var source = arguments[i2];
11179
+ for (var key in source) {
11180
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
11181
+ target[key] = source[key];
11182
+ }
11183
+ }
11184
+ }
11185
+ return target;
11224
11186
  };
11225
- return width < 10 ? null : /* @__PURE__ */ jsxs("div", {
11226
- children: [/* @__PURE__ */ jsxs("svg", {
11227
- width,
11228
- height,
11229
- children: [/* @__PURE__ */ jsx("rect", {
11230
- x: 0,
11231
- y: 0,
11232
- width,
11233
- height,
11234
- fill: value.style.containerStyle.background || "#612efb",
11235
- rx: 14
11236
- }), /* @__PURE__ */ jsxs(Group, {
11237
- top: margin.top,
11238
- left: margin.left,
11239
- children: [/* @__PURE__ */ jsx(LeftAxis, {
11240
- value,
11241
- yScale: tempScale,
11242
- parentWidth: width
11243
- }), /* @__PURE__ */ jsx(BarGroup, {
11244
- data,
11245
- keys: keys2,
11246
- height: yMax,
11247
- x0: getDate,
11248
- x0Scale: dateScale,
11249
- x1Scale: cityScale,
11250
- yScale: tempScale,
11251
- color: colorScale,
11252
- children: (barGroups) => barGroups.map((barGroup) => /* @__PURE__ */ jsx(Group, {
11253
- left: barGroup.x0,
11254
- children: barGroup.bars.map((bar) => /* @__PURE__ */ jsx("rect", {
11255
- x: bar.x,
11256
- y: bar.y,
11257
- width: bar.width,
11258
- height: bar.height,
11259
- fill: bar.color,
11260
- rx: 4,
11261
- onMouseOver: (e3) => handleMouse(e3, bar),
11262
- onMouseOut: hideTooltip,
11263
- onClick: () => {
11264
- if (!events)
11265
- return;
11266
- const {
11267
- key,
11268
- value: value2
11269
- } = bar;
11270
- alert(JSON.stringify({
11271
- key,
11272
- value: value2
11273
- }));
11274
- }
11275
- }, `bar-group-bar-${barGroup.index}-${bar.index}-${bar.value}-${bar.key}`))
11276
- }, `bar-group-${barGroup.index}-${barGroup.x0}`))
11277
- })]
11278
- }), /* @__PURE__ */ jsx(BottomAxis, {
11279
- yMax: yMax + margin.top,
11280
- value,
11281
- left: margin.left,
11282
- xScale: dateScale,
11283
- parentWidth: width
11284
- })]
11285
- }), tooltipOpen && /* @__PURE__ */ jsx(ToolTip, {
11286
- style: {
11287
- ...value == null ? void 0 : value.style,
11288
- tooltipbackground: tooltipData[2]
11289
- },
11290
- top: tooltipTop,
11291
- left: tooltipLeft,
11292
- tooltipData
11293
- })]
11294
- });
11187
+ return _extends$A.apply(this, arguments);
11295
11188
  }
11296
- var root$4 = _root;
11297
- var now$2 = function() {
11298
- return root$4.Date.now();
11299
- };
11300
- var now_1 = now$2;
11301
- var reWhitespace$1 = /\s/;
11302
- function trimmedEndIndex$2(string2) {
11303
- var index2 = string2.length;
11304
- while (index2-- && reWhitespace$1.test(string2.charAt(index2))) {
11189
+ function _objectWithoutPropertiesLoose$n(source, excluded) {
11190
+ if (source == null)
11191
+ return {};
11192
+ var target = {};
11193
+ var sourceKeys = Object.keys(source);
11194
+ var key, i2;
11195
+ for (i2 = 0; i2 < sourceKeys.length; i2++) {
11196
+ key = sourceKeys[i2];
11197
+ if (excluded.indexOf(key) >= 0)
11198
+ continue;
11199
+ target[key] = source[key];
11305
11200
  }
11306
- return index2;
11307
- }
11308
- var _trimmedEndIndex = trimmedEndIndex$2;
11309
- var trimmedEndIndex$1 = _trimmedEndIndex;
11310
- var reTrimStart$1 = /^\s+/;
11311
- function baseTrim$2(string2) {
11312
- return string2 ? string2.slice(0, trimmedEndIndex$1(string2) + 1).replace(reTrimStart$1, "") : string2;
11201
+ return target;
11313
11202
  }
11314
- var _baseTrim = baseTrim$2;
11315
- function isObjectLike$2(value) {
11316
- return value != null && typeof value == "object";
11203
+ function LegendItem(_ref) {
11204
+ var _ref$flexDirection = _ref.flexDirection, flexDirection = _ref$flexDirection === void 0 ? "row" : _ref$flexDirection, _ref$alignItems = _ref.alignItems, alignItems = _ref$alignItems === void 0 ? "center" : _ref$alignItems, _ref$margin = _ref.margin, margin = _ref$margin === void 0 ? "0" : _ref$margin, _ref$display = _ref.display, display = _ref$display === void 0 ? "flex" : _ref$display, children2 = _ref.children, restProps = _objectWithoutPropertiesLoose$n(_ref, _excluded$n);
11205
+ return /* @__PURE__ */ React__default.createElement("div", _extends$A({
11206
+ className: "visx-legend-item",
11207
+ style: {
11208
+ display,
11209
+ alignItems,
11210
+ flexDirection,
11211
+ margin
11212
+ }
11213
+ }, restProps), children2);
11317
11214
  }
11318
- var isObjectLike_1 = isObjectLike$2;
11319
- var baseGetTag$1 = _baseGetTag, isObjectLike$1 = isObjectLike_1;
11320
- var symbolTag$1 = "[object Symbol]";
11321
- function isSymbol$2(value) {
11322
- return typeof value == "symbol" || isObjectLike$1(value) && baseGetTag$1(value) == symbolTag$1;
11215
+ LegendItem.propTypes = {
11216
+ alignItems: _pt.string,
11217
+ margin: _pt.oneOfType([_pt.string, _pt.number]),
11218
+ children: _pt.node,
11219
+ display: _pt.string
11220
+ };
11221
+ var _excluded$m = ["flex", "label", "margin", "align", "children"];
11222
+ function _extends$z() {
11223
+ _extends$z = Object.assign ? Object.assign.bind() : function(target) {
11224
+ for (var i2 = 1; i2 < arguments.length; i2++) {
11225
+ var source = arguments[i2];
11226
+ for (var key in source) {
11227
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
11228
+ target[key] = source[key];
11229
+ }
11230
+ }
11231
+ }
11232
+ return target;
11233
+ };
11234
+ return _extends$z.apply(this, arguments);
11323
11235
  }
11324
- var isSymbol_1 = isSymbol$2;
11325
- var baseTrim$1 = _baseTrim, isObject$2 = isObject_1, isSymbol$1 = isSymbol_1;
11326
- var NAN$1 = 0 / 0;
11327
- var reIsBadHex$1 = /^[-+]0x[0-9a-f]+$/i;
11328
- var reIsBinary$1 = /^0b[01]+$/i;
11329
- var reIsOctal$1 = /^0o[0-7]+$/i;
11330
- var freeParseInt$1 = parseInt;
11331
- function toNumber$2(value) {
11332
- if (typeof value == "number") {
11333
- return value;
11334
- }
11335
- if (isSymbol$1(value)) {
11336
- return NAN$1;
11337
- }
11338
- if (isObject$2(value)) {
11339
- var other = typeof value.valueOf == "function" ? value.valueOf() : value;
11340
- value = isObject$2(other) ? other + "" : other;
11341
- }
11342
- if (typeof value != "string") {
11343
- return value === 0 ? value : +value;
11236
+ function _objectWithoutPropertiesLoose$m(source, excluded) {
11237
+ if (source == null)
11238
+ return {};
11239
+ var target = {};
11240
+ var sourceKeys = Object.keys(source);
11241
+ var key, i2;
11242
+ for (i2 = 0; i2 < sourceKeys.length; i2++) {
11243
+ key = sourceKeys[i2];
11244
+ if (excluded.indexOf(key) >= 0)
11245
+ continue;
11246
+ target[key] = source[key];
11344
11247
  }
11345
- value = baseTrim$1(value);
11346
- var isBinary = reIsBinary$1.test(value);
11347
- return isBinary || reIsOctal$1.test(value) ? freeParseInt$1(value.slice(2), isBinary ? 2 : 8) : reIsBadHex$1.test(value) ? NAN$1 : +value;
11248
+ return target;
11348
11249
  }
11349
- var toNumber_1 = toNumber$2;
11350
- var isObject$1 = isObject_1, now$1 = now_1, toNumber$1 = toNumber_1;
11351
- var FUNC_ERROR_TEXT = "Expected a function";
11352
- var nativeMax = Math.max, nativeMin$1 = Math.min;
11353
- function debounce(func, wait, options) {
11354
- var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
11355
- if (typeof func != "function") {
11356
- throw new TypeError(FUNC_ERROR_TEXT);
11357
- }
11358
- wait = toNumber$1(wait) || 0;
11359
- if (isObject$1(options)) {
11360
- leading = !!options.leading;
11361
- maxing = "maxWait" in options;
11362
- maxWait = maxing ? nativeMax(toNumber$1(options.maxWait) || 0, wait) : maxWait;
11363
- trailing = "trailing" in options ? !!options.trailing : trailing;
11364
- }
11365
- function invokeFunc(time2) {
11366
- var args = lastArgs, thisArg = lastThis;
11367
- lastArgs = lastThis = void 0;
11368
- lastInvokeTime = time2;
11369
- result = func.apply(thisArg, args);
11370
- return result;
11371
- }
11372
- function leadingEdge(time2) {
11373
- lastInvokeTime = time2;
11374
- timerId = setTimeout(timerExpired, wait);
11375
- return leading ? invokeFunc(time2) : result;
11376
- }
11377
- function remainingWait(time2) {
11378
- var timeSinceLastCall = time2 - lastCallTime, timeSinceLastInvoke = time2 - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
11379
- return maxing ? nativeMin$1(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
11380
- }
11381
- function shouldInvoke(time2) {
11382
- var timeSinceLastCall = time2 - lastCallTime, timeSinceLastInvoke = time2 - lastInvokeTime;
11383
- return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
11384
- }
11385
- function timerExpired() {
11386
- var time2 = now$1();
11387
- if (shouldInvoke(time2)) {
11388
- return trailingEdge(time2);
11250
+ function LegendLabel(_ref) {
11251
+ var _ref$flex = _ref.flex, flex = _ref$flex === void 0 ? "1" : _ref$flex, label = _ref.label, _ref$margin = _ref.margin, margin = _ref$margin === void 0 ? "5px 0" : _ref$margin, _ref$align = _ref.align, align2 = _ref$align === void 0 ? "left" : _ref$align, children2 = _ref.children, restProps = _objectWithoutPropertiesLoose$m(_ref, _excluded$m);
11252
+ return /* @__PURE__ */ React__default.createElement("div", _extends$z({
11253
+ className: "visx-legend-label",
11254
+ style: {
11255
+ justifyContent: align2,
11256
+ display: "flex",
11257
+ flex,
11258
+ margin
11389
11259
  }
11390
- timerId = setTimeout(timerExpired, remainingWait(time2));
11391
- }
11392
- function trailingEdge(time2) {
11393
- timerId = void 0;
11394
- if (trailing && lastArgs) {
11395
- return invokeFunc(time2);
11260
+ }, restProps), children2 || label);
11261
+ }
11262
+ LegendLabel.propTypes = {
11263
+ align: _pt.string,
11264
+ label: _pt.node,
11265
+ flex: _pt.oneOfType([_pt.string, _pt.number]),
11266
+ margin: _pt.oneOfType([_pt.string, _pt.number]),
11267
+ children: _pt.node
11268
+ };
11269
+ function _extends$y() {
11270
+ _extends$y = Object.assign ? Object.assign.bind() : function(target) {
11271
+ for (var i2 = 1; i2 < arguments.length; i2++) {
11272
+ var source = arguments[i2];
11273
+ for (var key in source) {
11274
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
11275
+ target[key] = source[key];
11276
+ }
11277
+ }
11396
11278
  }
11397
- lastArgs = lastThis = void 0;
11398
- return result;
11399
- }
11400
- function cancel() {
11401
- if (timerId !== void 0) {
11402
- clearTimeout(timerId);
11279
+ return target;
11280
+ };
11281
+ return _extends$y.apply(this, arguments);
11282
+ }
11283
+ function ShapeRect(_ref) {
11284
+ var fill = _ref.fill, width = _ref.width, height = _ref.height, style2 = _ref.style;
11285
+ return /* @__PURE__ */ React__default.createElement("div", {
11286
+ style: _extends$y({
11287
+ width,
11288
+ height,
11289
+ background: fill
11290
+ }, style2)
11291
+ });
11292
+ }
11293
+ ShapeRect.propTypes = {
11294
+ fill: _pt.string,
11295
+ width: _pt.oneOfType([_pt.string, _pt.number]),
11296
+ height: _pt.oneOfType([_pt.string, _pt.number])
11297
+ };
11298
+ function ShapeCircle(_ref) {
11299
+ var fill = _ref.fill, width = _ref.width, height = _ref.height, style2 = _ref.style;
11300
+ var cleanWidth = typeof width === "string" || typeof width === "undefined" ? 0 : width;
11301
+ var cleanHeight = typeof height === "string" || typeof height === "undefined" ? 0 : height;
11302
+ var size = Math.max(cleanWidth, cleanHeight);
11303
+ var radius = size / 2;
11304
+ return /* @__PURE__ */ React__default.createElement("svg", {
11305
+ width: size,
11306
+ height: size
11307
+ }, /* @__PURE__ */ React__default.createElement(Group, {
11308
+ top: radius,
11309
+ left: radius
11310
+ }, /* @__PURE__ */ React__default.createElement("circle", {
11311
+ r: radius,
11312
+ fill,
11313
+ style: style2
11314
+ })));
11315
+ }
11316
+ ShapeCircle.propTypes = {
11317
+ fill: _pt.string,
11318
+ width: _pt.oneOfType([_pt.string, _pt.number]),
11319
+ height: _pt.oneOfType([_pt.string, _pt.number])
11320
+ };
11321
+ function ShapeLine(_ref) {
11322
+ var fill = _ref.fill, width = _ref.width, height = _ref.height, style2 = _ref.style;
11323
+ var cleanHeight = typeof height === "string" || typeof height === "undefined" ? 0 : height;
11324
+ var lineThickness = typeof (style2 == null ? void 0 : style2.strokeWidth) === "number" ? style2 == null ? void 0 : style2.strokeWidth : 2;
11325
+ return /* @__PURE__ */ React__default.createElement("svg", {
11326
+ width,
11327
+ height
11328
+ }, /* @__PURE__ */ React__default.createElement(Group, {
11329
+ top: cleanHeight / 2 - lineThickness / 2
11330
+ }, /* @__PURE__ */ React__default.createElement("line", {
11331
+ x1: 0,
11332
+ x2: width,
11333
+ y1: 0,
11334
+ y2: 0,
11335
+ stroke: fill,
11336
+ strokeWidth: lineThickness,
11337
+ style: style2
11338
+ })));
11339
+ }
11340
+ ShapeLine.propTypes = {
11341
+ fill: _pt.string,
11342
+ width: _pt.oneOfType([_pt.string, _pt.number]),
11343
+ height: _pt.oneOfType([_pt.string, _pt.number])
11344
+ };
11345
+ function _extends$x() {
11346
+ _extends$x = Object.assign ? Object.assign.bind() : function(target) {
11347
+ for (var i2 = 1; i2 < arguments.length; i2++) {
11348
+ var source = arguments[i2];
11349
+ for (var key in source) {
11350
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
11351
+ target[key] = source[key];
11352
+ }
11353
+ }
11403
11354
  }
11404
- lastInvokeTime = 0;
11405
- lastArgs = lastCallTime = lastThis = timerId = void 0;
11355
+ return target;
11356
+ };
11357
+ return _extends$x.apply(this, arguments);
11358
+ }
11359
+ var NO_OP = function NO_OP2() {
11360
+ return void 0;
11361
+ };
11362
+ function renderShape(_ref) {
11363
+ var _ref$shape = _ref.shape, shape = _ref$shape === void 0 ? "rect" : _ref$shape, _ref$fill = _ref.fill, fill = _ref$fill === void 0 ? NO_OP : _ref$fill, _ref$size = _ref.size, size = _ref$size === void 0 ? NO_OP : _ref$size, width = _ref.width, height = _ref.height, label = _ref.label, item = _ref.item, itemIndex = _ref.itemIndex, _ref$shapeStyle = _ref.shapeStyle, shapeStyle = _ref$shapeStyle === void 0 ? NO_OP : _ref$shapeStyle;
11364
+ var props = {
11365
+ width,
11366
+ height,
11367
+ item,
11368
+ itemIndex,
11369
+ label,
11370
+ fill: fill(_extends$x({}, label)),
11371
+ size: size(_extends$x({}, label)),
11372
+ style: shapeStyle(_extends$x({}, label))
11373
+ };
11374
+ if (typeof shape === "string") {
11375
+ if (shape === "circle") {
11376
+ return /* @__PURE__ */ React__default.createElement(ShapeCircle, props);
11377
+ }
11378
+ if (shape === "line") {
11379
+ return /* @__PURE__ */ React__default.createElement(ShapeLine, props);
11380
+ }
11381
+ return /* @__PURE__ */ React__default.createElement(ShapeRect, props);
11406
11382
  }
11407
- function flush() {
11408
- return timerId === void 0 ? result : trailingEdge(now$1());
11383
+ if (/* @__PURE__ */ React__default.isValidElement(shape)) {
11384
+ return /* @__PURE__ */ React__default.cloneElement(shape, props);
11409
11385
  }
11410
- function debounced() {
11411
- var time2 = now$1(), isInvoking = shouldInvoke(time2);
11412
- lastArgs = arguments;
11413
- lastThis = this;
11414
- lastCallTime = time2;
11415
- if (isInvoking) {
11416
- if (timerId === void 0) {
11417
- return leadingEdge(lastCallTime);
11418
- }
11419
- if (maxing) {
11420
- clearTimeout(timerId);
11421
- timerId = setTimeout(timerExpired, wait);
11422
- return invokeFunc(lastCallTime);
11386
+ if (shape) {
11387
+ return /* @__PURE__ */ React__default.createElement(shape, props);
11388
+ }
11389
+ return null;
11390
+ }
11391
+ function _extends$w() {
11392
+ _extends$w = Object.assign ? Object.assign.bind() : function(target) {
11393
+ for (var i2 = 1; i2 < arguments.length; i2++) {
11394
+ var source = arguments[i2];
11395
+ for (var key in source) {
11396
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
11397
+ target[key] = source[key];
11398
+ }
11423
11399
  }
11424
11400
  }
11425
- if (timerId === void 0) {
11426
- timerId = setTimeout(timerExpired, wait);
11401
+ return target;
11402
+ };
11403
+ return _extends$w.apply(this, arguments);
11404
+ }
11405
+ function LegendShape(_ref) {
11406
+ var _ref$shape = _ref.shape, shape = _ref$shape === void 0 ? ShapeRect : _ref$shape, width = _ref.width, height = _ref.height, margin = _ref.margin, label = _ref.label, item = _ref.item, itemIndex = _ref.itemIndex, fill = _ref.fill, size = _ref.size, shapeStyle = _ref.shapeStyle;
11407
+ return /* @__PURE__ */ React__default.createElement("div", {
11408
+ className: "visx-legend-shape",
11409
+ style: {
11410
+ display: "flex",
11411
+ width: size ? size(_extends$w({}, label)) : width,
11412
+ height: size ? size(_extends$w({}, label)) : height,
11413
+ margin
11427
11414
  }
11428
- return result;
11429
- }
11430
- debounced.cancel = cancel;
11431
- debounced.flush = flush;
11432
- return debounced;
11415
+ }, renderShape({
11416
+ shape,
11417
+ item,
11418
+ itemIndex,
11419
+ label,
11420
+ width,
11421
+ height,
11422
+ fill,
11423
+ shapeStyle
11424
+ }));
11433
11425
  }
11434
- var debounce_1 = debounce;
11435
- var debounce$1 = debounce_1;
11436
- var _excluded$n = ["className", "children", "debounceTime", "ignoreDimensions", "parentSizeStyles", "enableDebounceLeadingCall", "resizeObserverPolyfill"];
11437
- function _extends$A() {
11438
- _extends$A = Object.assign ? Object.assign.bind() : function(target) {
11426
+ LegendShape.propTypes = {
11427
+ itemIndex: _pt.number.isRequired,
11428
+ margin: _pt.oneOfType([_pt.string, _pt.number]),
11429
+ width: _pt.oneOfType([_pt.string, _pt.number]),
11430
+ height: _pt.oneOfType([_pt.string, _pt.number])
11431
+ };
11432
+ function valueOrIdentity(_2) {
11433
+ if (_2 && typeof _2 === "object" && "value" in _2 && typeof _2.value !== "undefined")
11434
+ return _2.value;
11435
+ return _2;
11436
+ }
11437
+ function valueOrIdentityString(_2) {
11438
+ return String(valueOrIdentity(_2));
11439
+ }
11440
+ function labelTransformFactory(_ref) {
11441
+ var scale = _ref.scale, labelFormat = _ref.labelFormat;
11442
+ return function(d2, i2) {
11443
+ return {
11444
+ datum: d2,
11445
+ index: i2,
11446
+ text: "" + labelFormat(d2, i2),
11447
+ value: scale(d2)
11448
+ };
11449
+ };
11450
+ }
11451
+ var _excluded$l = ["className", "style", "scale", "shape", "domain", "fill", "size", "labelFormat", "labelTransform", "shapeWidth", "shapeHeight", "shapeMargin", "shapeStyle", "labelAlign", "labelFlex", "labelMargin", "itemMargin", "direction", "itemDirection", "legendLabelProps", "children"];
11452
+ function _extends$v() {
11453
+ _extends$v = Object.assign ? Object.assign.bind() : function(target) {
11439
11454
  for (var i2 = 1; i2 < arguments.length; i2++) {
11440
11455
  var source = arguments[i2];
11441
11456
  for (var key in source) {
@@ -11446,9 +11461,9 @@ function _extends$A() {
11446
11461
  }
11447
11462
  return target;
11448
11463
  };
11449
- return _extends$A.apply(this, arguments);
11464
+ return _extends$v.apply(this, arguments);
11450
11465
  }
11451
- function _objectWithoutPropertiesLoose$n(source, excluded) {
11466
+ function _objectWithoutPropertiesLoose$l(source, excluded) {
11452
11467
  if (source == null)
11453
11468
  return {};
11454
11469
  var target = {};
@@ -11462,438 +11477,389 @@ function _objectWithoutPropertiesLoose$n(source, excluded) {
11462
11477
  }
11463
11478
  return target;
11464
11479
  }
11465
- var defaultIgnoreDimensions$1 = [];
11466
- var defaultParentSizeStyles$1 = {
11467
- width: "100%",
11468
- height: "100%"
11480
+ var defaultStyle = {
11481
+ display: "flex"
11469
11482
  };
11470
- function ParentSize$1(_ref) {
11471
- var className = _ref.className, children2 = _ref.children, _ref$debounceTime = _ref.debounceTime, debounceTime = _ref$debounceTime === void 0 ? 300 : _ref$debounceTime, _ref$ignoreDimensions = _ref.ignoreDimensions, ignoreDimensions = _ref$ignoreDimensions === void 0 ? defaultIgnoreDimensions$1 : _ref$ignoreDimensions, _ref$parentSizeStyles = _ref.parentSizeStyles, parentSizeStyles = _ref$parentSizeStyles === void 0 ? defaultParentSizeStyles$1 : _ref$parentSizeStyles, _ref$enableDebounceLe = _ref.enableDebounceLeadingCall, enableDebounceLeadingCall = _ref$enableDebounceLe === void 0 ? true : _ref$enableDebounceLe, resizeObserverPolyfill = _ref.resizeObserverPolyfill, restProps = _objectWithoutPropertiesLoose$n(_ref, _excluded$n);
11472
- var target = useRef(null);
11473
- var animationFrameID = useRef(0);
11474
- var _useState = useState({
11475
- width: 0,
11476
- height: 0,
11477
- top: 0,
11478
- left: 0
11479
- }), state = _useState[0], setState = _useState[1];
11480
- var resize = useMemo(function() {
11481
- var normalized = Array.isArray(ignoreDimensions) ? ignoreDimensions : [ignoreDimensions];
11482
- return debounce$1(function(incoming) {
11483
- setState(function(existing) {
11484
- var stateKeys = Object.keys(existing);
11485
- var keysWithChanges = stateKeys.filter(function(key) {
11486
- return existing[key] !== incoming[key];
11487
- });
11488
- var shouldBail = keysWithChanges.every(function(key) {
11489
- return normalized.includes(key);
11490
- });
11491
- return shouldBail ? existing : incoming;
11492
- });
11493
- }, debounceTime, {
11494
- leading: enableDebounceLeadingCall
11495
- });
11496
- }, [debounceTime, enableDebounceLeadingCall, ignoreDimensions]);
11497
- useEffect(function() {
11498
- var LocalResizeObserver = resizeObserverPolyfill || window.ResizeObserver;
11499
- var observer = new LocalResizeObserver(function(entries) {
11500
- entries.forEach(function(entry) {
11501
- var _entry$contentRect;
11502
- var _ref2 = (_entry$contentRect = entry == null ? void 0 : entry.contentRect) != null ? _entry$contentRect : {}, left2 = _ref2.left, top2 = _ref2.top, width = _ref2.width, height = _ref2.height;
11503
- animationFrameID.current = window.requestAnimationFrame(function() {
11504
- resize({
11505
- width,
11506
- height,
11507
- top: top2,
11508
- left: left2
11509
- });
11510
- });
11511
- });
11512
- });
11513
- if (target.current)
11514
- observer.observe(target.current);
11515
- return function() {
11516
- window.cancelAnimationFrame(animationFrameID.current);
11517
- observer.disconnect();
11518
- resize.cancel();
11519
- };
11520
- }, [resize, resizeObserverPolyfill]);
11521
- return /* @__PURE__ */ jsx("div", {
11522
- style: parentSizeStyles,
11523
- ref: target,
11524
- className,
11525
- ...restProps,
11526
- children: children2(_extends$A({}, state, {
11527
- ref: target.current,
11528
- resize
11529
- }))
11483
+ function Legend$1(_ref) {
11484
+ var className = _ref.className, _ref$style = _ref.style, style2 = _ref$style === void 0 ? defaultStyle : _ref$style, scale = _ref.scale, shape = _ref.shape, inputDomain = _ref.domain, _ref$fill = _ref.fill, fill = _ref$fill === void 0 ? valueOrIdentityString : _ref$fill, _ref$size = _ref.size, size = _ref$size === void 0 ? valueOrIdentityString : _ref$size, _ref$labelFormat = _ref.labelFormat, labelFormat = _ref$labelFormat === void 0 ? valueOrIdentity : _ref$labelFormat, _ref$labelTransform = _ref.labelTransform, labelTransform = _ref$labelTransform === void 0 ? labelTransformFactory : _ref$labelTransform, _ref$shapeWidth = _ref.shapeWidth, shapeWidth = _ref$shapeWidth === void 0 ? 15 : _ref$shapeWidth, _ref$shapeHeight = _ref.shapeHeight, shapeHeight = _ref$shapeHeight === void 0 ? 15 : _ref$shapeHeight, _ref$shapeMargin = _ref.shapeMargin, shapeMargin = _ref$shapeMargin === void 0 ? "2px 4px 2px 0" : _ref$shapeMargin, shapeStyle = _ref.shapeStyle, _ref$labelAlign = _ref.labelAlign, labelAlign = _ref$labelAlign === void 0 ? "left" : _ref$labelAlign, _ref$labelFlex = _ref.labelFlex, labelFlex = _ref$labelFlex === void 0 ? "1" : _ref$labelFlex, _ref$labelMargin = _ref.labelMargin, labelMargin = _ref$labelMargin === void 0 ? "0 4px" : _ref$labelMargin, _ref$itemMargin = _ref.itemMargin, itemMargin = _ref$itemMargin === void 0 ? "0" : _ref$itemMargin, _ref$direction = _ref.direction, direction = _ref$direction === void 0 ? "column" : _ref$direction, _ref$itemDirection = _ref.itemDirection, itemDirection = _ref$itemDirection === void 0 ? "row" : _ref$itemDirection, legendLabelProps = _ref.legendLabelProps, children2 = _ref.children, legendItemProps = _objectWithoutPropertiesLoose$l(_ref, _excluded$l);
11485
+ var domain2 = inputDomain || ("domain" in scale ? scale.domain() : []);
11486
+ var labelFormatter = labelTransform({
11487
+ scale,
11488
+ labelFormat
11530
11489
  });
11490
+ var labels = domain2.map(labelFormatter);
11491
+ if (children2)
11492
+ return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, children2(labels));
11493
+ return /* @__PURE__ */ React__default.createElement("div", {
11494
+ className: cx("visx-legend", className),
11495
+ style: _extends$v({}, style2, {
11496
+ flexDirection: direction
11497
+ })
11498
+ }, labels.map(function(label, i2) {
11499
+ return /* @__PURE__ */ React__default.createElement(LegendItem, _extends$v({
11500
+ key: "legend-" + label.text + "-" + i2,
11501
+ margin: itemMargin,
11502
+ flexDirection: itemDirection
11503
+ }, legendItemProps), /* @__PURE__ */ React__default.createElement(LegendShape, {
11504
+ shape,
11505
+ height: shapeHeight,
11506
+ width: shapeWidth,
11507
+ margin: shapeMargin,
11508
+ item: domain2[i2],
11509
+ itemIndex: i2,
11510
+ label,
11511
+ fill,
11512
+ size,
11513
+ shapeStyle
11514
+ }), /* @__PURE__ */ React__default.createElement(LegendLabel, _extends$v({
11515
+ label: label.text,
11516
+ flex: labelFlex,
11517
+ margin: labelMargin,
11518
+ align: labelAlign
11519
+ }, legendLabelProps)));
11520
+ }));
11531
11521
  }
11532
- ParentSize$1.propTypes = {
11522
+ Legend$1.propTypes = {
11523
+ children: _pt.func,
11533
11524
  className: _pt.string,
11534
- debounceTime: _pt.number,
11535
- enableDebounceLeadingCall: _pt.bool,
11536
- ignoreDimensions: _pt.oneOfType([_pt.any, _pt.arrayOf(_pt.any)]),
11537
- children: _pt.func.isRequired
11525
+ domain: _pt.array,
11526
+ shapeWidth: _pt.oneOfType([_pt.string, _pt.number]),
11527
+ shapeHeight: _pt.oneOfType([_pt.string, _pt.number]),
11528
+ shapeMargin: _pt.oneOfType([_pt.string, _pt.number]),
11529
+ labelAlign: _pt.string,
11530
+ labelFlex: _pt.oneOfType([_pt.string, _pt.number]),
11531
+ labelMargin: _pt.oneOfType([_pt.string, _pt.number]),
11532
+ itemMargin: _pt.oneOfType([_pt.string, _pt.number]),
11533
+ fill: _pt.func,
11534
+ size: _pt.func,
11535
+ shapeStyle: _pt.func
11538
11536
  };
11539
- const Product1 = [
11540
- { x: "a", y: 100 },
11541
- { x: "b", y: 50 },
11542
- { x: "c", y: 100 },
11543
- { x: "d", y: 80 },
11544
- { x: "f", y: 100 },
11545
- { x: "g", y: 50 }
11546
- ];
11547
- const finalDataProvider = (type2, value) => {
11548
- var _a2, _b2, _c2, _d, _e2, _f, _g, _h, _i, _j, _k, _l, _m, _n2, _o, _p, _q, _r, _s, _t2, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E;
11549
- switch (type2) {
11550
- case "BarGraph":
11551
- return {
11552
- main: {
11553
- type: "barGraph",
11554
- data: ((_a2 = value == null ? void 0 : value.main) == null ? void 0 : _a2.data) || [{ x: "ASM", y: 100 }, { x: "SDM", y: 60 }, { x: "DCM", y: 40 }, { x: "RCM", y: 70 }],
11555
- header: "Bar Graph",
11556
- bottomLabel: "Name of Employe",
11557
- numTicks: 6,
11558
- leftLabel: "Value",
11559
- axisLeft: true,
11560
- axisBottom: true,
11561
- hideTicks: true,
11562
- hideLeftAxisLine: false,
11563
- hideBottomAxisLine: false,
11564
- bottomAxisWidth: "10px",
11565
- ...value.main
11566
- },
11567
- style: {
11568
- containerStyle: {
11569
- background: "white",
11570
- width: "90%",
11571
- height: "300",
11572
- borderRadius: "20px",
11573
- padding: "10px 0 2px 0",
11574
- ...(_b2 = value == null ? void 0 : value.style) == null ? void 0 : _b2.containerStyle
11575
- },
11576
- headerStyle: {
11577
- fontWeight: 500,
11578
- textAlign: "left",
11579
- fontFamily: "inherit",
11580
- marginBottom: "20px",
11581
- padding: "15px 0 1px 20px",
11582
- width: "100%",
11583
- fontSize: "18px",
11584
- ...(_c2 = value == null ? void 0 : value.style) == null ? void 0 : _c2.headerStyle
11585
- },
11586
- tooltipStyle: {
11587
- padding: "6px",
11588
- borderRadius: "2px",
11589
- ...(_d = value == null ? void 0 : value.style) == null ? void 0 : _d.tooltipStyle
11590
- },
11591
- labelStyle: {
11592
- leftLabelMargin: "75",
11593
- topLabelMargin: "-6",
11594
- labelColor: "black",
11595
- leftLabelOffset: 50,
11596
- bottomLabelOffset: 10,
11597
- tickLabelColor: "balck",
11598
- tickFontSize: "10px",
11599
- tickColor: "black",
11600
- rightAxisWidth: "0.3px",
11601
- fontSize: "10px",
11602
- ...(_e2 = value == null ? void 0 : value.style) == null ? void 0 : _e2.labelStyle
11603
- },
11604
- barStyle: {
11605
- mediumValueColor: "rgba(63, 81, 181, 0.85)",
11606
- highValueColor: "rgba(63, 81, 181, 0.85)",
11607
- lowValueColor: "rgba(63, 81, 181, 0.85)",
11608
- ...(_f = value == null ? void 0 : value.style) == null ? void 0 : _f.barStyle
11609
- }
11610
- }
11611
- };
11612
- case "PieGraph":
11613
- return {
11614
- main: {
11615
- data: ((_g = value == null ? void 0 : value.main) == null ? void 0 : _g.data) || [{ branch: "Kotak", value: 500 }, { branch: "SBI", value: 700 }, { branch: "HDFC", value: 900 }],
11616
- header: "Pie Graph",
11617
- bottomLabel: "Name of Employe",
11618
- leftLabel: "Value",
11619
- tooltipDataKey: ["First", "Second", "Third"],
11620
- axisLeft: true,
11621
- axisBottom: true,
11622
- legendAvailable: true,
11623
- ...value == null ? void 0 : value.main,
11624
- legend: {
11625
- labelColor: "green",
11626
- legendTitle: "Our Assests",
11627
- direction: "row",
11628
- align: "right",
11629
- ...(_h = value == null ? void 0 : value.main) == null ? void 0 : _h.legend
11630
- }
11631
- },
11632
- style: {
11633
- containerStyle: {
11634
- background: "white",
11635
- width: "100%",
11636
- height: "310",
11637
- borderRadius: "20px",
11638
- padding: "10px 0 2px 0",
11639
- ...(_i = value == null ? void 0 : value.style) == null ? void 0 : _i.containerStyle
11640
- },
11641
- headerStyle: {
11642
- fontWeight: 500,
11643
- textAlign: "left",
11644
- fontFamily: "inherit",
11645
- marginBottom: "20px",
11646
- padding: "15px 0 1px 20px",
11647
- width: "100%",
11648
- fontSize: "18px",
11649
- ...(_j = value == null ? void 0 : value.style) == null ? void 0 : _j.headerStyle
11650
- },
11651
- tooltipStyle: {
11652
- ...(_k = value == null ? void 0 : value.style) == null ? void 0 : _k.tooltipStyle
11537
+ function Ordinal(props) {
11538
+ return /* @__PURE__ */ React__default.createElement(Legend$1, props);
11539
+ }
11540
+ function Legend({
11541
+ value
11542
+ }) {
11543
+ var _a2, _b2, _c2, _d, _e2, _f, _g, _h, _i, _j, _k;
11544
+ const legendGlyphSize = ((_b2 = (_a2 = value == null ? void 0 : value.main) == null ? void 0 : _a2.legend) == null ? void 0 : _b2.colorRectWidth) || 15;
11545
+ const ordinalColorScale = createOrdinalScale$1({
11546
+ domain: (_c2 = value == null ? void 0 : value.main) == null ? void 0 : _c2.tooltipDataKey,
11547
+ range: (_e2 = (_d = value == null ? void 0 : value.style) == null ? void 0 : _d.pieStyle) == null ? void 0 : _e2.colorRange
11548
+ });
11549
+ return /* @__PURE__ */ jsxs("div", {
11550
+ className: "legend",
11551
+ style: (_g = (_f = value == null ? void 0 : value.style) == null ? void 0 : _f.legendStyle) == null ? void 0 : _g.legend,
11552
+ children: [/* @__PURE__ */ jsx("div", {
11553
+ className: "title",
11554
+ style: (_i = (_h = value == null ? void 0 : value.style) == null ? void 0 : _h.legendStyle) == null ? void 0 : _i.legendTitle,
11555
+ children: (_k = (_j = value == null ? void 0 : value.main) == null ? void 0 : _j.legend) == null ? void 0 : _k.legendTitle
11556
+ }), /* @__PURE__ */ jsx(Ordinal, {
11557
+ scale: ordinalColorScale,
11558
+ labelFormat: (label) => `${label.toUpperCase()}`,
11559
+ children: (labels) => {
11560
+ var _a3, _b3;
11561
+ return /* @__PURE__ */ jsx("div", {
11562
+ style: {
11563
+ display: "flex",
11564
+ flexDirection: ((_b3 = (_a3 = value == null ? void 0 : value.main) == null ? void 0 : _a3.legend) == null ? void 0 : _b3.direction) || "row"
11653
11565
  },
11654
- labelStyle: {
11655
- labelColor: "black",
11656
- labelOffset: 45,
11657
- leftLabelMargin: "70",
11658
- topLabelMargin: "-40",
11659
- ...(_l = value == null ? void 0 : value.style) == null ? void 0 : _l.labelStyle
11660
- },
11661
- legendStyle: {
11662
- legend: {
11663
- lineHeight: "0.9em",
11664
- color: "black",
11665
- fontSize: "10px",
11666
- fontFamily: "arial",
11667
- padding: "10px 10px",
11668
- float: "left",
11669
- border: "1px solid rgba(255, 255, 255, 0.3)",
11670
- borderRadius: " 8px",
11671
- margin: "5px 5px",
11672
- ...(_n2 = (_m = value == null ? void 0 : value.style) == null ? void 0 : _m.legendStyle) == null ? void 0 : _n2.legend
11673
- },
11674
- legendTitle: {
11675
- fontWeight: 500,
11676
- marginBottom: "5px",
11677
- fontFamily: "roboto",
11678
- fontSize: "10px",
11679
- ...(_p = (_o = value == null ? void 0 : value.style) == null ? void 0 : _o.legendStyle) == null ? void 0 : _p.legendTitle
11680
- }
11681
- },
11682
- pieStyle: {
11683
- colorRange: ["#3f51b5", "rgba(200,0,31,0.9)", "rgba(25,200,205,0.6)"],
11684
- outerRadius: 120,
11685
- innerRadius: 60,
11686
- cornerRadius: 2,
11687
- padAngle: 6e-3,
11688
- ...(_q = value == null ? void 0 : value.style) == null ? void 0 : _q.pieStyle
11689
- }
11690
- }
11691
- };
11692
- case "LineGraph":
11693
- return {
11694
- main: {
11695
- data: ((_r = value == null ? void 0 : value.main) == null ? void 0 : _r.data) || [Product1],
11696
- header: "Line Graph Dynamic",
11697
- bottomLabel: "Name of Employe",
11698
- leftLabel: "Value",
11699
- gridHidden: true,
11700
- numHidden: false,
11701
- tooltipDataKey: ["MAMA New Project", "Second", "Third"],
11702
- axisLeft: true,
11703
- axisBottom: true,
11704
- hideLeftAxisLine: false,
11705
- hideBottomAxisLine: false,
11706
- ...value == null ? void 0 : value.main,
11707
- legend: {
11708
- labelColor: "green",
11709
- legendTitle: "Our Assests",
11710
- direction: "row",
11711
- align: "right",
11712
- colorRectWidth: 20,
11713
- ...(_s = value == null ? void 0 : value.main) == null ? void 0 : _s.legend
11714
- }
11715
- },
11716
- style: {
11717
- containerStyle: {
11718
- background: "white",
11719
- width: "90%",
11720
- height: "300",
11721
- borderRadius: "20px",
11722
- padding: "10px 0 2px 0",
11723
- ...(_t2 = value == null ? void 0 : value.style) == null ? void 0 : _t2.containerStyle
11724
- },
11725
- headerStyle: {
11726
- fontWeight: 500,
11727
- textAlign: "left",
11728
- fontFamily: "inherit",
11729
- marginBottom: "20px",
11730
- padding: "15px 0 1px 20px",
11731
- width: "100%",
11732
- fontSize: "18px",
11733
- ...(_u = value == null ? void 0 : value.style) == null ? void 0 : _u.headerStyle
11734
- },
11735
- labelStyle: {
11736
- labelColor: "black",
11737
- bottomLabelOffset: 20,
11738
- leftLabelOffset: 50,
11739
- leftLabelMargin: 80,
11740
- ...(_v = value == null ? void 0 : value.style) == null ? void 0 : _v.labelStyle
11741
- },
11742
- lineStyle: {
11743
- colorRange: ["#3f51b5", "rgba(200,0,31,0.9)", "rgba(25,200,205,0.6)"],
11744
- lineAreaColor: "none",
11745
- lineAreaOpacity: 0.2,
11746
- ...(_w = value == null ? void 0 : value.style) == null ? void 0 : _w.lineStyle
11747
- }
11748
- }
11749
- };
11750
- case "HorizontalBarGraph":
11751
- return {
11752
- main: {
11753
- data: ((_x = value == null ? void 0 : value.main) == null ? void 0 : _x.data) || [{ y: "Anant Sharma", x: 60 }, { y: "Pankaj Chauhan", x: 60 }, { y: "satendra Raghav", x: 150 }, { y: "Vivek Pahadi", x: 80 }, { y: "Siddarth verma", x: 100 }],
11754
- header: " ",
11755
- bottomLabel: "Name of Employe",
11756
- leftLabel: "Value",
11757
- axisLeft: true,
11758
- axisBottom: true,
11759
- hideBottomTicks: false,
11760
- hideLeftTicks: ((_y = value == null ? void 0 : value.main) == null ? void 0 : _y.data) ? true : false,
11761
- hideLeftAxisLine: ((_z = value == null ? void 0 : value.main) == null ? void 0 : _z.data) ? true : false,
11762
- hideBottomAxisLine: false,
11763
- bottomAxisWidth: "10px",
11764
- ...value.main
11765
- },
11766
- style: {
11767
- containerStyle: {
11768
- background: "white",
11769
- width: "90%",
11770
- height: "300",
11771
- borderRadius: "20px",
11772
- padding: "10px 0 2px 0",
11773
- ...(_A = value == null ? void 0 : value.style) == null ? void 0 : _A.containerStyle
11774
- },
11775
- headerStyle: {
11776
- fontWeight: 500,
11777
- textAlign: "left",
11778
- fontFamily: "inherit",
11779
- marginBottom: "20px",
11780
- padding: "15px 0 1px 20px",
11781
- width: "100%",
11782
- fontSize: "18px",
11783
- ...(_B = value == null ? void 0 : value.style) == null ? void 0 : _B.headerStyle
11784
- },
11785
- tooltipStyle: {
11786
- padding: "6px",
11787
- borderRadius: "2px",
11788
- ...(_C = value == null ? void 0 : value.style) == null ? void 0 : _C.tooltipStyle
11789
- },
11790
- labelStyle: {
11791
- margin: { top: 10, left: 110, right: 40, bottom: 40 },
11792
- tickLabelColor: "#6c5efb",
11793
- leftLabelOffset: 140,
11794
- bottomLabelOffset: 14,
11795
- tickFontSize: "10px",
11796
- tickColor: "#6c5efb",
11797
- rightAxisWidth: "0.3px",
11798
- fontSize: "10px",
11799
- ...(_D = value == null ? void 0 : value.style) == null ? void 0 : _D.labelStyle
11800
- },
11801
- barStyle: {
11802
- color: "#6c5efb",
11803
- ...(_E = value == null ? void 0 : value.style) == null ? void 0 : _E.barStyle
11804
- }
11805
- }
11806
- };
11807
- }
11566
+ children: labels.map((label, i2) => {
11567
+ var _a4, _b4;
11568
+ return /* @__PURE__ */ jsxs(LegendItem, {
11569
+ margin: "0 5px",
11570
+ onClick: (events) => {
11571
+ if (events)
11572
+ alert(`clicked: ${JSON.stringify(label)}`);
11573
+ },
11574
+ children: [/* @__PURE__ */ jsx("svg", {
11575
+ width: legendGlyphSize,
11576
+ height: legendGlyphSize,
11577
+ children: /* @__PURE__ */ jsx("rect", {
11578
+ fill: label.value,
11579
+ width: legendGlyphSize,
11580
+ height: legendGlyphSize
11581
+ })
11582
+ }), /* @__PURE__ */ jsx(LegendLabel, {
11583
+ align: `${((_b4 = (_a4 = value == null ? void 0 : value.main) == null ? void 0 : _a4.legend) == null ? void 0 : _b4.align) || "left"}`,
11584
+ margin: "0 0 0 4px",
11585
+ children: label.text
11586
+ })]
11587
+ }, `legend-quantile-${i2}`);
11588
+ })
11589
+ });
11590
+ }
11591
+ })]
11592
+ });
11593
+ }
11594
+ const defaultMargin = {
11595
+ top: 20,
11596
+ right: 0,
11597
+ bottom: 40,
11598
+ left: 40
11808
11599
  };
11809
- const BarGraph = ({
11600
+ function DrawBarGraph({
11601
+ width,
11602
+ height,
11603
+ events = false,
11604
+ margin = defaultMargin,
11810
11605
  value
11811
- }) => {
11812
- var _a2, _b2, _c2, _d;
11813
- const barData = finalDataProvider("BarGraph", value);
11814
- let GraphRender = /* @__PURE__ */ jsx(ParentSize$1, {
11815
- children: (parent) => {
11816
- var _a3, _b3, _c3, _d2, _e2, _f, _g, _h, _i, _j, _k, _l, _m, _n2;
11817
- return /* @__PURE__ */ jsx(DrawBarGraph, {
11818
- width: parent.width || 400,
11819
- height: ((_b3 = (_a3 = barData == null ? void 0 : barData.style) == null ? void 0 : _a3.containerStyle) == null ? void 0 : _b3.height) | 400,
11820
- margin: {
11821
- top: ((_e2 = (_d2 = (_c3 = barData == null ? void 0 : barData.style) == null ? void 0 : _c3.labelStyle) == null ? void 0 : _d2.margin) == null ? void 0 : _e2.top) || 10,
11822
- right: ((_h = (_g = (_f = barData == null ? void 0 : barData.style) == null ? void 0 : _f.labelStyle) == null ? void 0 : _g.margin) == null ? void 0 : _h.right) || 10,
11823
- bottom: ((_k = (_j = (_i = barData == null ? void 0 : barData.style) == null ? void 0 : _i.labelStyle) == null ? void 0 : _j.margin) == null ? void 0 : _k.bottom) || 20,
11824
- left: ((_n2 = (_m = (_l = barData == null ? void 0 : barData.style) == null ? void 0 : _l.labelStyle) == null ? void 0 : _m.margin) == null ? void 0 : _n2.left) || 60
11825
- },
11826
- value: barData
11827
- });
11828
- }
11606
+ }) {
11607
+ var _a2, _b2, _c2, _d, _e2, _f, _g, _h, _i, _j, _k;
11608
+ const data = (_a2 = value.main) == null ? void 0 : _a2.data;
11609
+ const keys2 = Object.keys(data[0]).filter((d2) => d2 !== "label");
11610
+ const getDate = (d2) => d2.label;
11611
+ const dateScale = createBandScale({
11612
+ domain: data.map(getDate),
11613
+ padding: 0.2
11829
11614
  });
11830
- return /* @__PURE__ */ jsxs("div", {
11831
- style: (_a2 = barData == null ? void 0 : barData.style) == null ? void 0 : _a2.containerStyle,
11832
- children: [((_b2 = barData == null ? void 0 : barData.main) == null ? void 0 : _b2.header) && /* @__PURE__ */ jsx("div", {
11833
- style: {
11834
- fontWeight: 500,
11835
- textAlign: "left",
11836
- fontFamily: "inherit",
11837
- marginBottom: "20px",
11838
- padding: "15px 0 1px 20px",
11839
- fontSize: "18px",
11840
- color: "#121926",
11841
- ...(_c2 = barData == null ? void 0 : barData.style) == null ? void 0 : _c2.headerStyle
11842
- },
11843
- children: (_d = barData == null ? void 0 : barData.main) == null ? void 0 : _d.header
11844
- }), GraphRender]
11615
+ const cityScale = createBandScale({
11616
+ domain: keys2,
11617
+ padding: 0.1
11845
11618
  });
11846
- };
11847
- var _excluded$m = ["flexDirection", "alignItems", "margin", "display", "children"];
11848
- function _extends$z() {
11849
- _extends$z = Object.assign ? Object.assign.bind() : function(target) {
11850
- for (var i2 = 1; i2 < arguments.length; i2++) {
11851
- var source = arguments[i2];
11852
- for (var key in source) {
11853
- if (Object.prototype.hasOwnProperty.call(source, key)) {
11854
- target[key] = source[key];
11855
- }
11856
- }
11857
- }
11858
- return target;
11859
- };
11860
- return _extends$z.apply(this, arguments);
11861
- }
11862
- function _objectWithoutPropertiesLoose$m(source, excluded) {
11863
- if (source == null)
11864
- return {};
11865
- var target = {};
11866
- var sourceKeys = Object.keys(source);
11867
- var key, i2;
11868
- for (i2 = 0; i2 < sourceKeys.length; i2++) {
11869
- key = sourceKeys[i2];
11870
- if (excluded.indexOf(key) >= 0)
11871
- continue;
11872
- target[key] = source[key];
11619
+ const tempScale = createLinearScale({
11620
+ domain: [0, Math.max(...data.map((d2) => Math.max(...keys2.map((key) => Number(d2[key])))))]
11621
+ });
11622
+ const colorScale = createOrdinalScale$1({
11623
+ domain: keys2,
11624
+ range: [((_d = (_c2 = (_b2 = value.style) == null ? void 0 : _b2.barStyle) == null ? void 0 : _c2.color) == null ? void 0 : _d.firstBarColor) || "#aeeef8", ((_g = (_f = (_e2 = value.style) == null ? void 0 : _e2.barStyle) == null ? void 0 : _f.color) == null ? void 0 : _g.secondBarColor) || "e5fd3d", ((_j = (_i = (_h = value.style) == null ? void 0 : _h.barStyle) == null ? void 0 : _i.color) == null ? void 0 : _j.thirdBarColor) || "#9caff6"]
11625
+ });
11626
+ const xMax = width - margin.left - margin.right;
11627
+ const yMax = height - margin.top - margin.bottom;
11628
+ dateScale.rangeRound([0, xMax]);
11629
+ cityScale.rangeRound([0, dateScale.bandwidth()]);
11630
+ tempScale.range([yMax, 0]);
11631
+ const {
11632
+ tooltipData,
11633
+ tooltipLeft,
11634
+ tooltipTop,
11635
+ tooltipOpen,
11636
+ showTooltip,
11637
+ hideTooltip
11638
+ } = useTooltip();
11639
+ const handleMouse = (event, datum2) => {
11640
+ console.log(datum2);
11641
+ showTooltip({
11642
+ tooltipLeft: event.clientX,
11643
+ tooltipTop: event.clientY,
11644
+ tooltipData: [datum2.key, datum2.value, datum2.color]
11645
+ });
11646
+ };
11647
+ return width < 10 ? null : /* @__PURE__ */ jsxs("div", {
11648
+ children: [((_k = value == null ? void 0 : value.main) == null ? void 0 : _k.legendAvailable) && /* @__PURE__ */ jsx(Legend, {
11649
+ value
11650
+ }), /* @__PURE__ */ jsxs("svg", {
11651
+ width,
11652
+ height,
11653
+ children: [/* @__PURE__ */ jsx("rect", {
11654
+ x: 0,
11655
+ y: 0,
11656
+ width,
11657
+ height,
11658
+ fill: value.style.containerStyle.background || "#612efb",
11659
+ rx: 14
11660
+ }), /* @__PURE__ */ jsxs(Group, {
11661
+ top: margin.top,
11662
+ left: margin.left,
11663
+ children: [/* @__PURE__ */ jsx(LeftAxis, {
11664
+ value,
11665
+ yScale: tempScale,
11666
+ parentWidth: width
11667
+ }), /* @__PURE__ */ jsx(BarGroup, {
11668
+ data,
11669
+ keys: keys2,
11670
+ height: yMax,
11671
+ x0: getDate,
11672
+ x0Scale: dateScale,
11673
+ x1Scale: cityScale,
11674
+ yScale: tempScale,
11675
+ color: colorScale,
11676
+ children: (barGroups) => barGroups.map((barGroup) => /* @__PURE__ */ jsx(Group, {
11677
+ left: barGroup.x0,
11678
+ children: barGroup.bars.map((bar) => /* @__PURE__ */ jsx("rect", {
11679
+ x: bar.x,
11680
+ y: bar.y,
11681
+ width: bar.width,
11682
+ height: bar.height,
11683
+ fill: bar.color,
11684
+ rx: 4,
11685
+ onMouseOver: (e3) => handleMouse(e3, bar),
11686
+ onMouseOut: hideTooltip,
11687
+ onClick: () => {
11688
+ if (!events)
11689
+ return;
11690
+ const {
11691
+ key,
11692
+ value: value2
11693
+ } = bar;
11694
+ alert(JSON.stringify({
11695
+ key,
11696
+ value: value2
11697
+ }));
11698
+ }
11699
+ }, `bar-group-bar-${barGroup.index}-${bar.index}-${bar.value}-${bar.key}`))
11700
+ }, `bar-group-${barGroup.index}-${barGroup.x0}`))
11701
+ })]
11702
+ }), /* @__PURE__ */ jsx(BottomAxis, {
11703
+ yMax: yMax + margin.top,
11704
+ value,
11705
+ left: margin.left,
11706
+ xScale: dateScale,
11707
+ parentWidth: width
11708
+ })]
11709
+ }), tooltipOpen && /* @__PURE__ */ jsx(ToolTip, {
11710
+ style: {
11711
+ ...value == null ? void 0 : value.style,
11712
+ tooltipbackground: tooltipData[2]
11713
+ },
11714
+ top: tooltipTop,
11715
+ left: tooltipLeft,
11716
+ tooltipData
11717
+ })]
11718
+ });
11719
+ }
11720
+ var root$4 = _root;
11721
+ var now$2 = function() {
11722
+ return root$4.Date.now();
11723
+ };
11724
+ var now_1 = now$2;
11725
+ var reWhitespace$1 = /\s/;
11726
+ function trimmedEndIndex$2(string2) {
11727
+ var index2 = string2.length;
11728
+ while (index2-- && reWhitespace$1.test(string2.charAt(index2))) {
11873
11729
  }
11874
- return target;
11730
+ return index2;
11875
11731
  }
11876
- function LegendItem(_ref) {
11877
- var _ref$flexDirection = _ref.flexDirection, flexDirection = _ref$flexDirection === void 0 ? "row" : _ref$flexDirection, _ref$alignItems = _ref.alignItems, alignItems = _ref$alignItems === void 0 ? "center" : _ref$alignItems, _ref$margin = _ref.margin, margin = _ref$margin === void 0 ? "0" : _ref$margin, _ref$display = _ref.display, display = _ref$display === void 0 ? "flex" : _ref$display, children2 = _ref.children, restProps = _objectWithoutPropertiesLoose$m(_ref, _excluded$m);
11878
- return /* @__PURE__ */ React__default.createElement("div", _extends$z({
11879
- className: "visx-legend-item",
11880
- style: {
11881
- display,
11882
- alignItems,
11883
- flexDirection,
11884
- margin
11732
+ var _trimmedEndIndex = trimmedEndIndex$2;
11733
+ var trimmedEndIndex$1 = _trimmedEndIndex;
11734
+ var reTrimStart$1 = /^\s+/;
11735
+ function baseTrim$2(string2) {
11736
+ return string2 ? string2.slice(0, trimmedEndIndex$1(string2) + 1).replace(reTrimStart$1, "") : string2;
11737
+ }
11738
+ var _baseTrim = baseTrim$2;
11739
+ function isObjectLike$2(value) {
11740
+ return value != null && typeof value == "object";
11741
+ }
11742
+ var isObjectLike_1 = isObjectLike$2;
11743
+ var baseGetTag$1 = _baseGetTag, isObjectLike$1 = isObjectLike_1;
11744
+ var symbolTag$1 = "[object Symbol]";
11745
+ function isSymbol$2(value) {
11746
+ return typeof value == "symbol" || isObjectLike$1(value) && baseGetTag$1(value) == symbolTag$1;
11747
+ }
11748
+ var isSymbol_1 = isSymbol$2;
11749
+ var baseTrim$1 = _baseTrim, isObject$2 = isObject_1, isSymbol$1 = isSymbol_1;
11750
+ var NAN$1 = 0 / 0;
11751
+ var reIsBadHex$1 = /^[-+]0x[0-9a-f]+$/i;
11752
+ var reIsBinary$1 = /^0b[01]+$/i;
11753
+ var reIsOctal$1 = /^0o[0-7]+$/i;
11754
+ var freeParseInt$1 = parseInt;
11755
+ function toNumber$2(value) {
11756
+ if (typeof value == "number") {
11757
+ return value;
11758
+ }
11759
+ if (isSymbol$1(value)) {
11760
+ return NAN$1;
11761
+ }
11762
+ if (isObject$2(value)) {
11763
+ var other = typeof value.valueOf == "function" ? value.valueOf() : value;
11764
+ value = isObject$2(other) ? other + "" : other;
11765
+ }
11766
+ if (typeof value != "string") {
11767
+ return value === 0 ? value : +value;
11768
+ }
11769
+ value = baseTrim$1(value);
11770
+ var isBinary = reIsBinary$1.test(value);
11771
+ return isBinary || reIsOctal$1.test(value) ? freeParseInt$1(value.slice(2), isBinary ? 2 : 8) : reIsBadHex$1.test(value) ? NAN$1 : +value;
11772
+ }
11773
+ var toNumber_1 = toNumber$2;
11774
+ var isObject$1 = isObject_1, now$1 = now_1, toNumber$1 = toNumber_1;
11775
+ var FUNC_ERROR_TEXT = "Expected a function";
11776
+ var nativeMax = Math.max, nativeMin$1 = Math.min;
11777
+ function debounce(func, wait, options) {
11778
+ var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
11779
+ if (typeof func != "function") {
11780
+ throw new TypeError(FUNC_ERROR_TEXT);
11781
+ }
11782
+ wait = toNumber$1(wait) || 0;
11783
+ if (isObject$1(options)) {
11784
+ leading = !!options.leading;
11785
+ maxing = "maxWait" in options;
11786
+ maxWait = maxing ? nativeMax(toNumber$1(options.maxWait) || 0, wait) : maxWait;
11787
+ trailing = "trailing" in options ? !!options.trailing : trailing;
11788
+ }
11789
+ function invokeFunc(time2) {
11790
+ var args = lastArgs, thisArg = lastThis;
11791
+ lastArgs = lastThis = void 0;
11792
+ lastInvokeTime = time2;
11793
+ result = func.apply(thisArg, args);
11794
+ return result;
11795
+ }
11796
+ function leadingEdge(time2) {
11797
+ lastInvokeTime = time2;
11798
+ timerId = setTimeout(timerExpired, wait);
11799
+ return leading ? invokeFunc(time2) : result;
11800
+ }
11801
+ function remainingWait(time2) {
11802
+ var timeSinceLastCall = time2 - lastCallTime, timeSinceLastInvoke = time2 - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
11803
+ return maxing ? nativeMin$1(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
11804
+ }
11805
+ function shouldInvoke(time2) {
11806
+ var timeSinceLastCall = time2 - lastCallTime, timeSinceLastInvoke = time2 - lastInvokeTime;
11807
+ return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
11808
+ }
11809
+ function timerExpired() {
11810
+ var time2 = now$1();
11811
+ if (shouldInvoke(time2)) {
11812
+ return trailingEdge(time2);
11885
11813
  }
11886
- }, restProps), children2);
11814
+ timerId = setTimeout(timerExpired, remainingWait(time2));
11815
+ }
11816
+ function trailingEdge(time2) {
11817
+ timerId = void 0;
11818
+ if (trailing && lastArgs) {
11819
+ return invokeFunc(time2);
11820
+ }
11821
+ lastArgs = lastThis = void 0;
11822
+ return result;
11823
+ }
11824
+ function cancel() {
11825
+ if (timerId !== void 0) {
11826
+ clearTimeout(timerId);
11827
+ }
11828
+ lastInvokeTime = 0;
11829
+ lastArgs = lastCallTime = lastThis = timerId = void 0;
11830
+ }
11831
+ function flush() {
11832
+ return timerId === void 0 ? result : trailingEdge(now$1());
11833
+ }
11834
+ function debounced() {
11835
+ var time2 = now$1(), isInvoking = shouldInvoke(time2);
11836
+ lastArgs = arguments;
11837
+ lastThis = this;
11838
+ lastCallTime = time2;
11839
+ if (isInvoking) {
11840
+ if (timerId === void 0) {
11841
+ return leadingEdge(lastCallTime);
11842
+ }
11843
+ if (maxing) {
11844
+ clearTimeout(timerId);
11845
+ timerId = setTimeout(timerExpired, wait);
11846
+ return invokeFunc(lastCallTime);
11847
+ }
11848
+ }
11849
+ if (timerId === void 0) {
11850
+ timerId = setTimeout(timerExpired, wait);
11851
+ }
11852
+ return result;
11853
+ }
11854
+ debounced.cancel = cancel;
11855
+ debounced.flush = flush;
11856
+ return debounced;
11887
11857
  }
11888
- LegendItem.propTypes = {
11889
- alignItems: _pt.string,
11890
- margin: _pt.oneOfType([_pt.string, _pt.number]),
11891
- children: _pt.node,
11892
- display: _pt.string
11893
- };
11894
- var _excluded$l = ["flex", "label", "margin", "align", "children"];
11895
- function _extends$y() {
11896
- _extends$y = Object.assign ? Object.assign.bind() : function(target) {
11858
+ var debounce_1 = debounce;
11859
+ var debounce$1 = debounce_1;
11860
+ var _excluded$k = ["className", "children", "debounceTime", "ignoreDimensions", "parentSizeStyles", "enableDebounceLeadingCall", "resizeObserverPolyfill"];
11861
+ function _extends$u() {
11862
+ _extends$u = Object.assign ? Object.assign.bind() : function(target) {
11897
11863
  for (var i2 = 1; i2 < arguments.length; i2++) {
11898
11864
  var source = arguments[i2];
11899
11865
  for (var key in source) {
@@ -11904,9 +11870,9 @@ function _extends$y() {
11904
11870
  }
11905
11871
  return target;
11906
11872
  };
11907
- return _extends$y.apply(this, arguments);
11873
+ return _extends$u.apply(this, arguments);
11908
11874
  }
11909
- function _objectWithoutPropertiesLoose$l(source, excluded) {
11875
+ function _objectWithoutPropertiesLoose$k(source, excluded) {
11910
11876
  if (source == null)
11911
11877
  return {};
11912
11878
  var target = {};
@@ -11920,350 +11886,388 @@ function _objectWithoutPropertiesLoose$l(source, excluded) {
11920
11886
  }
11921
11887
  return target;
11922
11888
  }
11923
- function LegendLabel(_ref) {
11924
- var _ref$flex = _ref.flex, flex = _ref$flex === void 0 ? "1" : _ref$flex, label = _ref.label, _ref$margin = _ref.margin, margin = _ref$margin === void 0 ? "5px 0" : _ref$margin, _ref$align = _ref.align, align2 = _ref$align === void 0 ? "left" : _ref$align, children2 = _ref.children, restProps = _objectWithoutPropertiesLoose$l(_ref, _excluded$l);
11925
- return /* @__PURE__ */ React__default.createElement("div", _extends$y({
11926
- className: "visx-legend-label",
11927
- style: {
11928
- justifyContent: align2,
11929
- display: "flex",
11930
- flex,
11931
- margin
11932
- }
11933
- }, restProps), children2 || label);
11934
- }
11935
- LegendLabel.propTypes = {
11936
- align: _pt.string,
11937
- label: _pt.node,
11938
- flex: _pt.oneOfType([_pt.string, _pt.number]),
11939
- margin: _pt.oneOfType([_pt.string, _pt.number]),
11940
- children: _pt.node
11889
+ var defaultIgnoreDimensions$1 = [];
11890
+ var defaultParentSizeStyles$1 = {
11891
+ width: "100%",
11892
+ height: "100%"
11941
11893
  };
11942
- function _extends$x() {
11943
- _extends$x = Object.assign ? Object.assign.bind() : function(target) {
11944
- for (var i2 = 1; i2 < arguments.length; i2++) {
11945
- var source = arguments[i2];
11946
- for (var key in source) {
11947
- if (Object.prototype.hasOwnProperty.call(source, key)) {
11948
- target[key] = source[key];
11949
- }
11950
- }
11951
- }
11952
- return target;
11953
- };
11954
- return _extends$x.apply(this, arguments);
11955
- }
11956
- function ShapeRect(_ref) {
11957
- var fill = _ref.fill, width = _ref.width, height = _ref.height, style2 = _ref.style;
11958
- return /* @__PURE__ */ React__default.createElement("div", {
11959
- style: _extends$x({
11960
- width,
11961
- height,
11962
- background: fill
11963
- }, style2)
11894
+ function ParentSize$1(_ref) {
11895
+ var className = _ref.className, children2 = _ref.children, _ref$debounceTime = _ref.debounceTime, debounceTime = _ref$debounceTime === void 0 ? 300 : _ref$debounceTime, _ref$ignoreDimensions = _ref.ignoreDimensions, ignoreDimensions = _ref$ignoreDimensions === void 0 ? defaultIgnoreDimensions$1 : _ref$ignoreDimensions, _ref$parentSizeStyles = _ref.parentSizeStyles, parentSizeStyles = _ref$parentSizeStyles === void 0 ? defaultParentSizeStyles$1 : _ref$parentSizeStyles, _ref$enableDebounceLe = _ref.enableDebounceLeadingCall, enableDebounceLeadingCall = _ref$enableDebounceLe === void 0 ? true : _ref$enableDebounceLe, resizeObserverPolyfill = _ref.resizeObserverPolyfill, restProps = _objectWithoutPropertiesLoose$k(_ref, _excluded$k);
11896
+ var target = useRef(null);
11897
+ var animationFrameID = useRef(0);
11898
+ var _useState = useState({
11899
+ width: 0,
11900
+ height: 0,
11901
+ top: 0,
11902
+ left: 0
11903
+ }), state = _useState[0], setState = _useState[1];
11904
+ var resize = useMemo(function() {
11905
+ var normalized = Array.isArray(ignoreDimensions) ? ignoreDimensions : [ignoreDimensions];
11906
+ return debounce$1(function(incoming) {
11907
+ setState(function(existing) {
11908
+ var stateKeys = Object.keys(existing);
11909
+ var keysWithChanges = stateKeys.filter(function(key) {
11910
+ return existing[key] !== incoming[key];
11911
+ });
11912
+ var shouldBail = keysWithChanges.every(function(key) {
11913
+ return normalized.includes(key);
11914
+ });
11915
+ return shouldBail ? existing : incoming;
11916
+ });
11917
+ }, debounceTime, {
11918
+ leading: enableDebounceLeadingCall
11919
+ });
11920
+ }, [debounceTime, enableDebounceLeadingCall, ignoreDimensions]);
11921
+ useEffect(function() {
11922
+ var LocalResizeObserver = resizeObserverPolyfill || window.ResizeObserver;
11923
+ var observer = new LocalResizeObserver(function(entries) {
11924
+ entries.forEach(function(entry) {
11925
+ var _entry$contentRect;
11926
+ var _ref2 = (_entry$contentRect = entry == null ? void 0 : entry.contentRect) != null ? _entry$contentRect : {}, left2 = _ref2.left, top2 = _ref2.top, width = _ref2.width, height = _ref2.height;
11927
+ animationFrameID.current = window.requestAnimationFrame(function() {
11928
+ resize({
11929
+ width,
11930
+ height,
11931
+ top: top2,
11932
+ left: left2
11933
+ });
11934
+ });
11935
+ });
11936
+ });
11937
+ if (target.current)
11938
+ observer.observe(target.current);
11939
+ return function() {
11940
+ window.cancelAnimationFrame(animationFrameID.current);
11941
+ observer.disconnect();
11942
+ resize.cancel();
11943
+ };
11944
+ }, [resize, resizeObserverPolyfill]);
11945
+ return /* @__PURE__ */ jsx("div", {
11946
+ style: parentSizeStyles,
11947
+ ref: target,
11948
+ className,
11949
+ ...restProps,
11950
+ children: children2(_extends$u({}, state, {
11951
+ ref: target.current,
11952
+ resize
11953
+ }))
11964
11954
  });
11965
11955
  }
11966
- ShapeRect.propTypes = {
11967
- fill: _pt.string,
11968
- width: _pt.oneOfType([_pt.string, _pt.number]),
11969
- height: _pt.oneOfType([_pt.string, _pt.number])
11970
- };
11971
- function ShapeCircle(_ref) {
11972
- var fill = _ref.fill, width = _ref.width, height = _ref.height, style2 = _ref.style;
11973
- var cleanWidth = typeof width === "string" || typeof width === "undefined" ? 0 : width;
11974
- var cleanHeight = typeof height === "string" || typeof height === "undefined" ? 0 : height;
11975
- var size = Math.max(cleanWidth, cleanHeight);
11976
- var radius = size / 2;
11977
- return /* @__PURE__ */ React__default.createElement("svg", {
11978
- width: size,
11979
- height: size
11980
- }, /* @__PURE__ */ React__default.createElement(Group, {
11981
- top: radius,
11982
- left: radius
11983
- }, /* @__PURE__ */ React__default.createElement("circle", {
11984
- r: radius,
11985
- fill,
11986
- style: style2
11987
- })));
11988
- }
11989
- ShapeCircle.propTypes = {
11990
- fill: _pt.string,
11991
- width: _pt.oneOfType([_pt.string, _pt.number]),
11992
- height: _pt.oneOfType([_pt.string, _pt.number])
11993
- };
11994
- function ShapeLine(_ref) {
11995
- var fill = _ref.fill, width = _ref.width, height = _ref.height, style2 = _ref.style;
11996
- var cleanHeight = typeof height === "string" || typeof height === "undefined" ? 0 : height;
11997
- var lineThickness = typeof (style2 == null ? void 0 : style2.strokeWidth) === "number" ? style2 == null ? void 0 : style2.strokeWidth : 2;
11998
- return /* @__PURE__ */ React__default.createElement("svg", {
11999
- width,
12000
- height
12001
- }, /* @__PURE__ */ React__default.createElement(Group, {
12002
- top: cleanHeight / 2 - lineThickness / 2
12003
- }, /* @__PURE__ */ React__default.createElement("line", {
12004
- x1: 0,
12005
- x2: width,
12006
- y1: 0,
12007
- y2: 0,
12008
- stroke: fill,
12009
- strokeWidth: lineThickness,
12010
- style: style2
12011
- })));
12012
- }
12013
- ShapeLine.propTypes = {
12014
- fill: _pt.string,
12015
- width: _pt.oneOfType([_pt.string, _pt.number]),
12016
- height: _pt.oneOfType([_pt.string, _pt.number])
11956
+ ParentSize$1.propTypes = {
11957
+ className: _pt.string,
11958
+ debounceTime: _pt.number,
11959
+ enableDebounceLeadingCall: _pt.bool,
11960
+ ignoreDimensions: _pt.oneOfType([_pt.any, _pt.arrayOf(_pt.any)]),
11961
+ children: _pt.func.isRequired
12017
11962
  };
12018
- function _extends$w() {
12019
- _extends$w = Object.assign ? Object.assign.bind() : function(target) {
12020
- for (var i2 = 1; i2 < arguments.length; i2++) {
12021
- var source = arguments[i2];
12022
- for (var key in source) {
12023
- if (Object.prototype.hasOwnProperty.call(source, key)) {
12024
- target[key] = source[key];
11963
+ const Product1 = [
11964
+ { x: "a", y: 100 },
11965
+ { x: "b", y: 50 },
11966
+ { x: "c", y: 100 },
11967
+ { x: "d", y: 80 },
11968
+ { x: "f", y: 100 },
11969
+ { x: "g", y: 50 }
11970
+ ];
11971
+ const finalDataProvider = (type2, value) => {
11972
+ var _a2, _b2, _c2, _d, _e2, _f, _g, _h, _i, _j, _k, _l, _m, _n2, _o, _p, _q, _r, _s, _t2, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E;
11973
+ switch (type2) {
11974
+ case "BarGraph":
11975
+ return {
11976
+ main: {
11977
+ type: "barGraph",
11978
+ data: ((_a2 = value == null ? void 0 : value.main) == null ? void 0 : _a2.data) || [{ x: "ASM", y: 100 }, { x: "SDM", y: 60 }, { x: "DCM", y: 40 }, { x: "RCM", y: 70 }],
11979
+ header: "Bar Graph",
11980
+ bottomLabel: "Name of Employe",
11981
+ numTicks: 6,
11982
+ leftLabel: "Value",
11983
+ axisLeft: true,
11984
+ axisBottom: true,
11985
+ hideTicks: true,
11986
+ hideLeftAxisLine: false,
11987
+ hideBottomAxisLine: false,
11988
+ bottomAxisWidth: "10px",
11989
+ ...value.main
11990
+ },
11991
+ style: {
11992
+ containerStyle: {
11993
+ background: "white",
11994
+ width: "90%",
11995
+ height: "300",
11996
+ borderRadius: "20px",
11997
+ padding: "10px 0 2px 0",
11998
+ ...(_b2 = value == null ? void 0 : value.style) == null ? void 0 : _b2.containerStyle
11999
+ },
12000
+ headerStyle: {
12001
+ fontWeight: 500,
12002
+ textAlign: "left",
12003
+ fontFamily: "inherit",
12004
+ marginBottom: "20px",
12005
+ padding: "15px 0 1px 20px",
12006
+ width: "100%",
12007
+ fontSize: "18px",
12008
+ ...(_c2 = value == null ? void 0 : value.style) == null ? void 0 : _c2.headerStyle
12009
+ },
12010
+ tooltipStyle: {
12011
+ padding: "6px",
12012
+ borderRadius: "2px",
12013
+ ...(_d = value == null ? void 0 : value.style) == null ? void 0 : _d.tooltipStyle
12014
+ },
12015
+ labelStyle: {
12016
+ leftLabelMargin: "75",
12017
+ topLabelMargin: "-6",
12018
+ labelColor: "black",
12019
+ leftLabelOffset: 50,
12020
+ bottomLabelOffset: 45,
12021
+ tickLabelColor: "balck",
12022
+ tickFontSize: "10px",
12023
+ tickColor: "black",
12024
+ rightAxisWidth: "0.3px",
12025
+ fontSize: "10px",
12026
+ ...(_e2 = value == null ? void 0 : value.style) == null ? void 0 : _e2.labelStyle
12027
+ },
12028
+ barStyle: {
12029
+ mediumValueColor: "rgba(63, 81, 181, 0.85)",
12030
+ highValueColor: "rgba(63, 81, 181, 0.85)",
12031
+ lowValueColor: "rgba(63, 81, 181, 0.85)",
12032
+ ...(_f = value == null ? void 0 : value.style) == null ? void 0 : _f.barStyle
12033
+ }
12025
12034
  }
12026
- }
12027
- }
12028
- return target;
12029
- };
12030
- return _extends$w.apply(this, arguments);
12031
- }
12032
- var NO_OP = function NO_OP2() {
12033
- return void 0;
12034
- };
12035
- function renderShape(_ref) {
12036
- var _ref$shape = _ref.shape, shape = _ref$shape === void 0 ? "rect" : _ref$shape, _ref$fill = _ref.fill, fill = _ref$fill === void 0 ? NO_OP : _ref$fill, _ref$size = _ref.size, size = _ref$size === void 0 ? NO_OP : _ref$size, width = _ref.width, height = _ref.height, label = _ref.label, item = _ref.item, itemIndex = _ref.itemIndex, _ref$shapeStyle = _ref.shapeStyle, shapeStyle = _ref$shapeStyle === void 0 ? NO_OP : _ref$shapeStyle;
12037
- var props = {
12038
- width,
12039
- height,
12040
- item,
12041
- itemIndex,
12042
- label,
12043
- fill: fill(_extends$w({}, label)),
12044
- size: size(_extends$w({}, label)),
12045
- style: shapeStyle(_extends$w({}, label))
12046
- };
12047
- if (typeof shape === "string") {
12048
- if (shape === "circle") {
12049
- return /* @__PURE__ */ React__default.createElement(ShapeCircle, props);
12050
- }
12051
- if (shape === "line") {
12052
- return /* @__PURE__ */ React__default.createElement(ShapeLine, props);
12053
- }
12054
- return /* @__PURE__ */ React__default.createElement(ShapeRect, props);
12055
- }
12056
- if (/* @__PURE__ */ React__default.isValidElement(shape)) {
12057
- return /* @__PURE__ */ React__default.cloneElement(shape, props);
12058
- }
12059
- if (shape) {
12060
- return /* @__PURE__ */ React__default.createElement(shape, props);
12061
- }
12062
- return null;
12063
- }
12064
- function _extends$v() {
12065
- _extends$v = Object.assign ? Object.assign.bind() : function(target) {
12066
- for (var i2 = 1; i2 < arguments.length; i2++) {
12067
- var source = arguments[i2];
12068
- for (var key in source) {
12069
- if (Object.prototype.hasOwnProperty.call(source, key)) {
12070
- target[key] = source[key];
12035
+ };
12036
+ case "PieGraph":
12037
+ return {
12038
+ main: {
12039
+ data: ((_g = value == null ? void 0 : value.main) == null ? void 0 : _g.data) || [{ branch: "Kotak", value: 500 }, { branch: "SBI", value: 700 }, { branch: "HDFC", value: 900 }],
12040
+ header: "Pie Graph",
12041
+ bottomLabel: "Name of Employe",
12042
+ leftLabel: "Value",
12043
+ tooltipDataKey: ["First", "Second", "Third"],
12044
+ axisLeft: true,
12045
+ axisBottom: true,
12046
+ legendAvailable: true,
12047
+ ...value == null ? void 0 : value.main,
12048
+ legend: {
12049
+ labelColor: "green",
12050
+ legendTitle: "Our Assests",
12051
+ direction: "row",
12052
+ align: "right",
12053
+ ...(_h = value == null ? void 0 : value.main) == null ? void 0 : _h.legend
12054
+ }
12055
+ },
12056
+ style: {
12057
+ containerStyle: {
12058
+ background: "white",
12059
+ width: "100%",
12060
+ height: "310",
12061
+ borderRadius: "20px",
12062
+ padding: "10px 0 2px 0",
12063
+ ...(_i = value == null ? void 0 : value.style) == null ? void 0 : _i.containerStyle
12064
+ },
12065
+ headerStyle: {
12066
+ fontWeight: 500,
12067
+ textAlign: "left",
12068
+ fontFamily: "inherit",
12069
+ marginBottom: "20px",
12070
+ padding: "15px 0 1px 20px",
12071
+ width: "100%",
12072
+ fontSize: "18px",
12073
+ ...(_j = value == null ? void 0 : value.style) == null ? void 0 : _j.headerStyle
12074
+ },
12075
+ tooltipStyle: {
12076
+ ...(_k = value == null ? void 0 : value.style) == null ? void 0 : _k.tooltipStyle
12077
+ },
12078
+ labelStyle: {
12079
+ labelColor: "black",
12080
+ labelOffset: 45,
12081
+ leftLabelMargin: "70",
12082
+ topLabelMargin: "-40",
12083
+ ...(_l = value == null ? void 0 : value.style) == null ? void 0 : _l.labelStyle
12084
+ },
12085
+ legendStyle: {
12086
+ legend: {
12087
+ lineHeight: "0.9em",
12088
+ color: "black",
12089
+ fontSize: "10px",
12090
+ fontFamily: "arial",
12091
+ padding: "10px 10px",
12092
+ float: "left",
12093
+ border: "1px solid rgba(255, 255, 255, 0.3)",
12094
+ borderRadius: " 8px",
12095
+ margin: "5px 5px",
12096
+ ...(_n2 = (_m = value == null ? void 0 : value.style) == null ? void 0 : _m.legendStyle) == null ? void 0 : _n2.legend
12097
+ },
12098
+ legendTitle: {
12099
+ fontWeight: 500,
12100
+ marginBottom: "5px",
12101
+ fontFamily: "roboto",
12102
+ fontSize: "10px",
12103
+ ...(_p = (_o = value == null ? void 0 : value.style) == null ? void 0 : _o.legendStyle) == null ? void 0 : _p.legendTitle
12104
+ }
12105
+ },
12106
+ pieStyle: {
12107
+ colorRange: ["#3f51b5", "rgba(200,0,31,0.9)", "rgba(25,200,205,0.6)"],
12108
+ outerRadius: 120,
12109
+ innerRadius: 60,
12110
+ cornerRadius: 2,
12111
+ padAngle: 6e-3,
12112
+ ...(_q = value == null ? void 0 : value.style) == null ? void 0 : _q.pieStyle
12113
+ }
12071
12114
  }
12072
- }
12073
- }
12074
- return target;
12075
- };
12076
- return _extends$v.apply(this, arguments);
12077
- }
12078
- function LegendShape(_ref) {
12079
- var _ref$shape = _ref.shape, shape = _ref$shape === void 0 ? ShapeRect : _ref$shape, width = _ref.width, height = _ref.height, margin = _ref.margin, label = _ref.label, item = _ref.item, itemIndex = _ref.itemIndex, fill = _ref.fill, size = _ref.size, shapeStyle = _ref.shapeStyle;
12080
- return /* @__PURE__ */ React__default.createElement("div", {
12081
- className: "visx-legend-shape",
12082
- style: {
12083
- display: "flex",
12084
- width: size ? size(_extends$v({}, label)) : width,
12085
- height: size ? size(_extends$v({}, label)) : height,
12086
- margin
12087
- }
12088
- }, renderShape({
12089
- shape,
12090
- item,
12091
- itemIndex,
12092
- label,
12093
- width,
12094
- height,
12095
- fill,
12096
- shapeStyle
12097
- }));
12098
- }
12099
- LegendShape.propTypes = {
12100
- itemIndex: _pt.number.isRequired,
12101
- margin: _pt.oneOfType([_pt.string, _pt.number]),
12102
- width: _pt.oneOfType([_pt.string, _pt.number]),
12103
- height: _pt.oneOfType([_pt.string, _pt.number])
12104
- };
12105
- function valueOrIdentity(_2) {
12106
- if (_2 && typeof _2 === "object" && "value" in _2 && typeof _2.value !== "undefined")
12107
- return _2.value;
12108
- return _2;
12109
- }
12110
- function valueOrIdentityString(_2) {
12111
- return String(valueOrIdentity(_2));
12112
- }
12113
- function labelTransformFactory(_ref) {
12114
- var scale = _ref.scale, labelFormat = _ref.labelFormat;
12115
- return function(d2, i2) {
12116
- return {
12117
- datum: d2,
12118
- index: i2,
12119
- text: "" + labelFormat(d2, i2),
12120
- value: scale(d2)
12121
- };
12122
- };
12123
- }
12124
- var _excluded$k = ["className", "style", "scale", "shape", "domain", "fill", "size", "labelFormat", "labelTransform", "shapeWidth", "shapeHeight", "shapeMargin", "shapeStyle", "labelAlign", "labelFlex", "labelMargin", "itemMargin", "direction", "itemDirection", "legendLabelProps", "children"];
12125
- function _extends$u() {
12126
- _extends$u = Object.assign ? Object.assign.bind() : function(target) {
12127
- for (var i2 = 1; i2 < arguments.length; i2++) {
12128
- var source = arguments[i2];
12129
- for (var key in source) {
12130
- if (Object.prototype.hasOwnProperty.call(source, key)) {
12131
- target[key] = source[key];
12115
+ };
12116
+ case "LineGraph":
12117
+ return {
12118
+ main: {
12119
+ data: ((_r = value == null ? void 0 : value.main) == null ? void 0 : _r.data) || [Product1],
12120
+ header: "Line Graph Dynamic",
12121
+ bottomLabel: "Name of Employe",
12122
+ leftLabel: "Value",
12123
+ gridHidden: true,
12124
+ numHidden: false,
12125
+ tooltipDataKey: ["MAMA New Project", "Second", "Third"],
12126
+ axisLeft: true,
12127
+ axisBottom: true,
12128
+ hideLeftAxisLine: false,
12129
+ hideBottomAxisLine: false,
12130
+ ...value == null ? void 0 : value.main,
12131
+ legend: {
12132
+ labelColor: "green",
12133
+ legendTitle: "Our Assests",
12134
+ direction: "row",
12135
+ align: "right",
12136
+ colorRectWidth: 20,
12137
+ ...(_s = value == null ? void 0 : value.main) == null ? void 0 : _s.legend
12138
+ }
12139
+ },
12140
+ style: {
12141
+ containerStyle: {
12142
+ background: "white",
12143
+ width: "90%",
12144
+ height: "300",
12145
+ borderRadius: "20px",
12146
+ padding: "10px 0 2px 0",
12147
+ ...(_t2 = value == null ? void 0 : value.style) == null ? void 0 : _t2.containerStyle
12148
+ },
12149
+ headerStyle: {
12150
+ fontWeight: 500,
12151
+ textAlign: "left",
12152
+ fontFamily: "inherit",
12153
+ marginBottom: "20px",
12154
+ padding: "15px 0 1px 20px",
12155
+ width: "100%",
12156
+ fontSize: "18px",
12157
+ ...(_u = value == null ? void 0 : value.style) == null ? void 0 : _u.headerStyle
12158
+ },
12159
+ labelStyle: {
12160
+ labelColor: "black",
12161
+ bottomLabelOffset: 20,
12162
+ leftLabelOffset: 50,
12163
+ leftLabelMargin: 80,
12164
+ ...(_v = value == null ? void 0 : value.style) == null ? void 0 : _v.labelStyle
12165
+ },
12166
+ lineStyle: {
12167
+ colorRange: ["#3f51b5", "rgba(200,0,31,0.9)", "rgba(25,200,205,0.6)"],
12168
+ lineAreaColor: "none",
12169
+ lineAreaOpacity: 0.2,
12170
+ ...(_w = value == null ? void 0 : value.style) == null ? void 0 : _w.lineStyle
12171
+ }
12132
12172
  }
12133
- }
12134
- }
12135
- return target;
12136
- };
12137
- return _extends$u.apply(this, arguments);
12138
- }
12139
- function _objectWithoutPropertiesLoose$k(source, excluded) {
12140
- if (source == null)
12141
- return {};
12142
- var target = {};
12143
- var sourceKeys = Object.keys(source);
12144
- var key, i2;
12145
- for (i2 = 0; i2 < sourceKeys.length; i2++) {
12146
- key = sourceKeys[i2];
12147
- if (excluded.indexOf(key) >= 0)
12148
- continue;
12149
- target[key] = source[key];
12173
+ };
12174
+ case "HorizontalBarGraph":
12175
+ return {
12176
+ main: {
12177
+ data: ((_x = value == null ? void 0 : value.main) == null ? void 0 : _x.data) || [{ y: "Anant Sharma", x: 60 }, { y: "Pankaj Chauhan", x: 60 }, { y: "satendra Raghav", x: 150 }, { y: "Vivek Pahadi", x: 80 }, { y: "Siddarth verma", x: 100 }],
12178
+ header: " ",
12179
+ bottomLabel: "Name of Employe",
12180
+ leftLabel: "Value",
12181
+ axisLeft: true,
12182
+ axisBottom: true,
12183
+ hideBottomTicks: false,
12184
+ hideLeftTicks: ((_y = value == null ? void 0 : value.main) == null ? void 0 : _y.data) ? true : false,
12185
+ hideLeftAxisLine: ((_z = value == null ? void 0 : value.main) == null ? void 0 : _z.data) ? true : false,
12186
+ hideBottomAxisLine: false,
12187
+ bottomAxisWidth: "10px",
12188
+ ...value.main
12189
+ },
12190
+ style: {
12191
+ containerStyle: {
12192
+ background: "white",
12193
+ width: "90%",
12194
+ height: "300",
12195
+ borderRadius: "20px",
12196
+ padding: "10px 0 2px 0",
12197
+ ...(_A = value == null ? void 0 : value.style) == null ? void 0 : _A.containerStyle
12198
+ },
12199
+ headerStyle: {
12200
+ fontWeight: 500,
12201
+ textAlign: "left",
12202
+ fontFamily: "inherit",
12203
+ marginBottom: "20px",
12204
+ padding: "15px 0 1px 20px",
12205
+ width: "100%",
12206
+ fontSize: "18px",
12207
+ ...(_B = value == null ? void 0 : value.style) == null ? void 0 : _B.headerStyle
12208
+ },
12209
+ tooltipStyle: {
12210
+ padding: "6px",
12211
+ borderRadius: "2px",
12212
+ ...(_C = value == null ? void 0 : value.style) == null ? void 0 : _C.tooltipStyle
12213
+ },
12214
+ labelStyle: {
12215
+ margin: { top: 10, left: 110, right: 40, bottom: 40 },
12216
+ tickLabelColor: "#6c5efb",
12217
+ leftLabelOffset: 140,
12218
+ bottomLabelOffset: 14,
12219
+ tickFontSize: "10px",
12220
+ tickColor: "#6c5efb",
12221
+ rightAxisWidth: "0.3px",
12222
+ fontSize: "10px",
12223
+ ...(_D = value == null ? void 0 : value.style) == null ? void 0 : _D.labelStyle
12224
+ },
12225
+ barStyle: {
12226
+ color: "#6c5efb",
12227
+ ...(_E = value == null ? void 0 : value.style) == null ? void 0 : _E.barStyle
12228
+ }
12229
+ }
12230
+ };
12150
12231
  }
12151
- return target;
12152
- }
12153
- var defaultStyle = {
12154
- display: "flex"
12155
- };
12156
- function Legend$1(_ref) {
12157
- var className = _ref.className, _ref$style = _ref.style, style2 = _ref$style === void 0 ? defaultStyle : _ref$style, scale = _ref.scale, shape = _ref.shape, inputDomain = _ref.domain, _ref$fill = _ref.fill, fill = _ref$fill === void 0 ? valueOrIdentityString : _ref$fill, _ref$size = _ref.size, size = _ref$size === void 0 ? valueOrIdentityString : _ref$size, _ref$labelFormat = _ref.labelFormat, labelFormat = _ref$labelFormat === void 0 ? valueOrIdentity : _ref$labelFormat, _ref$labelTransform = _ref.labelTransform, labelTransform = _ref$labelTransform === void 0 ? labelTransformFactory : _ref$labelTransform, _ref$shapeWidth = _ref.shapeWidth, shapeWidth = _ref$shapeWidth === void 0 ? 15 : _ref$shapeWidth, _ref$shapeHeight = _ref.shapeHeight, shapeHeight = _ref$shapeHeight === void 0 ? 15 : _ref$shapeHeight, _ref$shapeMargin = _ref.shapeMargin, shapeMargin = _ref$shapeMargin === void 0 ? "2px 4px 2px 0" : _ref$shapeMargin, shapeStyle = _ref.shapeStyle, _ref$labelAlign = _ref.labelAlign, labelAlign = _ref$labelAlign === void 0 ? "left" : _ref$labelAlign, _ref$labelFlex = _ref.labelFlex, labelFlex = _ref$labelFlex === void 0 ? "1" : _ref$labelFlex, _ref$labelMargin = _ref.labelMargin, labelMargin = _ref$labelMargin === void 0 ? "0 4px" : _ref$labelMargin, _ref$itemMargin = _ref.itemMargin, itemMargin = _ref$itemMargin === void 0 ? "0" : _ref$itemMargin, _ref$direction = _ref.direction, direction = _ref$direction === void 0 ? "column" : _ref$direction, _ref$itemDirection = _ref.itemDirection, itemDirection = _ref$itemDirection === void 0 ? "row" : _ref$itemDirection, legendLabelProps = _ref.legendLabelProps, children2 = _ref.children, legendItemProps = _objectWithoutPropertiesLoose$k(_ref, _excluded$k);
12158
- var domain2 = inputDomain || ("domain" in scale ? scale.domain() : []);
12159
- var labelFormatter = labelTransform({
12160
- scale,
12161
- labelFormat
12162
- });
12163
- var labels = domain2.map(labelFormatter);
12164
- if (children2)
12165
- return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, children2(labels));
12166
- return /* @__PURE__ */ React__default.createElement("div", {
12167
- className: cx("visx-legend", className),
12168
- style: _extends$u({}, style2, {
12169
- flexDirection: direction
12170
- })
12171
- }, labels.map(function(label, i2) {
12172
- return /* @__PURE__ */ React__default.createElement(LegendItem, _extends$u({
12173
- key: "legend-" + label.text + "-" + i2,
12174
- margin: itemMargin,
12175
- flexDirection: itemDirection
12176
- }, legendItemProps), /* @__PURE__ */ React__default.createElement(LegendShape, {
12177
- shape,
12178
- height: shapeHeight,
12179
- width: shapeWidth,
12180
- margin: shapeMargin,
12181
- item: domain2[i2],
12182
- itemIndex: i2,
12183
- label,
12184
- fill,
12185
- size,
12186
- shapeStyle
12187
- }), /* @__PURE__ */ React__default.createElement(LegendLabel, _extends$u({
12188
- label: label.text,
12189
- flex: labelFlex,
12190
- margin: labelMargin,
12191
- align: labelAlign
12192
- }, legendLabelProps)));
12193
- }));
12194
- }
12195
- Legend$1.propTypes = {
12196
- children: _pt.func,
12197
- className: _pt.string,
12198
- domain: _pt.array,
12199
- shapeWidth: _pt.oneOfType([_pt.string, _pt.number]),
12200
- shapeHeight: _pt.oneOfType([_pt.string, _pt.number]),
12201
- shapeMargin: _pt.oneOfType([_pt.string, _pt.number]),
12202
- labelAlign: _pt.string,
12203
- labelFlex: _pt.oneOfType([_pt.string, _pt.number]),
12204
- labelMargin: _pt.oneOfType([_pt.string, _pt.number]),
12205
- itemMargin: _pt.oneOfType([_pt.string, _pt.number]),
12206
- fill: _pt.func,
12207
- size: _pt.func,
12208
- shapeStyle: _pt.func
12209
12232
  };
12210
- function Ordinal(props) {
12211
- return /* @__PURE__ */ React__default.createElement(Legend$1, props);
12212
- }
12213
- function Legend({
12233
+ const BarGraph = ({
12214
12234
  value
12215
- }) {
12216
- var _a2, _b2, _c2, _d, _e2, _f, _g, _h, _i, _j, _k;
12217
- const legendGlyphSize = ((_b2 = (_a2 = value == null ? void 0 : value.main) == null ? void 0 : _a2.legend) == null ? void 0 : _b2.colorRectWidth) || 15;
12218
- const ordinalColorScale = createOrdinalScale$1({
12219
- domain: (_c2 = value == null ? void 0 : value.main) == null ? void 0 : _c2.tooltipDataKey,
12220
- range: (_e2 = (_d = value == null ? void 0 : value.style) == null ? void 0 : _d.pieStyle) == null ? void 0 : _e2.colorRange
12235
+ }) => {
12236
+ var _a2, _b2, _c2, _d;
12237
+ const barData = finalDataProvider("BarGraph", value);
12238
+ let GraphRender = /* @__PURE__ */ jsx(ParentSize$1, {
12239
+ children: (parent) => {
12240
+ var _a3, _b3, _c3, _d2, _e2, _f, _g, _h, _i, _j, _k, _l, _m, _n2;
12241
+ return /* @__PURE__ */ jsx(DrawBarGraph, {
12242
+ width: parent.width || 400,
12243
+ height: ((_b3 = (_a3 = barData == null ? void 0 : barData.style) == null ? void 0 : _a3.containerStyle) == null ? void 0 : _b3.height) | 400,
12244
+ margin: {
12245
+ top: ((_e2 = (_d2 = (_c3 = barData == null ? void 0 : barData.style) == null ? void 0 : _c3.labelStyle) == null ? void 0 : _d2.margin) == null ? void 0 : _e2.top) || 10,
12246
+ right: ((_h = (_g = (_f = barData == null ? void 0 : barData.style) == null ? void 0 : _f.labelStyle) == null ? void 0 : _g.margin) == null ? void 0 : _h.right) || 10,
12247
+ bottom: ((_k = (_j = (_i = barData == null ? void 0 : barData.style) == null ? void 0 : _i.labelStyle) == null ? void 0 : _j.margin) == null ? void 0 : _k.bottom) || 20,
12248
+ left: ((_n2 = (_m = (_l = barData == null ? void 0 : barData.style) == null ? void 0 : _l.labelStyle) == null ? void 0 : _m.margin) == null ? void 0 : _n2.left) || 60
12249
+ },
12250
+ value: barData
12251
+ });
12252
+ }
12221
12253
  });
12222
12254
  return /* @__PURE__ */ jsxs("div", {
12223
- className: "legend",
12224
- style: (_g = (_f = value == null ? void 0 : value.style) == null ? void 0 : _f.legendStyle) == null ? void 0 : _g.legend,
12225
- children: [/* @__PURE__ */ jsx("div", {
12226
- className: "title",
12227
- style: (_i = (_h = value == null ? void 0 : value.style) == null ? void 0 : _h.legendStyle) == null ? void 0 : _i.legendTitle,
12228
- children: (_k = (_j = value == null ? void 0 : value.main) == null ? void 0 : _j.legend) == null ? void 0 : _k.legendTitle
12229
- }), /* @__PURE__ */ jsx(Ordinal, {
12230
- scale: ordinalColorScale,
12231
- labelFormat: (label) => `${label.toUpperCase()}`,
12232
- children: (labels) => {
12233
- var _a3, _b3;
12234
- return /* @__PURE__ */ jsx("div", {
12235
- style: {
12236
- display: "flex",
12237
- flexDirection: ((_b3 = (_a3 = value == null ? void 0 : value.main) == null ? void 0 : _a3.legend) == null ? void 0 : _b3.direction) || "row"
12238
- },
12239
- children: labels.map((label, i2) => {
12240
- var _a4, _b4;
12241
- return /* @__PURE__ */ jsxs(LegendItem, {
12242
- margin: "0 5px",
12243
- onClick: (events) => {
12244
- if (events)
12245
- alert(`clicked: ${JSON.stringify(label)}`);
12246
- },
12247
- children: [/* @__PURE__ */ jsx("svg", {
12248
- width: legendGlyphSize,
12249
- height: legendGlyphSize,
12250
- children: /* @__PURE__ */ jsx("rect", {
12251
- fill: label.value,
12252
- width: legendGlyphSize,
12253
- height: legendGlyphSize
12254
- })
12255
- }), /* @__PURE__ */ jsx(LegendLabel, {
12256
- align: `${((_b4 = (_a4 = value == null ? void 0 : value.main) == null ? void 0 : _a4.legend) == null ? void 0 : _b4.align) || "left"}`,
12257
- margin: "0 0 0 4px",
12258
- children: label.text
12259
- })]
12260
- }, `legend-quantile-${i2}`);
12261
- })
12262
- });
12263
- }
12264
- })]
12255
+ style: (_a2 = barData == null ? void 0 : barData.style) == null ? void 0 : _a2.containerStyle,
12256
+ children: [((_b2 = barData == null ? void 0 : barData.main) == null ? void 0 : _b2.header) && /* @__PURE__ */ jsx("div", {
12257
+ style: {
12258
+ fontWeight: 500,
12259
+ textAlign: "left",
12260
+ fontFamily: "inherit",
12261
+ marginBottom: "20px",
12262
+ padding: "15px 0 1px 20px",
12263
+ fontSize: "18px",
12264
+ color: "#121926",
12265
+ ...(_c2 = barData == null ? void 0 : barData.style) == null ? void 0 : _c2.headerStyle
12266
+ },
12267
+ children: (_d = barData == null ? void 0 : barData.main) == null ? void 0 : _d.header
12268
+ }), GraphRender]
12265
12269
  });
12266
- }
12270
+ };
12267
12271
  const DrawPieGraph = ({
12268
12272
  value,
12269
12273
  parentWidth,