Yields a string of HTML to visualize the graph using a force-based spring layout. The js parameter sets the path to graph.js and excanvas.js (by default, "./").
(self)
| 1387 | |
| 1388 | @property |
| 1389 | def html(self): |
| 1390 | """ Yields a string of HTML to visualize the graph using a force-based spring layout. |
| 1391 | The js parameter sets the path to graph.js and excanvas.js (by default, "./"). |
| 1392 | """ |
| 1393 | js = self.javascript.rstrip("/") |
| 1394 | js = (js and js or ".")+"/" |
| 1395 | if self.stylesheet == INLINE: |
| 1396 | css = self.style.replace("\n","\n\t\t").rstrip("\t") |
| 1397 | css = "<style type=\"text/css\">\n\t\t%s\n\t</style>" % css |
| 1398 | elif self.stylesheet == DEFAULT: |
| 1399 | css = "<link rel=\"stylesheet\" href=\"style.css\" type=\"text/css\" media=\"screen\" />" |
| 1400 | elif self.stylesheet is not None: |
| 1401 | css = "<link rel=\"stylesheet\" href=\"%s\" type=\"text/css\" media=\"screen\" />" % self.stylesheet |
| 1402 | else: |
| 1403 | css = "" |
| 1404 | s = self._script() |
| 1405 | s = "".join(s) |
| 1406 | s = "\t" + s.replace("\n", "\n\t\t\t") |
| 1407 | s = s.rstrip() |
| 1408 | s = self._source % ( |
| 1409 | self.title, |
| 1410 | css, |
| 1411 | js, |
| 1412 | js, |
| 1413 | self.id, |
| 1414 | self.width, |
| 1415 | self.height, |
| 1416 | s) |
| 1417 | return s |
| 1418 | |
| 1419 | def render(self, type=HTML): |
| 1420 | if type == HTML: |