CandlestickSeries.js 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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 zrUtil = require("zrender/lib/core/util");
  20. var SeriesModel = require("../../model/Series");
  21. var _whiskerBoxCommon = require("../helper/whiskerBoxCommon");
  22. var seriesModelMixin = _whiskerBoxCommon.seriesModelMixin;
  23. /*
  24. * Licensed to the Apache Software Foundation (ASF) under one
  25. * or more contributor license agreements. See the NOTICE file
  26. * distributed with this work for additional information
  27. * regarding copyright ownership. The ASF licenses this file
  28. * to you under the Apache License, Version 2.0 (the
  29. * "License"); you may not use this file except in compliance
  30. * with the License. You may obtain a copy of the License at
  31. *
  32. * http://www.apache.org/licenses/LICENSE-2.0
  33. *
  34. * Unless required by applicable law or agreed to in writing,
  35. * software distributed under the License is distributed on an
  36. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  37. * KIND, either express or implied. See the License for the
  38. * specific language governing permissions and limitations
  39. * under the License.
  40. */
  41. var CandlestickSeries = SeriesModel.extend({
  42. type: 'series.candlestick',
  43. dependencies: ['xAxis', 'yAxis', 'grid'],
  44. /**
  45. * @readOnly
  46. */
  47. defaultValueDimensions: [{
  48. name: 'open',
  49. defaultTooltip: true
  50. }, {
  51. name: 'close',
  52. defaultTooltip: true
  53. }, {
  54. name: 'lowest',
  55. defaultTooltip: true
  56. }, {
  57. name: 'highest',
  58. defaultTooltip: true
  59. }],
  60. /**
  61. * @type {Array.<string>}
  62. * @readOnly
  63. */
  64. dimensions: null,
  65. /**
  66. * @override
  67. */
  68. defaultOption: {
  69. zlevel: 0,
  70. z: 2,
  71. coordinateSystem: 'cartesian2d',
  72. legendHoverLink: true,
  73. hoverAnimation: true,
  74. // xAxisIndex: 0,
  75. // yAxisIndex: 0,
  76. layout: null,
  77. // 'horizontal' or 'vertical'
  78. clip: true,
  79. itemStyle: {
  80. color: '#c23531',
  81. // 阳线 positive
  82. color0: '#314656',
  83. // 阴线 negative '#c23531', '#314656'
  84. borderWidth: 1,
  85. // FIXME
  86. // ec2中使用的是lineStyle.color 和 lineStyle.color0
  87. borderColor: '#c23531',
  88. borderColor0: '#314656'
  89. },
  90. emphasis: {
  91. itemStyle: {
  92. borderWidth: 2
  93. }
  94. },
  95. barMaxWidth: null,
  96. barMinWidth: null,
  97. barWidth: null,
  98. large: true,
  99. largeThreshold: 600,
  100. progressive: 3e3,
  101. progressiveThreshold: 1e4,
  102. progressiveChunkMode: 'mod',
  103. animationUpdate: false,
  104. animationEasing: 'linear',
  105. animationDuration: 300
  106. },
  107. /**
  108. * Get dimension for shadow in dataZoom
  109. * @return {string} dimension name
  110. */
  111. getShadowDim: function () {
  112. return 'open';
  113. },
  114. brushSelector: function (dataIndex, data, selectors) {
  115. var itemLayout = data.getItemLayout(dataIndex);
  116. return itemLayout && selectors.rect(itemLayout.brushRect);
  117. }
  118. });
  119. zrUtil.mixin(CandlestickSeries, seriesModelMixin, true);
  120. var _default = CandlestickSeries;
  121. module.exports = _default;