TooltipModel.js 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. var echarts = require("../../echarts");
  2. var _default = echarts.extendComponentModel({
  3. type: 'tooltip',
  4. dependencies: ['axisPointer'],
  5. defaultOption: {
  6. zlevel: 0,
  7. z: 8,
  8. show: true,
  9. // tooltip主体内容
  10. showContent: true,
  11. // 'trigger' only works on coordinate system.
  12. // 'item' | 'axis' | 'none'
  13. trigger: 'item',
  14. // 'click' | 'mousemove' | 'none'
  15. triggerOn: 'mousemove|click',
  16. alwaysShowContent: false,
  17. displayMode: 'single',
  18. // 'single' | 'multipleByCoordSys'
  19. // 位置 {Array} | {Function}
  20. // position: null
  21. // Consider triggered from axisPointer handle, verticalAlign should be 'middle'
  22. // align: null,
  23. // verticalAlign: null,
  24. // 是否约束 content 在 viewRect 中。默认 false 是为了兼容以前版本。
  25. confine: false,
  26. // 内容格式器:{string}(Template) ¦ {Function}
  27. // formatter: null
  28. showDelay: 0,
  29. // 隐藏延迟,单位ms
  30. hideDelay: 100,
  31. // 动画变换时间,单位s
  32. transitionDuration: 0.4,
  33. enterable: false,
  34. // 提示背景颜色,默认为透明度为0.7的黑色
  35. backgroundColor: 'rgba(50,50,50,0.7)',
  36. // 提示边框颜色
  37. borderColor: '#333',
  38. // 提示边框圆角,单位px,默认为4
  39. borderRadius: 4,
  40. // 提示边框线宽,单位px,默认为0(无边框)
  41. borderWidth: 0,
  42. // 提示内边距,单位px,默认各方向内边距为5,
  43. // 接受数组分别设定上右下左边距,同css
  44. padding: 5,
  45. // Extra css text
  46. extraCssText: '',
  47. // 坐标轴指示器,坐标轴触发有效
  48. axisPointer: {
  49. // 默认为直线
  50. // 可选为:'line' | 'shadow' | 'cross'
  51. type: 'line',
  52. // type 为 line 的时候有效,指定 tooltip line 所在的轴,可选
  53. // 可选 'x' | 'y' | 'angle' | 'radius' | 'auto'
  54. // 默认 'auto',会选择类型为 cateogry 的轴,对于双数值轴,笛卡尔坐标系会默认选择 x 轴
  55. // 极坐标系会默认选择 angle 轴
  56. axis: 'auto',
  57. animation: 'auto',
  58. animationDurationUpdate: 200,
  59. animationEasingUpdate: 'exponentialOut',
  60. crossStyle: {
  61. color: '#999',
  62. width: 1,
  63. type: 'dashed',
  64. // TODO formatter
  65. textStyle: {} // lineStyle and shadowStyle should not be specified here,
  66. // otherwise it will always override those styles on option.axisPointer.
  67. }
  68. },
  69. textStyle: {
  70. color: '#fff',
  71. fontSize: 14
  72. }
  73. }
  74. });
  75. module.exports = _default;