AxisModel.js 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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 ComponentModel = require("../../model/Component");
  21. var axisModelCreator = require("../axisModelCreator");
  22. var axisModelCommonMixin = require("../axisModelCommonMixin");
  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 AxisModel = ComponentModel.extend({
  42. type: 'singleAxis',
  43. layoutMode: 'box',
  44. /**
  45. * @type {module:echarts/coord/single/SingleAxis}
  46. */
  47. axis: null,
  48. /**
  49. * @type {module:echarts/coord/single/Single}
  50. */
  51. coordinateSystem: null,
  52. /**
  53. * @override
  54. */
  55. getCoordSysModel: function () {
  56. return this;
  57. }
  58. });
  59. var defaultOption = {
  60. left: '5%',
  61. top: '5%',
  62. right: '5%',
  63. bottom: '5%',
  64. type: 'value',
  65. position: 'bottom',
  66. orient: 'horizontal',
  67. axisLine: {
  68. show: true,
  69. lineStyle: {
  70. width: 1,
  71. type: 'solid'
  72. }
  73. },
  74. // Single coordinate system and single axis is the,
  75. // which is used as the parent tooltip model.
  76. // same model, so we set default tooltip show as true.
  77. tooltip: {
  78. show: true
  79. },
  80. axisTick: {
  81. show: true,
  82. length: 6,
  83. lineStyle: {
  84. width: 1
  85. }
  86. },
  87. axisLabel: {
  88. show: true,
  89. interval: 'auto'
  90. },
  91. splitLine: {
  92. show: true,
  93. lineStyle: {
  94. type: 'dashed',
  95. opacity: 0.2
  96. }
  97. }
  98. };
  99. function getAxisType(axisName, option) {
  100. return option.type || (option.data ? 'category' : 'value');
  101. }
  102. zrUtil.merge(AxisModel.prototype, axisModelCommonMixin);
  103. axisModelCreator('single', AxisModel, getAxisType, defaultOption);
  104. var _default = AxisModel;
  105. module.exports = _default;