constant.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.DEFAULT_OPTIONS = exports.DEFAULT_TOOLTIP_OPTIONS = exports.TREND_DOWN = exports.TREND_UP = exports.TREND_FIELD = exports.Y_FIELD = void 0;
  4. var plot_1 = require("../../core/plot");
  5. var utils_1 = require("../../utils");
  6. exports.Y_FIELD = '$$stock-range$$';
  7. exports.TREND_FIELD = 'trend';
  8. exports.TREND_UP = 'up';
  9. exports.TREND_DOWN = 'down';
  10. /** tooltip 配置 */
  11. exports.DEFAULT_TOOLTIP_OPTIONS = {
  12. showMarkers: false,
  13. showCrosshairs: true,
  14. shared: true,
  15. crosshairs: {
  16. type: 'xy',
  17. follow: true,
  18. text: function (type, defaultContent, items) {
  19. var textContent;
  20. if (type === 'x') {
  21. var item = items[0];
  22. textContent = item ? item.title : defaultContent;
  23. }
  24. else {
  25. textContent = defaultContent;
  26. }
  27. return {
  28. position: type === 'y' ? 'start' : 'end',
  29. content: textContent,
  30. style: {
  31. fill: '#dfdfdf',
  32. },
  33. };
  34. },
  35. // 自定义 crosshairs textBackground 样式
  36. textBackground: {
  37. padding: [2, 4],
  38. style: {
  39. fill: '#666',
  40. },
  41. },
  42. },
  43. };
  44. /**
  45. * 散点图 默认配置项
  46. */
  47. exports.DEFAULT_OPTIONS = (0, utils_1.deepAssign)({}, plot_1.Plot.getDefaultOptions(), {
  48. // 设置默认图表 tooltips
  49. tooltip: exports.DEFAULT_TOOLTIP_OPTIONS,
  50. interactions: [{ type: 'tooltip' }],
  51. legend: {
  52. position: 'top-left',
  53. },
  54. risingFill: '#ef5350',
  55. fallingFill: '#26a69a',
  56. });
  57. //# sourceMappingURL=constant.js.map