range_bar_point.js 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /**
  2. * DevExtreme (viz/series/points/range_bar_point.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 noop = require("../../../core/utils/common").noop;
  11. var extend = require("../../../core/utils/extend").extend;
  12. var barPoint = require("./bar_point");
  13. var rangeSymbolPointMethods = require("./range_symbol_point");
  14. var _extend = extend;
  15. module.exports = _extend({}, barPoint, {
  16. deleteLabel: rangeSymbolPointMethods.deleteLabel,
  17. _getFormatObject: rangeSymbolPointMethods._getFormatObject,
  18. clearVisibility: function() {
  19. var graphic = this.graphic;
  20. if (graphic && graphic.attr("visibility")) {
  21. graphic.attr({
  22. visibility: null
  23. })
  24. }
  25. },
  26. setInvisibility: function() {
  27. var graphic = this.graphic;
  28. if (graphic && "hidden" !== graphic.attr("visibility")) {
  29. graphic.attr({
  30. visibility: "hidden"
  31. })
  32. }
  33. this._topLabel.draw(false);
  34. this._bottomLabel.draw(false)
  35. },
  36. getTooltipParams: function(location) {
  37. var that = this;
  38. var edgeLocation = "edge" === location;
  39. var x;
  40. var y;
  41. if (that._options.rotated) {
  42. x = edgeLocation ? that.x + that.width : that.x + that.width / 2;
  43. y = that.y + that.height / 2
  44. } else {
  45. x = that.x + that.width / 2;
  46. y = edgeLocation ? that.y : that.y + that.height / 2
  47. }
  48. return {
  49. x: x,
  50. y: y,
  51. offset: 0
  52. }
  53. },
  54. _translate: function() {
  55. var that = this;
  56. var barMethods = barPoint;
  57. barMethods._translate.call(that);
  58. if (that._options.rotated) {
  59. that.width = that.width || 1
  60. } else {
  61. that.height = that.height || 1
  62. }
  63. },
  64. hasCoords: rangeSymbolPointMethods.hasCoords,
  65. _updateData: rangeSymbolPointMethods._updateData,
  66. _getLabelPosition: rangeSymbolPointMethods._getLabelPosition,
  67. _getLabelMinFormatObject: rangeSymbolPointMethods._getLabelMinFormatObject,
  68. _updateLabelData: rangeSymbolPointMethods._updateLabelData,
  69. _updateLabelOptions: rangeSymbolPointMethods._updateLabelOptions,
  70. getCrosshairData: rangeSymbolPointMethods.getCrosshairData,
  71. _createLabel: rangeSymbolPointMethods._createLabel,
  72. _checkOverlay: rangeSymbolPointMethods._checkOverlay,
  73. _checkLabelsOverlay: rangeSymbolPointMethods._checkLabelsOverlay,
  74. _getOverlayCorrections: rangeSymbolPointMethods._getOverlayCorrections,
  75. _drawLabel: rangeSymbolPointMethods._drawLabel,
  76. _getLabelCoords: rangeSymbolPointMethods._getLabelCoords,
  77. _getGraphicBBox: function(location) {
  78. var isTop = "top" === location;
  79. var bBox = barPoint._getGraphicBBox.call(this);
  80. if (!this._options.rotated) {
  81. bBox.y = isTop ? bBox.y : bBox.y + bBox.height;
  82. bBox.height = 0
  83. } else {
  84. bBox.x = isTop ? bBox.x + bBox.width : bBox.x;
  85. bBox.width = 0
  86. }
  87. return bBox
  88. },
  89. getLabel: rangeSymbolPointMethods.getLabel,
  90. getLabels: rangeSymbolPointMethods.getLabels,
  91. getBoundingRect: noop,
  92. getMinValue: rangeSymbolPointMethods.getMinValue,
  93. getMaxValue: rangeSymbolPointMethods.getMaxValue
  94. });