GaugeSeries.js 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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 createListSimply = require("../helper/createListSimply");
  20. var SeriesModel = require("../../model/Series");
  21. /*
  22. * Licensed to the Apache Software Foundation (ASF) under one
  23. * or more contributor license agreements. See the NOTICE file
  24. * distributed with this work for additional information
  25. * regarding copyright ownership. The ASF licenses this file
  26. * to you under the Apache License, Version 2.0 (the
  27. * "License"); you may not use this file except in compliance
  28. * with the License. You may obtain a copy of the License at
  29. *
  30. * http://www.apache.org/licenses/LICENSE-2.0
  31. *
  32. * Unless required by applicable law or agreed to in writing,
  33. * software distributed under the License is distributed on an
  34. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  35. * KIND, either express or implied. See the License for the
  36. * specific language governing permissions and limitations
  37. * under the License.
  38. */
  39. var GaugeSeries = SeriesModel.extend({
  40. type: 'series.gauge',
  41. getInitialData: function (option, ecModel) {
  42. return createListSimply(this, ['value']);
  43. },
  44. defaultOption: {
  45. zlevel: 0,
  46. z: 2,
  47. // 默认全局居中
  48. center: ['50%', '50%'],
  49. legendHoverLink: true,
  50. radius: '75%',
  51. startAngle: 225,
  52. endAngle: -45,
  53. clockwise: true,
  54. // 最小值
  55. min: 0,
  56. // 最大值
  57. max: 100,
  58. // 分割段数,默认为10
  59. splitNumber: 10,
  60. // 坐标轴线
  61. axisLine: {
  62. // 默认显示,属性show控制显示与否
  63. show: true,
  64. lineStyle: {
  65. // 属性lineStyle控制线条样式
  66. color: [[0.2, '#91c7ae'], [0.8, '#63869e'], [1, '#c23531']],
  67. width: 30
  68. }
  69. },
  70. // 分隔线
  71. splitLine: {
  72. // 默认显示,属性show控制显示与否
  73. show: true,
  74. // 属性length控制线长
  75. length: 30,
  76. // 属性lineStyle(详见lineStyle)控制线条样式
  77. lineStyle: {
  78. color: '#eee',
  79. width: 2,
  80. type: 'solid'
  81. }
  82. },
  83. // 坐标轴小标记
  84. axisTick: {
  85. // 属性show控制显示与否,默认不显示
  86. show: true,
  87. // 每份split细分多少段
  88. splitNumber: 5,
  89. // 属性length控制线长
  90. length: 8,
  91. // 属性lineStyle控制线条样式
  92. lineStyle: {
  93. color: '#eee',
  94. width: 1,
  95. type: 'solid'
  96. }
  97. },
  98. axisLabel: {
  99. show: true,
  100. distance: 5,
  101. // formatter: null,
  102. color: 'auto'
  103. },
  104. pointer: {
  105. show: true,
  106. length: '80%',
  107. width: 8
  108. },
  109. itemStyle: {
  110. color: 'auto'
  111. },
  112. title: {
  113. show: true,
  114. // x, y,单位px
  115. offsetCenter: [0, '-40%'],
  116. // 其余属性默认使用全局文本样式,详见TEXTSTYLE
  117. color: '#333',
  118. fontSize: 15
  119. },
  120. detail: {
  121. show: true,
  122. backgroundColor: 'rgba(0,0,0,0)',
  123. borderWidth: 0,
  124. borderColor: '#ccc',
  125. width: 100,
  126. height: null,
  127. // self-adaption
  128. padding: [5, 10],
  129. // x, y,单位px
  130. offsetCenter: [0, '40%'],
  131. // formatter: null,
  132. // 其余属性默认使用全局文本样式,详见TEXTSTYLE
  133. color: 'auto',
  134. fontSize: 30
  135. }
  136. }
  137. });
  138. var _default = GaugeSeries;
  139. module.exports = _default;