logitude-dashboard-library 1.4.18 → 1.4.20

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.
@@ -432,7 +432,8 @@ $dark-grey: #717585;
432
432
 
433
433
  .db-fc-container {
434
434
  width: 100%;
435
- height: 100%;
435
+ height: calc(100% - 5px);
436
+ padding-top: 12px;
436
437
  }
437
438
 
438
439
  .db-fc-container>*:first-child {
@@ -2,4 +2,5 @@ import { SeriesMeasure } from "../../../../types/SeriesMeasure";
2
2
  import { ReactWidgetPM } from "../../../../types/widget";
3
3
  import { ChartInfo } from "./FusionChartObjectHelper";
4
4
  export declare function getCategoriesBasedDataSource(chartInfo: ChartInfo, seriesMeasures: SeriesMeasure[], widget: ReactWidgetPM): any;
5
+ export declare function getStackedDataSource(chartInfo: ChartInfo, seriesMeasures: SeriesMeasure[], widget: ReactWidgetPM): any;
5
6
  export declare function getSimpleDataSource(chartInfo: ChartInfo, seriesMeasures: SeriesMeasure[], widget: ReactWidgetPM): any;
@@ -1,2 +1,2 @@
1
1
  import { ReactWidgetPM } from "../../../../types/widget";
2
- export declare function buildToolTip(widget: ReactWidgetPM, value: any, seriesName: string): string;
2
+ export declare function buildToolTip(widget: ReactWidgetPM, value: any, seriesName: string, label: any): string;
package/dist/index.js CHANGED
@@ -408,8 +408,8 @@ function getSeriesPositionColor(position) {
408
408
  }
409
409
  }
410
410
 
411
- function buildToolTip(widget, value, seriesName) {
412
- return "\n <div style=\"min-width: 108px;\">\n <div style=\"display: flex;align-items: center;margin-bottom: 6px;\">\n <span style=\"margin: 0; height: 10px; width: 10px; background-color: #A4A4A4; border-radius: 50%; display: inline-block;\"></span>\n <p style=\" margin: 0; margin-left: 4px;font-family: 'Manrope'; font-style: normal;font-weight: 400; font-size: 11px; line-height: 100%; color: #323232; flex: none; order: 1;flex-grow: 0;\">$label</p>\n </div>\n <hr style=\"margin: 0;border-top: 1px solid #F0F0F0;\">\n <div style=\"display: flex;align-items: center;margin:0;margin-top: 6px;\">\n <p style=\"margin: 0;font-family: 'Manrope';font-style: normal;font-weight: 400; font-size: 11px;line-height: 100%;color: #A4A4A4;flex: none;order: 0;flex-grow: 0;\"> " + getMeasureType(seriesName) + "</p>\n <p style=\"margin: 0;margin-left: 6px;font-family: 'Manrope';font-style: normal;font-weight: 500;font-size: 11px;line-height: 100%; color: #323232;flex: none; order: 1;flex-grow: 0;\">" + getTooltipValue(value) + "</p>\n " + getTooltipPercentage(widget) + " </div>\n </div>\n ";
411
+ function buildToolTip(widget, value, seriesName, label) {
412
+ return "\n <div style=\"min-width: 108px;\">\n <div style=\"display: flex;align-items: center;margin-bottom: 6px;\">\n <span style=\"margin: 0; height: 10px; width: 10px; background-color: #A4A4A4; border-radius: 50%; display: inline-block;\"></span>\n <p style=\" margin: 0; margin-left: 4px;font-family: 'Manrope'; font-style: normal;font-weight: 400; font-size: 11px; line-height: 100%; color: #323232; flex: none; order: 1;flex-grow: 0;\"> " + getTooltiplabel(label) + "</p>\n </div>\n <hr style=\"margin: 0;border-top: 1px solid #F0F0F0;\">\n <div style=\"display: flex;align-items: center;margin:0;margin-top: 6px;\">\n <p style=\"margin: 0;font-family: 'Manrope';font-style: normal;font-weight: 400; font-size: 11px;line-height: 100%;color: #A4A4A4;flex: none;order: 0;flex-grow: 0;\"> " + getMeasureType(seriesName) + "</p>\n <p style=\"margin: 0;margin-left: 6px;font-family: 'Manrope';font-style: normal;font-weight: 500;font-size: 11px;line-height: 100%; color: #323232;flex: none; order: 1;flex-grow: 0;\">" + getTooltipValue(value) + "</p>\n " + getTooltipPercentage(widget) + " </div>\n </div>\n ";
413
413
  }
414
414
 
415
415
  function getTooltipPercentage(widget) {
@@ -417,6 +417,11 @@ function getTooltipPercentage(widget) {
417
417
  return "\n <p style=\"margin: 0;margin-left: 2px;font-family: 'Manrope';font-style: normal;font-weight: 500;font-size: 11px;line-height: 100%; color: #A4A4A4;flex: none; order: 1;flex-grow: 0;\">($percentValue)</p>\n ";
418
418
  }
419
419
 
420
+ function getTooltiplabel(value) {
421
+ if (value) return value;
422
+ return '$label';
423
+ }
424
+
420
425
  function getTooltipValue(value) {
421
426
  if (value) return value;
422
427
  return '$dataValue';
@@ -436,6 +441,15 @@ function getCategoriesBasedDataSource(chartInfo, seriesMeasures, widget) {
436
441
  dataset: buildDataSet(seriesMeasures, widget)
437
442
  };
438
443
  }
444
+ function getStackedDataSource(chartInfo, seriesMeasures, widget) {
445
+ if (seriesMeasuresIsEmpty(seriesMeasures)) return null;
446
+ handelNullLabels(seriesMeasures);
447
+ return {
448
+ chart: chartInfo,
449
+ categories: buildStackedCategories(seriesMeasures),
450
+ dataset: buildStackedDataSet(seriesMeasures, widget)
451
+ };
452
+ }
439
453
  function getSimpleDataSource(chartInfo, seriesMeasures, widget) {
440
454
  if (seriesMeasuresIsEmpty(seriesMeasures)) return null;
441
455
  handelNullLabels(seriesMeasures);
@@ -447,7 +461,7 @@ function getSimpleDataSource(chartInfo, seriesMeasures, widget) {
447
461
 
448
462
  function handelNullLabels(seriesMeasures) {
449
463
  seriesMeasures.forEach(function (element) {
450
- element.SeriesMeasureVulues.forEach(function (value) {
464
+ element.Values.forEach(function (value) {
451
465
  if (!value.Label || value.Label == '') value.Label = 'Not defined';
452
466
  });
453
467
  });
@@ -457,7 +471,7 @@ function seriesMeasuresIsEmpty(seriesMeasures) {
457
471
  if (!seriesMeasures || seriesMeasures.length == 0) return true;
458
472
  var hasValue = false;
459
473
  seriesMeasures.forEach(function (item) {
460
- if (item.SeriesMeasureVulues && item.SeriesMeasureVulues.length > 0) hasValue = true;
474
+ if (item.Values && item.Values.length > 0) hasValue = true;
461
475
  });
462
476
  return !hasValue;
463
477
  }
@@ -466,15 +480,15 @@ function buildDataSource(values, widget) {
466
480
  var data = [];
467
481
  if (!values || !values[0]) return data;
468
482
  var series = values[0];
469
- data = series.SeriesMeasureVulues.map(function (e, index) {
483
+ data = series.Values.map(function (e, index) {
470
484
  var item = {
471
485
  value: e.Value,
472
486
  label: getTrimedLabelText(e.Label),
473
487
  id: {
474
488
  GroupById: e.GroupById,
475
- MeasureFieldId: values[0].MeasureFieldId
489
+ MeasureFieldId: series.MeasureFieldId
476
490
  },
477
- tooltext: buildToolTip(widget, null, series.Name),
491
+ tooltext: buildToolTip(widget, null, series.Name, null),
478
492
  color: getSeriesPositionColor(index + 1)
479
493
  };
480
494
  return item;
@@ -491,14 +505,14 @@ function buildDataSet(seriesMeasures, widget) {
491
505
  var dataSet = [];
492
506
  var seriesPosition = 1;
493
507
  seriesMeasures.forEach(function (seriesMeasure) {
494
- var datas = seriesMeasure.SeriesMeasureVulues.map(function (e) {
508
+ var datas = seriesMeasure.Values.map(function (e) {
495
509
  return {
496
510
  value: e.Value,
497
511
  id: {
498
512
  GroupById: e.GroupById,
499
513
  MeasureFieldId: seriesMeasure.MeasureFieldId
500
514
  },
501
- tooltext: buildToolTip(widget, e.Value, seriesMeasure.Name)
515
+ tooltext: buildToolTip(widget, e.Value, seriesMeasure.Name, null)
502
516
  };
503
517
  });
504
518
  var color = getSeriesPositionColor(seriesPosition);
@@ -517,8 +531,54 @@ function buildDataSet(seriesMeasures, widget) {
517
531
  return dataSet;
518
532
  }
519
533
 
520
- function buildCategories(seriesMeasures, widget) {
521
- var categories = seriesMeasures[0].SeriesMeasureVulues.map(function (e) {
534
+ function buildStackedDataSet(seriesMeasures, widget) {
535
+ var dataSet = [];
536
+ var seriesPosition = 1;
537
+ var series = seriesMeasures[0];
538
+ var uniqueGroups = [];
539
+ series.Values.forEach(function (element) {
540
+ if (!uniqueGroups.find(function (x) {
541
+ return x.code == element.GroupByIdSec;
542
+ })) uniqueGroups.push({
543
+ code: element.GroupByIdSec,
544
+ label: element.LabelSec
545
+ });
546
+ });
547
+ uniqueGroups.forEach(function (group) {
548
+ var color = getSeriesPositionColor(seriesPosition);
549
+ dataSet.push({
550
+ seriesName: group.label,
551
+ color: color,
552
+ data: buildStackedGroupData(group, series, widget)
553
+ });
554
+ seriesPosition++;
555
+ });
556
+ return dataSet;
557
+ }
558
+
559
+ function buildStackedGroupData(secGroup, series, widget) {
560
+ var uniqueGroups = getUniqueGroupOrderdList(series);
561
+ var data = [];
562
+ uniqueGroups.forEach(function (group) {
563
+ var _series$Values$find;
564
+
565
+ data.push({
566
+ value: (_series$Values$find = series.Values.find(function (x) {
567
+ return x.GroupById == group.code && x.GroupByIdSec == secGroup.code;
568
+ })) === null || _series$Values$find === void 0 ? void 0 : _series$Values$find.Value,
569
+ id: {
570
+ GroupById: group.code,
571
+ MeasureFieldId: series.MeasureFieldId,
572
+ GroupByIdSec: secGroup.code
573
+ },
574
+ tooltext: buildToolTip(widget, null, series.Name, group.label + " - " + secGroup.label)
575
+ });
576
+ });
577
+ return data;
578
+ }
579
+
580
+ function buildCategories(seriesMeasures) {
581
+ var categories = seriesMeasures[0].Values.map(function (e) {
522
582
  return {
523
583
  label: e.Label
524
584
  };
@@ -530,12 +590,40 @@ function buildCategories(seriesMeasures, widget) {
530
590
  return result;
531
591
  }
532
592
 
593
+ function buildStackedCategories(seriesMeasures, widget) {
594
+ var uniqueGroups = getUniqueGroupOrderdList(seriesMeasures[0]);
595
+ var categories = uniqueGroups.map(function (e) {
596
+ return {
597
+ label: e.label
598
+ };
599
+ });
600
+ var result = [];
601
+ result.push({
602
+ category: categories
603
+ });
604
+ return result;
605
+ }
606
+
607
+ function getUniqueGroupOrderdList(series) {
608
+ var uniqueGroups = [];
609
+ series.Values.forEach(function (element) {
610
+ if (!uniqueGroups.find(function (x) {
611
+ return x.code == element.GroupById;
612
+ })) uniqueGroups.push({
613
+ code: element.GroupById,
614
+ label: element.Label
615
+ });
616
+ });
617
+ return uniqueGroups;
618
+ }
619
+
533
620
  var defautFontSize = "10";
534
621
  var defautFont = "Manrope";
535
622
  function BuildFusionChartObject(seriesMeasures, widget) {
536
623
  switch (widget === null || widget === void 0 ? void 0 : widget.TypeCode) {
537
624
  case 'bar':
538
- return getBarObject(seriesMeasures, widget);
625
+ if (!widget.SecondaryGroupById) return getBarObject(seriesMeasures, widget);
626
+ return getStackedBarObject(seriesMeasures, widget);
539
627
 
540
628
  case 'line':
541
629
  return getLineObject(seriesMeasures, widget);
@@ -573,6 +661,26 @@ function getBarObject(seriesMeasures, widget) {
573
661
  return chart;
574
662
  }
575
663
 
664
+ function getStackedBarObject(seriesMeasures, widget) {
665
+ var chart = getDefaultChartobject();
666
+ chart.type = "scrollstackedbar2d";
667
+ var chartInfo = getDefaultChartInfo();
668
+ chartInfo.scrollHeight = "5";
669
+ chartInfo.scrollWidth = "5";
670
+ chartInfo.scrollPadding = "8";
671
+ chartInfo.flatScrollBars = "1";
672
+ chartInfo.showPercentValues = "1";
673
+ chartInfo.showLegend = (seriesMeasures === null || seriesMeasures === void 0 ? void 0 : seriesMeasures.length) > 1 ? "1" : "0";
674
+ chartInfo.legendItemFont = defautFont;
675
+ chartInfo.legendItemFontSize = defautFontSize;
676
+ setLineDash(chartInfo);
677
+ chartInfo.chartTopMargin = "10";
678
+ chartInfo.chartBottomMargin = "10";
679
+ chartInfo.showLegend = "1";
680
+ chart.dataSource = getStackedDataSource(chartInfo, seriesMeasures, widget);
681
+ return chart;
682
+ }
683
+
576
684
  function getLineObject(seriesMeasures, widget) {
577
685
  var chart = getDefaultChartobject();
578
686
  chart.type = "scrollline2d";
@@ -740,7 +848,8 @@ var FusionChart = function FusionChart(props) {
740
848
  props.onSelectDataPoint({
741
849
  GroupById: dataObj.id.groupbyid,
742
850
  MeasureFieldId: dataObj.id.measurefieldid,
743
- Widget: widget.current
851
+ Widget: widget.current,
852
+ GroupByIdSec: dataObj.id.groupbyidsec
744
853
  });
745
854
  };
746
855
 
@@ -789,7 +898,7 @@ var FusionChart = function FusionChart(props) {
789
898
  };
790
899
 
791
900
  var WidgetCard = function WidgetCard(props, state) {
792
- var _widget$current2, _widget$current3, _widget$current4;
901
+ var _widget$current2, _widget$current3;
793
902
 
794
903
  var moreBtnToggle = React.useRef(null);
795
904
  var widget = React.useRef();
@@ -878,17 +987,14 @@ var WidgetCard = function WidgetCard(props, state) {
878
987
  }, React__default.createElement("div", {
879
988
  className: "dl-line"
880
989
  })), React__default.createElement("div", {
881
- className: "dl-dashboard-widget",
882
- style: {
883
- marginTop: ((_widget$current4 = widget.current) === null || _widget$current4 === void 0 ? void 0 : _widget$current4.TypeCode) == 'kpi' ? '0' : '10px'
884
- }
990
+ className: "dl-dashboard-widget"
885
991
  }, " ", GetChartComponent(), " "));
886
992
 
887
993
  function GetChartComponent() {
888
- var _widget$current5, _widget$current6;
994
+ var _widget$current4, _widget$current5;
889
995
 
890
- if (isLoading || !((_widget$current5 = widget.current) !== null && _widget$current5 !== void 0 && _widget$current5.TypeCode)) return null;
891
- if (((_widget$current6 = widget.current) === null || _widget$current6 === void 0 ? void 0 : _widget$current6.TypeCode) == "kpi") return React__default.createElement(CustomChart, {
996
+ if (isLoading || !((_widget$current4 = widget.current) !== null && _widget$current4 !== void 0 && _widget$current4.TypeCode)) return null;
997
+ if (((_widget$current5 = widget.current) === null || _widget$current5 === void 0 ? void 0 : _widget$current5.TypeCode) == "kpi") return React__default.createElement(CustomChart, {
892
998
  dataBinding: props.dataBinding,
893
999
  widget: widget.current,
894
1000
  widgetRef: props.widgetRef,