AxisModel.js 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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 PolarAxisModel = ComponentModel.extend({
  42. type: 'polarAxis',
  43. /**
  44. * @type {module:echarts/coord/polar/AngleAxis|module:echarts/coord/polar/RadiusAxis}
  45. */
  46. axis: null,
  47. /**
  48. * @override
  49. */
  50. getCoordSysModel: function () {
  51. return this.ecModel.queryComponents({
  52. mainType: 'polar',
  53. index: this.option.polarIndex,
  54. id: this.option.polarId
  55. })[0];
  56. }
  57. });
  58. zrUtil.merge(PolarAxisModel.prototype, axisModelCommonMixin);
  59. var polarAxisDefaultExtendedOption = {
  60. angle: {
  61. // polarIndex: 0,
  62. // polarId: '',
  63. startAngle: 90,
  64. clockwise: true,
  65. splitNumber: 12,
  66. axisLabel: {
  67. rotate: false
  68. }
  69. },
  70. radius: {
  71. // polarIndex: 0,
  72. // polarId: '',
  73. splitNumber: 5
  74. }
  75. };
  76. function getAxisType(axisDim, option) {
  77. // Default axis with data is category axis
  78. return option.type || (option.data ? 'category' : 'value');
  79. }
  80. axisModelCreator('angle', PolarAxisModel, getAxisType, polarAxisDefaultExtendedOption.angle);
  81. axisModelCreator('radius', PolarAxisModel, getAxisType, polarAxisDefaultExtendedOption.radius);