BaseBarSeries.js 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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 SeriesModel = require("../../model/Series");
  20. var createListFromArray = require("../helper/createListFromArray");
  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 _default = SeriesModel.extend({
  40. type: 'series.__base_bar__',
  41. getInitialData: function (option, ecModel) {
  42. return createListFromArray(this.getSource(), this, {
  43. useEncodeDefaulter: true
  44. });
  45. },
  46. getMarkerPosition: function (value) {
  47. var coordSys = this.coordinateSystem;
  48. if (coordSys) {
  49. // PENDING if clamp ?
  50. var pt = coordSys.dataToPoint(coordSys.clampData(value));
  51. var data = this.getData();
  52. var offset = data.getLayout('offset');
  53. var size = data.getLayout('size');
  54. var offsetIndex = coordSys.getBaseAxis().isHorizontal() ? 0 : 1;
  55. pt[offsetIndex] += offset + size / 2;
  56. return pt;
  57. }
  58. return [NaN, NaN];
  59. },
  60. defaultOption: {
  61. zlevel: 0,
  62. // 一级层叠
  63. z: 2,
  64. // 二级层叠
  65. coordinateSystem: 'cartesian2d',
  66. legendHoverLink: true,
  67. // stack: null
  68. // Cartesian coordinate system
  69. // xAxisIndex: 0,
  70. // yAxisIndex: 0,
  71. // 最小高度改为0
  72. barMinHeight: 0,
  73. // 最小角度为0,仅对极坐标系下的柱状图有效
  74. barMinAngle: 0,
  75. // cursor: null,
  76. large: false,
  77. largeThreshold: 400,
  78. progressive: 3e3,
  79. progressiveChunkMode: 'mod',
  80. // barMaxWidth: null,
  81. // In cartesian, the default value is 1. Otherwise null.
  82. // barMinWidth: null,
  83. // 默认自适应
  84. // barWidth: null,
  85. // 柱间距离,默认为柱形宽度的30%,可设固定值
  86. // barGap: '30%',
  87. // 类目间柱形距离,默认为类目间距的20%,可设固定值
  88. // barCategoryGap: '20%',
  89. // label: {
  90. // show: false
  91. // },
  92. itemStyle: {},
  93. emphasis: {}
  94. }
  95. });
  96. module.exports = _default;