@datarailsshared/dr_renderer 1.5.194 → 1.5.199

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.194",
3
+ "version": "1.5.199",
4
4
  "description": "DataRails charts and tables renderer",
5
5
  "keywords": [
6
6
  "datarails",
@@ -18,6 +18,7 @@
18
18
  "test": "jest --coverage",
19
19
  "build:types": "npx tsc --build --verbose",
20
20
  "build:types:clean": "npx tsc --build --clean",
21
+ "build": "npm run build:types:clean && npm run build:types",
21
22
  "watch": "npm run watch:types",
22
23
  "watch:types": "npx tsc --build --watch"
23
24
  },
@@ -1,6 +1,7 @@
1
1
  const _ = require('lodash');
2
2
  const { DrChartTooltip } = require("../dr_chart_tooltip");
3
3
  const helpers = require("../dr-renderer-helpers");
4
+ const DataFormatter = require("../dataformatter");
4
5
 
5
6
  /**
6
7
  * @typedef {Object} DrGaugeChartInstance
@@ -81,30 +82,10 @@ function DrGaugeChart(pivotData, opts, isDynamicGoal) {
81
82
  return DrGaugeChart.highchartsRenderer.ptCreateElementAndDraw(this.configChart(), opts);
82
83
  };
83
84
 
84
- this.formatValue = function (data_type, number_format, value, widget_values_format) {
85
- return DrGaugeChart.highchartsRenderer.formatValue(data_type, number_format, value, widget_values_format);
86
- };
87
-
88
85
  this.getDefaultValueForChart = function (type, existing_options) {
89
86
  return DrGaugeChart.highchartsRenderer.getDefaultValueForChart(type, existing_options);
90
87
  };
91
88
 
92
- this.ptCreateBasicLineSeries = function (pivotData, colors, onlyNumbers, isUniqueVals, additionOptions, opts, chartOptions) {
93
- return DrGaugeChart.highchartsRenderer.ptCreateBasicLineSeries(
94
- pivotData,
95
- colors,
96
- onlyNumbers,
97
- isUniqueVals,
98
- additionOptions,
99
- opts,
100
- chartOptions
101
- );
102
- };
103
-
104
- this.getSingleValueAgg = function (opts, aggfunc, base) {
105
- return DrGaugeChart.highchartsRenderer.getSingleValueAgg(opts, aggfunc, base);
106
- };
107
-
108
89
  this.isLeftQuarter = function (value, max = this.max, min = this.min) {
109
90
  return (value - min) < (max - min) / 2;
110
91
  };
@@ -139,7 +120,7 @@ function DrGaugeChart(pivotData, opts, isDynamicGoal) {
139
120
  };
140
121
 
141
122
  this.formatValue = function (value, format = this.format) {
142
- return helpers.isNumber(value) ? DrGaugeChart.highchartsRenderer.formatValue("n", format, value).value : value;
123
+ return helpers.isNumber(value) ? DataFormatter.formatValue("n", format, value).value : value;
143
124
  };
144
125
 
145
126
  this.toPercent = function (value) {
@@ -702,7 +683,7 @@ DrGaugeChart.createTicks = function (plotBands, options, format) {
702
683
  // Snap ticks that are nearly equal to goal (floating-point drift from
703
684
  // percentage-to-absolute scaling) and format identically to the exact goal value
704
685
  if (helpers.isNumber(goal) && format) {
705
- const fmt = (v) => DrGaugeChart.highchartsRenderer.formatValue("n", format, v).value;
686
+ const fmt = (v) => DataFormatter.formatValue("n", format, v).value;
706
687
  const formattedGoal = fmt(goal);
707
688
  const epsilon = Math.abs(goal) * 1e-10 || 1e-10;
708
689
  for (let i = 0; i < ticks.length; i++) {
@@ -1873,7 +1873,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
1873
1873
  }
1874
1874
 
1875
1875
  highchartsRenderer.getVariantSeries = function (series, delta_column_options, pivotData, colors) {
1876
- const varianceColor = delta_column_options.color || colors[7] || highchartsRenderer.variance_color || Highcharts.getOptions().colors[7];
1876
+ const varianceColor = delta_column_options.color || (colors && colors[7]) || highchartsRenderer.variance_color || Highcharts.getOptions().colors[7];
1877
1877
  series.name = delta_column_options.name.replace('_', '');
1878
1878
  series.initialName = series.name;
1879
1879
  series.color = varianceColor;