@datarailsshared/dr_renderer 1.4.40 → 1.4.44

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datarailsshared/dr_renderer",
3
- "version": "1.4.40",
3
+ "version": "1.4.44",
4
4
  "description": "DataRails charts and tables renderer",
5
5
  "keywords": [
6
6
  "datarails",
@@ -141,9 +141,11 @@ function DrGaugeChart(pivotData, opts, isDynamicGoal) {
141
141
  const goalValue = isGoal
142
142
  ? `<span style="font-size: 1.125em; color: ${options.gauge.colors.goal};">${formattedValue}</span>`
143
143
  : `<span style="color: ${options.label.font_color};">${formattedValue}</span>`;
144
+
145
+ const goalTitleText = DrGaugeChart.getGoalTitleText(options);
144
146
  const goalTitle =
145
- isGoal && options.label.show_goal_name && options.goal.title
146
- ? `<span style="font-size: 0.75em; color: ${options.gauge.colors.goal};">${options.goal.title}</span>`
147
+ isGoal && options.label.show_goal_name && goalTitleText
148
+ ? `<span style="font-size: 0.75em; color: ${options.gauge.colors.goal};">${goalTitleText}</span>`
147
149
  : "";
148
150
  const percentage = options.label.show_percentage_in_segments
149
151
  ? `<span style="font-size: 0.75em; color: ${options.gauge.colors.meta}; font-weight: 400;">(${this.toPercent(
@@ -376,7 +378,7 @@ function DrGaugeChart(pivotData, opts, isDynamicGoal) {
376
378
  // goal tooltip if lebels are hidden
377
379
  if (tick.pos === options.goal.value && !options.label.show) {
378
380
  drTooltip.add(
379
- `${options.label.show_goal_name ? options.goal.title || "" : ""
381
+ `${options.label.show_goal_name ? DrGaugeChart.getGoalTitleText(options) || "" : ""
380
382
  }<span style="font-weight: 600">${this.formatValue(options.goal.value)}</span>`,
381
383
  chart.goalIcon.element,
382
384
  {
@@ -470,7 +472,7 @@ function DrGaugeChart(pivotData, opts, isDynamicGoal) {
470
472
  this.setGoal = function (pivotData, opts) {
471
473
  if (isDynamicGoal) {
472
474
  this.options.goal = {
473
- title: this.options.goal.title,
475
+ title: DrGaugeChart.getGoalTitleText(this.options),
474
476
  value: DrGaugeChart.getValue(pivotData, opts, true, true),
475
477
  };
476
478
  }
@@ -703,6 +705,12 @@ DrGaugeChart.getValue = function (pivotData, opts, isDynamicGoal = false, isForG
703
705
  return aggregator.value();
704
706
  };
705
707
 
708
+ DrGaugeChart.getGoalTitleText = function(options) {
709
+ return DrGaugeChart.dynamicGoalFeatureEnabled()
710
+ ? _.get(options, 'label.goal_name') || options.goal.title
711
+ : options.goal.title;
712
+ }
713
+
706
714
  DrGaugeChart.dynamicGoalFeatureEnabled = function() {
707
715
  return DrGaugeChart.highchartsRenderer.hasFeature(helpers.FEATURES.ENABLE_GAUGE_DYNAMIC_GOAL);
708
716
  }
@@ -6110,6 +6110,12 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
6110
6110
 
6111
6111
  if (option) {
6112
6112
  const type = option.category_type;
6113
+
6114
+ const existingOptionValue = lodash.get(existing_options, type);
6115
+ if (!option.elements) {
6116
+ return existingOptionValue || option.default_value;
6117
+ }
6118
+
6113
6119
  lodash.forEach(option.elements, function (elem) {
6114
6120
  if (existing_options && lodash.has(existing_options, type + '.' + elem.value_name)) {
6115
6121
  valToReturn[elem.value_name] = lodash.get(existing_options, type + '.' + elem.value_name);
@@ -6969,12 +6975,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
6969
6975
  {
6970
6976
  element_type: 'devider',
6971
6977
  },
6972
- {
6973
- element_type: 'checkbox',
6974
- element_label: 'Goal name',
6975
- value_name: 'show_goal_name',
6976
- default_value: true,
6977
- },
6978
6978
  {
6979
6979
  element_type: 'checkbox',
6980
6980
  element_label: 'Value % out of Goal',
@@ -6987,6 +6987,20 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
6987
6987
  value_name: 'show_percentage_in_segments',
6988
6988
  default_value: false,
6989
6989
  },
6990
+ {
6991
+ element_type: 'checkbox',
6992
+ element_label: 'Show Goal label',
6993
+ value_name: 'show_goal_name',
6994
+ default_value: true,
6995
+ },
6996
+ {
6997
+ element_type: 'input',
6998
+ show_in_one_row: true,
6999
+ element_label: 'Goal name',
7000
+ value_name: 'goal_name',
7001
+ default_value: 'Goal',
7002
+ hidden: !highchartsRenderer.hasFeature(FEATURES.ENABLE_GAUGE_DYNAMIC_GOAL),
7003
+ },
6990
7004
  ]
6991
7005
  },
6992
7006
  'label_with_percentage': {
@@ -7594,6 +7608,40 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
7594
7608
  ],
7595
7609
  default_value: ''
7596
7610
  }]
7611
+ },
7612
+ gauge_goal: {
7613
+ is_hidden: true,
7614
+ categorys_class: 'google-visualization-charteditor-mini-more',
7615
+ category_label: 'Gauge goal',
7616
+ category_type: 'goal',
7617
+ elements: [
7618
+ {
7619
+ element_type: 'input',
7620
+ value_name: 'title',
7621
+ element_label: 'Goal title',
7622
+ default_value: 'Goal',
7623
+ },
7624
+ {
7625
+ element_type: 'input',
7626
+ value_name: 'value',
7627
+ element_label: 'Goal value',
7628
+ default_value: 1000000,
7629
+ },
7630
+ ],
7631
+ },
7632
+ gauge_segments: {
7633
+ is_hidden: true,
7634
+ categorys_class: 'google-visualization-charteditor-mini-more',
7635
+ category_label: 'Gauge segments',
7636
+ category_type: 'segments',
7637
+ default_value: GAUGE_OPTIONS_DEFAULT.segments,
7638
+ },
7639
+ gauge_is_absolute: {
7640
+ is_hidden: true,
7641
+ categorys_class: 'google-visualization-charteditor-mini-more',
7642
+ category_label: 'Gauge is absolute value',
7643
+ category_type: 'isAbsoluteValue',
7644
+ default_value: false,
7597
7645
  }
7598
7646
  };
7599
7647
 
@@ -7827,12 +7875,15 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
7827
7875
  axisTooltipTitle: ' Best practice: we recommend no more than one segment.',
7828
7876
  legendTooltipTitle: 'To create a drill-down within this category, drag a field here.',
7829
7877
  },
7878
+
7830
7879
  [highchartsRenderer.CHART_TYPES.GAUGE_CHART_ENHANCED]: {
7831
7880
  name: 'Gauge chart',
7832
7881
  categoryLabel: 'Gauge',
7833
7882
  displayLabelInEditor: highchartsRenderer.hasFeature(FEATURES.ENABLE_GAUGE_DYNAMIC_GOAL),
7834
7883
  label: highchartsRenderer.hasFeature(FEATURES.ENABLE_GAUGE_DYNAMIC_GOAL) ? 'Static goal' : 'Gauge',
7835
- title: 'Measures progress toward a goal or a KPI.',
7884
+ title: highchartsRenderer.hasFeature(FEATURES.ENABLE_GAUGE_DYNAMIC_GOAL)
7885
+ ? 'Measures progress toward a goal or a KPI.'
7886
+ : 'Track actual performance against targets from your budget or forecast files.',
7836
7887
  axisName: 'X-Axis',
7837
7888
  legendName: 'Data Series',
7838
7889
  startedMessage: 'To get started, drag one field to the value section. Best practice: Drag one field to the filter section, and filter as required.',
@@ -7844,17 +7895,16 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
7844
7895
  },
7845
7896
  },
7846
7897
 
7847
- // TODO: update descriptions if required
7848
7898
  [highchartsRenderer.CHART_TYPES.GAUGE_CHART_DYNAMIC_GOAL]: {
7849
7899
  name: 'Gauge chart with dynamic goal',
7850
7900
  categoryLabel: 'Gauge',
7851
7901
  displayLabelInEditor: true,
7852
7902
  iconType: highchartsRenderer.CHART_TYPES.GAUGE_CHART_ENHANCED,
7853
7903
  label: 'Dynamic goal',
7854
- title: 'Measures progress toward a goal or a KPI.',
7904
+ title: 'Track actual performance against manually set targets.',
7855
7905
  axisName: 'Goal',
7856
7906
  legendName: 'Data Series',
7857
- startedMessage: 'To get started, drag one field to the value section. Best practice: Drag one field to the filter section, and filter as required.',
7907
+ startedMessage: 'To get started, drag a field to the Value section and set the Goal with a field that references your planning files (e.g., Scenario or Version Name)',
7858
7908
  categoryContainerSettings: {
7859
7909
  multiple: false,
7860
7910
  singleFieldReplacement: true,
@@ -8294,6 +8344,9 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
8294
8344
  highchartsRenderer.suboptions["subtitle"],
8295
8345
  highchartsRenderer.suboptions["table_options_gauge"],
8296
8346
  highchartsRenderer.suboptions["table_design_options"],
8347
+ highchartsRenderer.suboptions["gauge_goal"],
8348
+ highchartsRenderer.suboptions["gauge_segments"],
8349
+ highchartsRenderer.suboptions["gauge_is_absolute"],
8297
8350
  ]
8298
8351
  },
8299
8352
  {
@@ -8307,6 +8360,9 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
8307
8360
  highchartsRenderer.suboptions["subtitle"],
8308
8361
  highchartsRenderer.suboptions["table_options_gauge"],
8309
8362
  highchartsRenderer.suboptions["table_design_options"],
8363
+ highchartsRenderer.suboptions["gauge_goal"],
8364
+ highchartsRenderer.suboptions["gauge_segments"],
8365
+ highchartsRenderer.suboptions["gauge_is_absolute"],
8310
8366
  ],
8311
8367
  hidden: !highchartsRenderer.hasFeature(FEATURES.ENABLE_GAUGE_DYNAMIC_GOAL),
8312
8368
  },