TooltipModel.js 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. /*
  2. * Licensed to the Apache Software Foundation (ASF) under one
  3. * or more contributor license agreements. See the NOTICE file
  4. * distributed with this work for additional information
  5. * regarding copyright ownership. The ASF licenses this file
  6. * to you under the Apache License, Version 2.0 (the
  7. * "License"); you may not use this file except in compliance
  8. * with the License. You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing,
  13. * software distributed under the License is distributed on an
  14. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  15. * KIND, either express or implied. See the License for the
  16. * specific language governing permissions and limitations
  17. * under the License.
  18. */
  19. var echarts = require("../../echarts");
  20. /*
  21. * Licensed to the Apache Software Foundation (ASF) under one
  22. * or more contributor license agreements. See the NOTICE file
  23. * distributed with this work for additional information
  24. * regarding copyright ownership. The ASF licenses this file
  25. * to you under the Apache License, Version 2.0 (the
  26. * "License"); you may not use this file except in compliance
  27. * with the License. You may obtain a copy of the License at
  28. *
  29. * http://www.apache.org/licenses/LICENSE-2.0
  30. *
  31. * Unless required by applicable law or agreed to in writing,
  32. * software distributed under the License is distributed on an
  33. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  34. * KIND, either express or implied. See the License for the
  35. * specific language governing permissions and limitations
  36. * under the License.
  37. */
  38. var _default = echarts.extendComponentModel({
  39. type: 'tooltip',
  40. dependencies: ['axisPointer'],
  41. defaultOption: {
  42. zlevel: 0,
  43. z: 60,
  44. show: true,
  45. // tooltip主体内容
  46. showContent: true,
  47. // 'trigger' only works on coordinate system.
  48. // 'item' | 'axis' | 'none'
  49. trigger: 'item',
  50. // 'click' | 'mousemove' | 'none'
  51. triggerOn: 'mousemove|click',
  52. alwaysShowContent: false,
  53. displayMode: 'single',
  54. // 'single' | 'multipleByCoordSys'
  55. renderMode: 'auto',
  56. // 'auto' | 'html' | 'richText'
  57. // 'auto': use html by default, and use non-html if `document` is not defined
  58. // 'html': use html for tooltip
  59. // 'richText': use canvas, svg, and etc. for tooltip
  60. // 位置 {Array} | {Function}
  61. // position: null
  62. // Consider triggered from axisPointer handle, verticalAlign should be 'middle'
  63. // align: null,
  64. // verticalAlign: null,
  65. // 是否约束 content 在 viewRect 中。默认 false 是为了兼容以前版本。
  66. confine: false,
  67. // 内容格式器:{string}(Template) ¦ {Function}
  68. // formatter: null
  69. showDelay: 0,
  70. // 隐藏延迟,单位ms
  71. hideDelay: 100,
  72. // 动画变换时间,单位s
  73. transitionDuration: 0.4,
  74. enterable: false,
  75. // 提示背景颜色,默认为透明度为0.7的黑色
  76. backgroundColor: 'rgba(50,50,50,0.7)',
  77. // 提示边框颜色
  78. borderColor: '#333',
  79. // 提示边框圆角,单位px,默认为4
  80. borderRadius: 4,
  81. // 提示边框线宽,单位px,默认为0(无边框)
  82. borderWidth: 0,
  83. // 提示内边距,单位px,默认各方向内边距为5,
  84. // 接受数组分别设定上右下左边距,同css
  85. padding: 5,
  86. // Extra css text
  87. extraCssText: '',
  88. // 坐标轴指示器,坐标轴触发有效
  89. axisPointer: {
  90. // 默认为直线
  91. // 可选为:'line' | 'shadow' | 'cross'
  92. type: 'line',
  93. // type 为 line 的时候有效,指定 tooltip line 所在的轴,可选
  94. // 可选 'x' | 'y' | 'angle' | 'radius' | 'auto'
  95. // 默认 'auto',会选择类型为 category 的轴,对于双数值轴,笛卡尔坐标系会默认选择 x 轴
  96. // 极坐标系会默认选择 angle 轴
  97. axis: 'auto',
  98. animation: 'auto',
  99. animationDurationUpdate: 200,
  100. animationEasingUpdate: 'exponentialOut',
  101. crossStyle: {
  102. color: '#999',
  103. width: 1,
  104. type: 'dashed',
  105. // TODO formatter
  106. textStyle: {} // lineStyle and shadowStyle should not be specified here,
  107. // otherwise it will always override those styles on option.axisPointer.
  108. }
  109. },
  110. textStyle: {
  111. color: '#fff',
  112. fontSize: 14
  113. }
  114. }
  115. });
  116. module.exports = _default;