@datarailsshared/dr_renderer 1.5.114 → 1.5.116

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.5.114",
3
+ "version": "1.5.116",
4
4
  "description": "DataRails charts and tables renderer",
5
5
  "keywords": [
6
6
  "datarails",
@@ -3265,7 +3265,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
3265
3265
  highchartsRenderer.ptRenderStackedPercentColumn = function (pivotData, opts, _drilldownFunc, chartType) {
3266
3266
  var chartOptions = {};
3267
3267
  var rowAttrs = pivotData.rowAttrs;
3268
- var additionOptions = opts.chartOptions ? opts.chartOptions : highchartsRenderer.getDefaultValueForChart('column-chart-stacked-percent');
3268
+ var additionOptions = opts.chartOptions ? opts.chartOptions : highchartsRenderer.getDefaultValueForChart(optionsBuilders.CHART_TYPES.COLUMN_CHART_STACKED_PERCENT);
3269
3269
 
3270
3270
  chartOptions.chart = {
3271
3271
  type: 'column',
@@ -3331,6 +3331,12 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
3331
3331
  }
3332
3332
  };
3333
3333
  chartOptions = highchartsRenderer.prepareAxisX(chartOptions, additionOptions, pivotData.getColKeys());
3334
+ if (lodash.get(opts, 'paletteOptions.widgetPalette', null)) {
3335
+ const mc_palette = lodash.find(lodash.get(opts.paletteOptions, 'monochromePalettes', []), { selected: true });
3336
+ chartOptions.colors = mc_palette ? mc_palette.colors : opts.paletteOptions.widgetPalette;
3337
+ } else if (lodash.get(opts, 'paletteOptions.dashboardPalette.colors', null)) {
3338
+ chartOptions.colors = opts.paletteOptions.dashboardPalette.colors;
3339
+ }
3334
3340
 
3335
3341
  chartOptions.series = highchartsRenderer.ptCreateColumnSeries(pivotData, chartOptions.colors, null, true, true, additionOptions, opts, chartOptions, chartType);
3336
3342
 
@@ -3563,7 +3569,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
3563
3569
  highchartsRenderer.ptRenderStackedPercentBar = function (pivotData, opts) {
3564
3570
  var chartOptions = {};
3565
3571
  var rowAttrs = pivotData.rowAttrs;
3566
- var additionOptions = opts.chartOptions ? opts.chartOptions : highchartsRenderer.getDefaultValueForChart('bar-chart-stacked-percent');
3572
+ var additionOptions = opts.chartOptions ? opts.chartOptions : highchartsRenderer.getDefaultValueForChart(optionsBuilders.CHART_TYPES.BAR_CHART_STACKED_PERCENT);
3567
3573
 
3568
3574
  const labelStyle = lodash.merge(
3569
3575
  LABEL_DEFAULT_OPTIONS.style,
@@ -3634,6 +3640,12 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
3634
3640
  },
3635
3641
  };
3636
3642
  chartOptions = highchartsRenderer.prepareAxisX(chartOptions, additionOptions, pivotData.getColKeys());
3643
+ if (lodash.get(opts, 'paletteOptions.widgetPalette', null)) {
3644
+ const mc_palette = lodash.find(lodash.get(opts.paletteOptions, 'monochromePalettes', []), { selected: true });
3645
+ chartOptions.colors = mc_palette ? mc_palette.colors : opts.paletteOptions.widgetPalette;
3646
+ } else if (lodash.get(opts, 'paletteOptions.dashboardPalette.colors', null)) {
3647
+ chartOptions.colors = opts.paletteOptions.dashboardPalette.colors;
3648
+ }
3637
3649
  chartOptions.series = highchartsRenderer.ptCreateBasicLineSeries(pivotData, null, null, null, additionOptions, opts, chartOptions);
3638
3650
 
3639
3651
  // Sanitize series data for 100% stacking (convert negative values to 0)
@@ -6315,7 +6327,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
6315
6327
  axisTooltipTitle: 'Drag one or more fields to create the Polygons edges.',
6316
6328
  legendTooltipTitle: 'Adding a field in this section will display data points in your chart for each item in that field.',
6317
6329
  },
6318
- 'column-chart': {
6330
+ [optionsBuilders.CHART_TYPES.COLUMN_CHART]: {
6319
6331
  name: 'Column chart',
6320
6332
  label: 'Column',
6321
6333
  title: 'Compare two or more data series in different categories.',
@@ -6327,9 +6339,9 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
6327
6339
  axisTooltipDescription: 'To create a drill-down within this category, drag another field below the first field.',
6328
6340
  legendTooltipTitle: 'Each field in the data series will appear as a separate column in the chart.',
6329
6341
  },
6330
- 'column-chart-stacked': {
6342
+ [optionsBuilders.CHART_TYPES.COLUMN_CHART_STACKED]: {
6331
6343
  name: 'Stacked column chart',
6332
- label: 'Stacked Column',
6344
+ label: 'Stacked column',
6333
6345
  title: 'Useful for explaining part-to-whole comparisons over time, or across categories.',
6334
6346
  description: 'For example, comparison over time of expenses divided into subcategories. The chart describes both total expenses over time and the relation between the different sub-categories.',
6335
6347
  axisName: 'X - Axis',
@@ -6338,18 +6350,18 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
6338
6350
  axisTooltipTitle: 'Drag one or more fields here to create your x-axis. Each item within the field will appear as a different column.',
6339
6351
  legendTooltipTitle: 'Each field item will appear as a different segment within the column.',
6340
6352
  },
6341
- 'column-chart-stacked-percent': {
6353
+ [optionsBuilders.CHART_TYPES.COLUMN_CHART_STACKED_PERCENT]: {
6342
6354
  name: '100% Stacked column chart',
6343
- label: '100% Stacked Column',
6344
- title: 'Shows the percentage contribution of each segment within a category.',
6345
- description: 'Each bar represents 100%, with segments showing their percentage share. Ideal for comparing proportions across categories.',
6355
+ label: '100% Stacked column',
6356
+ title: 'Explains the percentage contribution of each value to a total across categories',
6357
+ description: 'For example, showing each department’s share of total expenses per month.',
6346
6358
  axisName: 'X - Axis',
6347
6359
  legendName: 'Data series',
6348
6360
  startedMessage: 'To get started, drag one field to the x-axis section, and one field to the value section. Best practice: we recommend adding one field to the data series section too.',
6349
6361
  axisTooltipTitle: 'Drag one or more fields here to create your x-axis. Each item within the field will appear as a different column.',
6350
6362
  legendTooltipTitle: 'Each field item will appear as a different segment within the column.',
6351
6363
  },
6352
- 'bar-chart': {
6364
+ [optionsBuilders.CHART_TYPES.BAR_CHART]: {
6353
6365
  name: 'Bar chart',
6354
6366
  label: 'Bar',
6355
6367
  title: 'Compare one or more data series across a given category.',
@@ -6360,9 +6372,9 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
6360
6372
  axisTooltipTitle: 'Drag one or more fields here to create your y-axis.',
6361
6373
  legendTooltipTitle: 'Each field item will appear as a different segment within the bar.',
6362
6374
  },
6363
- 'bar-chart-stacked': {
6375
+ [optionsBuilders.CHART_TYPES.BAR_CHART_STACKED]: {
6364
6376
  name: 'Stacked bar chart',
6365
- label: 'Stacked Bar',
6377
+ label: 'Stacked bar',
6366
6378
  title: 'Good for explaining part-to-whole comparisons across a given category.',
6367
6379
  description: 'For example, compare between sales-rep contributions to the total Revenue in different regions.',
6368
6380
  axisName: 'Y - Axis',
@@ -6371,11 +6383,11 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
6371
6383
  axisTooltipTitle: 'Drag one or more fields here to create your y-axis.',
6372
6384
  legendTooltipTitle: 'Each field item will appear as a different segment within the bar.',
6373
6385
  },
6374
- 'bar-chart-stacked-percent': {
6386
+ [optionsBuilders.CHART_TYPES.BAR_CHART_STACKED_PERCENT]: {
6375
6387
  name: '100% Stacked bar chart',
6376
- label: '100% Stacked Bar',
6377
- title: 'Shows the percentage contribution of each segment within a category.',
6378
- description: 'Each bar represents 100%, with segments showing their percentage share. Ideal for comparing proportions across categories.',
6388
+ label: '100% Stacked bar',
6389
+ title: 'Explains the percentage contribution of each value to a total across categories',
6390
+ description: 'For example, showing each department’s share of total expenses per month.',
6379
6391
  axisName: 'Y - Axis',
6380
6392
  legendName: 'Data series',
6381
6393
  startedMessage: 'To get started, drag one field to the y-axis section, and one field to the value section. Best practice: add one field to the Categories section too.',
@@ -6733,9 +6745,9 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
6733
6745
  ]
6734
6746
  },
6735
6747
  {
6736
- type: 'column-chart-stacked-percent',
6737
- hidden: true,
6738
- name: highchartsRenderer.chartsTypesInfo['column-chart-stacked-percent'].name,
6748
+ type: optionsBuilders.CHART_TYPES.COLUMN_CHART_STACKED_PERCENT,
6749
+ hidden: !environment.enableStackedPercentCharts,
6750
+ name: highchartsRenderer.chartsTypesInfo[optionsBuilders.CHART_TYPES.COLUMN_CHART_STACKED_PERCENT].name,
6739
6751
  class: 'google-visualization-charteditor-thumbs-columnchart-stacked-percent',
6740
6752
  render: highchartsRenderer.ptRenderStackedPercentColumn,
6741
6753
  suboptions: [
@@ -6801,9 +6813,9 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
6801
6813
  ]
6802
6814
  },
6803
6815
  {
6804
- type: 'bar-chart-stacked-percent',
6805
- hidden: true,
6806
- name: highchartsRenderer.chartsTypesInfo['bar-chart-stacked-percent'].name,
6816
+ type: optionsBuilders.CHART_TYPES.BAR_CHART_STACKED_PERCENT,
6817
+ hidden: !environment.enableStackedPercentCharts,
6818
+ name: highchartsRenderer.chartsTypesInfo[optionsBuilders.CHART_TYPES.BAR_CHART_STACKED_PERCENT].name,
6807
6819
  class: 'google-visualization-charteditor-thumbs-barchart-stacked-percent',
6808
6820
  render: highchartsRenderer.ptRenderStackedPercentBar,
6809
6821
  suboptions: [
package/src/index.d.ts CHANGED
@@ -38,6 +38,7 @@ declare namespace DrRenderFactory {
38
38
  disable_animation?: boolean;
39
39
  fiscal_year_starts_from?: number;
40
40
  fiscal_year_back?: boolean;
41
+ enableStackedPercentCharts?: boolean;
41
42
  }
42
43
 
43
44
  interface Factory {