react-gauge-component
Advanced tools
Comparing version 1.1.34 to 1.1.35
@@ -289,4 +289,6 @@ "use strict"; | ||
gauge.arcData.current.forEach(function (subArcData) { | ||
return gradEl.append("stop") | ||
.attr("offset", "".concat(subArcData.limit, "%")) | ||
var _a, _b, _c, _d; | ||
var normalizedOffset = utils.normalize(subArcData === null || subArcData === void 0 ? void 0 : subArcData.limit, (_b = (_a = gauge === null || gauge === void 0 ? void 0 : gauge.props) === null || _a === void 0 ? void 0 : _a.minValue) !== null && _b !== void 0 ? _b : 0, (_d = (_c = gauge === null || gauge === void 0 ? void 0 : gauge.props) === null || _c === void 0 ? void 0 : _c.maxValue) !== null && _d !== void 0 ? _d : 100); | ||
gradEl.append("stop") | ||
.attr("offset", "".concat(normalizedOffset, "%")) | ||
.style("stop-color", subArcData.color) //end in red | ||
@@ -293,0 +295,0 @@ .style("stop-opacity", 1); |
@@ -103,4 +103,4 @@ "use strict"; | ||
var gaugeTypeHeightCorrection = (_a = {}, | ||
_a[GaugeComponentProps_1.GaugeType.Semicircle] = 50, | ||
_a[GaugeComponentProps_1.GaugeType.Radial] = 50, | ||
_a[GaugeComponentProps_1.GaugeType.Semicircle] = 45, | ||
_a[GaugeComponentProps_1.GaugeType.Radial] = 45, | ||
_a[GaugeComponentProps_1.GaugeType.Grafana] = 50, | ||
@@ -107,0 +107,0 @@ _a); |
@@ -8,2 +8,3 @@ import { Gauge } from '../types/Gauge'; | ||
export declare const floatingNumber: (value: number, maxDigits?: number) => number; | ||
export declare function normalize(value: number, min: number, max: number): number; | ||
export declare const degToRad: (degrees: number) => number; | ||
@@ -10,0 +11,0 @@ export declare const getCurrentGaugePercentageByValue: (value: number, gauge: GaugeComponentProps) => number; |
@@ -14,3 +14,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.camelCaseToKebabCase = exports.getCurrentGaugeValueByPercentage = exports.getCurrentGaugePercentageByValue = exports.degToRad = exports.floatingNumber = exports.percentToRad = exports.mergeObjects = exports.isEmptyObject = exports.calculatePercentage = void 0; | ||
exports.camelCaseToKebabCase = exports.getCurrentGaugeValueByPercentage = exports.getCurrentGaugePercentageByValue = exports.degToRad = exports.normalize = exports.floatingNumber = exports.percentToRad = exports.mergeObjects = exports.isEmptyObject = exports.calculatePercentage = void 0; | ||
var calculatePercentage = function (minValue, maxValue, value) { | ||
@@ -61,2 +61,7 @@ if (value < minValue) { | ||
exports.floatingNumber = floatingNumber; | ||
// Function to normalize a value between a new min and max | ||
function normalize(value, min, max) { | ||
return ((value - min) / (max - min)) * 100; | ||
} | ||
exports.normalize = normalize; | ||
var degToRad = function (degrees) { | ||
@@ -63,0 +68,0 @@ return degrees * (Math.PI / 180); |
@@ -30,3 +30,3 @@ "use strict"; | ||
_a[GaugeType.Grafana] = { top: 0.12, bottom: 0.00, left: 0.07, right: 0.07 }, | ||
_a[GaugeType.Semicircle] = { top: 0.08, bottom: 0.00, left: 0.07, right: 0.07 }, | ||
_a[GaugeType.Semicircle] = { top: 0.08, bottom: 0.00, left: 0.08, right: 0.08 }, | ||
_a[GaugeType.Radial] = { top: 0.07, bottom: 0.00, left: 0.07, right: 0.07 }, | ||
@@ -33,0 +33,0 @@ _a); |
{ | ||
"name": "react-gauge-component", | ||
"version": "1.1.34", | ||
"version": "1.1.35", | ||
"main": "dist/lib/index.js", | ||
@@ -5,0 +5,0 @@ "module": "dist/lib/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
109438
1934