AxisModel.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. var zrUtil = require("zrender/lib/core/util");
  2. var ComponentModel = require("../../model/Component");
  3. var axisModelCreator = require("../axisModelCreator");
  4. var axisModelCommonMixin = require("../axisModelCommonMixin");
  5. var AxisModel = ComponentModel.extend({
  6. type: 'singleAxis',
  7. layoutMode: 'box',
  8. /**
  9. * @type {module:echarts/coord/single/SingleAxis}
  10. */
  11. axis: null,
  12. /**
  13. * @type {module:echarts/coord/single/Single}
  14. */
  15. coordinateSystem: null,
  16. /**
  17. * @override
  18. */
  19. getCoordSysModel: function () {
  20. return this;
  21. }
  22. });
  23. var defaultOption = {
  24. left: '5%',
  25. top: '5%',
  26. right: '5%',
  27. bottom: '5%',
  28. type: 'value',
  29. position: 'bottom',
  30. orient: 'horizontal',
  31. axisLine: {
  32. show: true,
  33. lineStyle: {
  34. width: 2,
  35. type: 'solid'
  36. }
  37. },
  38. // Single coordinate system and single axis is the,
  39. // which is used as the parent tooltip model.
  40. // same model, so we set default tooltip show as true.
  41. tooltip: {
  42. show: true
  43. },
  44. axisTick: {
  45. show: true,
  46. length: 6,
  47. lineStyle: {
  48. width: 2
  49. }
  50. },
  51. axisLabel: {
  52. show: true,
  53. interval: 'auto'
  54. },
  55. splitLine: {
  56. show: true,
  57. lineStyle: {
  58. type: 'dashed',
  59. opacity: 0.2
  60. }
  61. }
  62. };
  63. function getAxisType(axisName, option) {
  64. return option.type || (option.data ? 'category' : 'value');
  65. }
  66. zrUtil.merge(AxisModel.prototype, axisModelCommonMixin);
  67. axisModelCreator('single', AxisModel, getAxisType, defaultOption);
  68. var _default = AxisModel;
  69. module.exports = _default;