common.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /**
  2. * DevExtreme (viz/range_selector/common.js)
  3. * Version: 19.1.16
  4. * Build date: Tue Oct 18 2022
  5. *
  6. * Copyright (c) 2012 - 2022 Developer Express Inc. ALL RIGHTS RESERVED
  7. * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
  8. */
  9. "use strict";
  10. var _format = require("../axes/smart_formatter").smartFormatter;
  11. var isFunction = require("../../core/utils/type").isFunction;
  12. var HEIGHT_COMPACT_MODE = 24;
  13. var POINTER_SIZE = 4;
  14. var EMPTY_SLIDER_MARKER_TEXT = ". . .";
  15. var utils = {
  16. trackerSettings: {
  17. fill: "grey",
  18. stroke: "grey",
  19. opacity: 1e-4
  20. },
  21. animationSettings: {
  22. duration: 250
  23. }
  24. };
  25. var consts = {
  26. emptySliderMarkerText: EMPTY_SLIDER_MARKER_TEXT,
  27. pointerSize: POINTER_SIZE
  28. };
  29. var formatValue = function(value, formatOptions, tickIntervalsInfo, valueType, type, logarithmBase) {
  30. var formatObject = {
  31. value: value,
  32. valueText: _format(value, {
  33. labelOptions: formatOptions,
  34. ticks: tickIntervalsInfo ? tickIntervalsInfo.ticks : [],
  35. tickInterval: tickIntervalsInfo ? tickIntervalsInfo.tickInterval : void 0,
  36. dataType: valueType,
  37. type: type,
  38. logarithmBase: logarithmBase
  39. })
  40. };
  41. return String(isFunction(formatOptions.customizeText) ? formatOptions.customizeText.call(formatObject, formatObject) : formatObject.valueText)
  42. };
  43. exports.utils = utils;
  44. exports.consts = consts;
  45. exports.formatValue = formatValue;
  46. exports.HEIGHT_COMPACT_MODE = HEIGHT_COMPACT_MODE;