constant.js 1.5 KB

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