ChordSeries.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. var SeriesModel = require("../../model/Series");
  2. var createGraphFromNodeEdge = require("../helper/createGraphFromNodeEdge");
  3. var createGraphFromNodeMatrix = require("../helper/createGraphFromNodeMatrix");
  4. var ChordSeries = SeriesModel.extend({
  5. type: 'series.chord',
  6. getInitialData: function (option) {
  7. var edges = option.edges || option.links;
  8. var nodes = option.data || option.nodes;
  9. var matrix = option.matrix;
  10. if (nodes && edges) {
  11. var graph = createGraphFromNodeEdge(nodes, edges, this, true);
  12. return graph.data;
  13. } else if (nodes && matrix) {
  14. var graph = createGraphFromNodeMatrix(nodes, matrix, this, true);
  15. return graph.data;
  16. }
  17. },
  18. /**
  19. * @return {module:echarts/data/Graph}
  20. */
  21. getGraph: function () {
  22. return this.getData().graph;
  23. },
  24. /**
  25. * @return {module:echarts/data/List}
  26. */
  27. getEdgeData: function () {
  28. return this.getGraph().edgeData;
  29. },
  30. defaultOption: {
  31. center: ['50%', '50%'],
  32. radius: ['65%', '75%'],
  33. //
  34. // layout: 'circular',
  35. sort: 'none',
  36. sortSub: 'none',
  37. padding: 0.02,
  38. startAngle: 90,
  39. clockwise: true,
  40. itemStyle: {
  41. normal: {},
  42. emphasis: {}
  43. },
  44. chordStyle: {
  45. normal: {},
  46. emphasis: {}
  47. }
  48. }
  49. });
  50. var _default = ChordSeries;
  51. module.exports = _default;