index.htm 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1">
  6. <title>Highcharts Example</title>
  7. <style type="text/css">
  8. #container {
  9. min-width: 320px;
  10. max-width: 800px;
  11. margin: 0 auto;
  12. }
  13. </style>
  14. </head>
  15. <body>
  16. <script src="../../code/highcharts.js"></script>
  17. <script src="../../code/modules/networkgraph.js"></script>
  18. <script src="../../code/modules/exporting.js"></script>
  19. <div id="container"></div>
  20. <script type="text/javascript">
  21. // Add the nodes option through an event call. We want to start with the parent
  22. // item and apply separate colors to each child element, then the same color to
  23. // grandchildren.
  24. Highcharts.addEvent(
  25. Highcharts.seriesTypes.networkgraph,
  26. 'afterSetOptions',
  27. function (e) {
  28. var colors = Highcharts.getOptions().colors,
  29. i = 0,
  30. nodes = {};
  31. e.options.data.forEach(function (link) {
  32. if (link[0] === 'Proto Indo-European') {
  33. nodes['Proto Indo-European'] = {
  34. id: 'Proto Indo-European',
  35. marker: {
  36. radius: 20
  37. }
  38. };
  39. nodes[link[1]] = {
  40. id: link[1],
  41. marker: {
  42. radius: 10
  43. },
  44. color: colors[i++]
  45. };
  46. } else if (nodes[link[0]] && nodes[link[0]].color) {
  47. nodes[link[1]] = {
  48. id: link[1],
  49. color: nodes[link[0]].color
  50. };
  51. }
  52. });
  53. e.options.nodes = Object.keys(nodes).map(function (id) {
  54. return nodes[id];
  55. });
  56. }
  57. );
  58. Highcharts.chart('container', {
  59. chart: {
  60. type: 'networkgraph',
  61. height: '100%'
  62. },
  63. title: {
  64. text: 'The Indo-European Laungauge Tree'
  65. },
  66. subtitle: {
  67. text: 'A Force-Directed Network Graph in Highcharts'
  68. },
  69. plotOptions: {
  70. networkgraph: {
  71. keys: ['from', 'to'],
  72. layoutAlgorithm: {
  73. enableSimulation: true
  74. }
  75. }
  76. },
  77. series: [{
  78. dataLabels: {
  79. enabled: true
  80. },
  81. data: [
  82. ['Proto Indo-European', 'Balto-Slavic'],
  83. ['Proto Indo-European', 'Germanic'],
  84. ['Proto Indo-European', 'Celtic'],
  85. ['Proto Indo-European', 'Italic'],
  86. ['Proto Indo-European', 'Hellenic'],
  87. ['Proto Indo-European', 'Anatolian'],
  88. ['Proto Indo-European', 'Indo-Iranian'],
  89. ['Proto Indo-European', 'Tocharian'],
  90. ['Indo-Iranian', 'Dardic'],
  91. ['Indo-Iranian', 'Indic'],
  92. ['Indo-Iranian', 'Iranian'],
  93. ['Iranian', 'Old Persian'],
  94. ['Old Persian', 'Middle Persian'],
  95. ['Indic', 'Sanskrit'],
  96. ['Italic', 'Osco-Umbrian'],
  97. ['Italic', 'Latino-Faliscan'],
  98. ['Latino-Faliscan', 'Latin'],
  99. ['Celtic', 'Brythonic'],
  100. ['Celtic', 'Goidelic'],
  101. ['Germanic', 'North Germanic'],
  102. ['Germanic', 'West Germanic'],
  103. ['Germanic', 'East Germanic'],
  104. ['North Germanic', 'Old Norse'],
  105. ['North Germanic', 'Old Swedish'],
  106. ['North Germanic', 'Old Danish'],
  107. ['West Germanic', 'Old English'],
  108. ['West Germanic', 'Old Frisian'],
  109. ['West Germanic', 'Old Dutch'],
  110. ['West Germanic', 'Old Low German'],
  111. ['West Germanic', 'Old High German'],
  112. ['Old Norse', 'Old Icelandic'],
  113. ['Old Norse', 'Old Norwegian'],
  114. ['Old Norwegian', 'Middle Norwegian'],
  115. ['Old Swedish', 'Middle Swedish'],
  116. ['Old Danish', 'Middle Danish'],
  117. ['Old English', 'Middle English'],
  118. ['Old Dutch', 'Middle Dutch'],
  119. ['Old Low German', 'Middle Low German'],
  120. ['Old High German', 'Middle High German'],
  121. ['Balto-Slavic', 'Baltic'],
  122. ['Balto-Slavic', 'Slavic'],
  123. ['Slavic', 'East Slavic'],
  124. ['Slavic', 'West Slavic'],
  125. ['Slavic', 'South Slavic'],
  126. // Leaves:
  127. ['Proto Indo-European', 'Phrygian'],
  128. ['Proto Indo-European', 'Armenian'],
  129. ['Proto Indo-European', 'Albanian'],
  130. ['Proto Indo-European', 'Thracian'],
  131. ['Tocharian', 'Tocharian A'],
  132. ['Tocharian', 'Tocharian B'],
  133. ['Anatolian', 'Hittite'],
  134. ['Anatolian', 'Palaic'],
  135. ['Anatolian', 'Luwic'],
  136. ['Anatolian', 'Lydian'],
  137. ['Iranian', 'Balochi'],
  138. ['Iranian', 'Kurdish'],
  139. ['Iranian', 'Pashto'],
  140. ['Iranian', 'Sogdian'],
  141. ['Old Persian', 'Pahlavi'],
  142. ['Middle Persian', 'Persian'],
  143. ['Hellenic', 'Greek'],
  144. ['Dardic', 'Dard'],
  145. ['Sanskrit', 'Sindhi'],
  146. ['Sanskrit', 'Romani'],
  147. ['Sanskrit', 'Urdu'],
  148. ['Sanskrit', 'Hindi'],
  149. ['Sanskrit', 'Bihari'],
  150. ['Sanskrit', 'Assamese'],
  151. ['Sanskrit', 'Bengali'],
  152. ['Sanskrit', 'Marathi'],
  153. ['Sanskrit', 'Gujarati'],
  154. ['Sanskrit', 'Punjabi'],
  155. ['Sanskrit', 'Sinhalese'],
  156. ['Osco-Umbrian', 'Umbrian'],
  157. ['Osco-Umbrian', 'Oscan'],
  158. ['Latino-Faliscan', 'Faliscan'],
  159. ['Latin', 'Portugese'],
  160. ['Latin', 'Spanish'],
  161. ['Latin', 'French'],
  162. ['Latin', 'Romanian'],
  163. ['Latin', 'Italian'],
  164. ['Latin', 'Catalan'],
  165. ['Latin', 'Franco-Provençal'],
  166. ['Latin', 'Rhaeto-Romance'],
  167. ['Brythonic', 'Welsh'],
  168. ['Brythonic', 'Breton'],
  169. ['Brythonic', 'Cornish'],
  170. ['Brythonic', 'Cuymbric'],
  171. ['Goidelic', 'Modern Irish'],
  172. ['Goidelic', 'Scottish Gaelic'],
  173. ['Goidelic', 'Manx'],
  174. ['East Germanic', 'Gothic'],
  175. ['Middle Low German', 'Low German'],
  176. ['Middle High German', '(High) German'],
  177. ['Middle High German', 'Yiddish'],
  178. ['Middle English', 'English'],
  179. ['Middle Dutch', 'Hollandic'],
  180. ['Middle Dutch', 'Flemish'],
  181. ['Middle Dutch', 'Dutch'],
  182. ['Middle Dutch', 'Limburgish'],
  183. ['Middle Dutch', 'Brabantian'],
  184. ['Middle Dutch', 'Rhinelandic'],
  185. ['Old Frisian', 'Frisian'],
  186. ['Middle Danish', 'Danish'],
  187. ['Middle Swedish', 'Swedish'],
  188. ['Middle Norwegian', 'Norwegian'],
  189. ['Old Norse', 'Faroese'],
  190. ['Old Icelandic', 'Icelandic'],
  191. ['Baltic', 'Old Prussian'],
  192. ['Baltic', 'Lithuanian'],
  193. ['Baltic', 'Latvian'],
  194. ['West Slavic', 'Polish'],
  195. ['West Slavic', 'Slovak'],
  196. ['West Slavic', 'Czech'],
  197. ['West Slavic', 'Wendish'],
  198. ['East Slavic', 'Bulgarian'],
  199. ['East Slavic', 'Old Church Slavonic'],
  200. ['East Slavic', 'Macedonian'],
  201. ['East Slavic', 'Serbo-Croatian'],
  202. ['East Slavic', 'Slovene'],
  203. ['South Slavic', 'Russian'],
  204. ['South Slavic', 'Ukrainian'],
  205. ['South Slavic', 'Belarusian'],
  206. ['South Slavic', 'Rusyn']
  207. ]
  208. }]
  209. });
  210. </script>
  211. </body>
  212. </html>