ChordSeries.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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 createGraphFromNodeEdge = require("../helper/createGraphFromNodeEdge");
  21. var createGraphFromNodeMatrix = require("../helper/createGraphFromNodeMatrix");
  22. /*
  23. * Licensed to the Apache Software Foundation (ASF) under one
  24. * or more contributor license agreements. See the NOTICE file
  25. * distributed with this work for additional information
  26. * regarding copyright ownership. The ASF licenses this file
  27. * to you under the Apache License, Version 2.0 (the
  28. * "License"); you may not use this file except in compliance
  29. * with the License. You may obtain a copy of the License at
  30. *
  31. * http://www.apache.org/licenses/LICENSE-2.0
  32. *
  33. * Unless required by applicable law or agreed to in writing,
  34. * software distributed under the License is distributed on an
  35. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  36. * KIND, either express or implied. See the License for the
  37. * specific language governing permissions and limitations
  38. * under the License.
  39. */
  40. var ChordSeries = SeriesModel.extend({
  41. type: 'series.chord',
  42. getInitialData: function (option) {
  43. var edges = option.edges || option.links;
  44. var nodes = option.data || option.nodes;
  45. var matrix = option.matrix;
  46. if (nodes && edges) {
  47. var graph = createGraphFromNodeEdge(nodes, edges, this, true);
  48. return graph.data;
  49. } else if (nodes && matrix) {
  50. var graph = createGraphFromNodeMatrix(nodes, matrix, this, true);
  51. return graph.data;
  52. }
  53. },
  54. /**
  55. * @return {module:echarts/data/Graph}
  56. */
  57. getGraph: function () {
  58. return this.getData().graph;
  59. },
  60. /**
  61. * @return {module:echarts/data/List}
  62. */
  63. getEdgeData: function () {
  64. return this.getGraph().edgeData;
  65. },
  66. defaultOption: {
  67. center: ['50%', '50%'],
  68. radius: ['65%', '75%'],
  69. //
  70. // layout: 'circular',
  71. sort: 'none',
  72. sortSub: 'none',
  73. padding: 0.02,
  74. startAngle: 90,
  75. clockwise: true,
  76. itemStyle: {},
  77. emphasis: {
  78. itemStyle: {},
  79. chordStyle: {}
  80. },
  81. chordStyle: {}
  82. }
  83. });
  84. var _default = ChordSeries;
  85. module.exports = _default;