stock_point.js 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /**
  2. * DevExtreme (viz/series/points/stock_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 extend = require("../../../core/utils/extend").extend;
  11. var isNumeric = require("../../../core/utils/type").isNumeric;
  12. var candlestickPoint = require("./candlestick_point");
  13. var _extend = extend;
  14. var _isNumeric = isNumeric;
  15. module.exports = _extend({}, candlestickPoint, {
  16. _getPoints: function() {
  17. var that = this;
  18. var createPoint = that._options.rotated ? function(x, y) {
  19. return [y, x]
  20. } : function(x, y) {
  21. return [x, y]
  22. };
  23. var openYExist = _isNumeric(that.openY);
  24. var closeYExist = _isNumeric(that.closeY);
  25. var x = that.x;
  26. var width = that.width;
  27. var points;
  28. points = [].concat(createPoint(x, that.highY));
  29. openYExist && (points = points.concat(createPoint(x, that.openY)));
  30. openYExist && (points = points.concat(createPoint(x - width / 2, that.openY)));
  31. openYExist && (points = points.concat(createPoint(x, that.openY)));
  32. closeYExist && (points = points.concat(createPoint(x, that.closeY)));
  33. closeYExist && (points = points.concat(createPoint(x + width / 2, that.closeY)));
  34. closeYExist && (points = points.concat(createPoint(x, that.closeY)));
  35. points = points.concat(createPoint(x, that.lowY));
  36. return points
  37. },
  38. _drawMarkerInGroup: function(group, attributes, renderer) {
  39. this.graphic = renderer.path(this._getPoints(), "line").attr({
  40. "stroke-linecap": "square"
  41. }).attr(attributes).data({
  42. "chart-data-point": this
  43. }).sharp().append(group)
  44. },
  45. _getMinTrackerWidth: function() {
  46. var width = 2 + this._styles.normal["stroke-width"];
  47. return width + width % 2
  48. }
  49. });