Comments (4)
Here's the patch for timeline_kit_1.py
:
diff --git a/examples/timeline_kit_1.py b/examples/timeline_kit_1.py
index 8ebf35f..8efd591 100644
--- a/examples/timeline_kit_1.py
+++ b/examples/timeline_kit_1.py
@@ -14,7 +14,7 @@ def main():
{
"time": date(1980, 4, 17),
"episode": 5,
- "text": "The Empire Strikes Back",
+ "text": "\\href{https://gertjan.dev}{gertjan.dev}",
},
{
"time": date(1984, 4, 25),
@@ -56,7 +56,11 @@ def main():
"labella": {
"nodeHeight": 12,
},
- "latex": {"fontsize": "12pt", "reproducible": True},
+ "latex": {
+ "fontsize": "12pt",
+ "reproducible": True,
+ "preamble": "\\usepackage[hidelinks]{hyperref}",
+ },
}
tl = TimelineSVG(items, options=options)
This will only work for the PDF output, so disable TimelineSVG
when testing.
from labella.py.
That's due to having only one label, try it with more than one and it'll work.
from labella.py.
Hm...
I'm getting:
Traceback (most recent call last):
File "E:\dataDocuments\python\timeline_test\timeline.py", line 151, in <module>
main()
File "E:\dataDocuments\python\timeline_test\timeline.py", line 145, in main
tl.export("timeline_kit_1.tex")
File "E:\dataDocuments\python\timeline_test\.venv\lib\site-packages\labella\timeline.py", line 512, in
export
self.nodes, self.renderer = self.compute()
File "E:\dataDocuments\python\timeline_test\.venv\lib\site-packages\labella\timeline.py", line 243, in
compute
nodes = self.get_nodes()
File "E:\dataDocuments\python\timeline_test\.venv\lib\site-packages\labella\timeline.py", line 222, in
get_nodes
n = Node(self.timePos(it.data), it.width, data=it)
File "E:\dataDocuments\python\timeline_test\.venv\lib\site-packages\labella\timeline.py", line 304, in
timePos
return self.options["scale"](self.options["timeFn"](thedict))
File "E:\dataDocuments\python\timeline_test\.venv\lib\site-packages\labella\scale.py", line 507, in __call__
return self._linear(dt2milli(x))
File "E:\dataDocuments\python\timeline_test\.venv\lib\site-packages\labella\scale.py", line 380, in __call__
return self._output(x)
File "E:\dataDocuments\python\timeline_test\.venv\lib\site-packages\labella\scale.py", line 31, in <lambda>
return lambda x: i(u(x))
File "E:\dataDocuments\python\timeline_test\.venv\lib\site-packages\labella\scale.py", line 35, in <lambda>
return lambda x: (x - a) / (b - a)
ZeroDivisionError: float division by zero
When using:
from datetime import date
from labella.timeline import TimelineTex
def main():
items = [
{
"time": date(2021, 4, 1),
"text": "\\href{https://gertjan.dev}{gertjan.dev}"
}
]
options = {
"margin": {"left": 70, "right": 20, "top": 20, "bottom": 20},
"initialWidth": 1300,
"initialHeight": 1600,
"direction": "right",
"dotColor": "#000000",
"labelBgColor": "#000000",
"linkColor": "#000000",
"textFn": lambda x: "{\LARGE %s -- %s}" % (x["time"].date(), x["text"]),
"labelPadding": {"left": 2, "right": 0, "top": 2, "bottom": 0},
"labella": {
"nodeHeight": 12,
},
"latex": {
"fontsize": "12pt",
"reproducible": True,
"preamble": "\\usepackage[hidelinks]{hyperref}",
}
}
tl = TimelineTex(items, options=options)
tl.export("timeline_kit_1.tex")
if __name__ == "__main__":
main()
from labella.py.
You got it! Adding a second node did the trick!
Thank you so much for all the support! Cool project!
from labella.py.
Related Issues (15)
- Implement logscale
- textStyle example HOT 4
- borderColor not working HOT 3
- I think I'm missing something in my machine to run it but I don't know what. HOT 9
- Gantt chart HOT 2
- Horizontal Timeline up and down HOT 1
- Latexmk issue within Conda Env HOT 14
- FileNotFoundError: [WinError 2] The system cannot find the file specified
- import error HOT 3
- How to convert timeline to .png? HOT 5
- How to adjust node size and font size? HOT 4
- latexmk issue HOT 4
- OSError: [Errno 22] Invalid argument on dt2milli HOT 2
- Width caluculation - switch to TikZ? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from labella.py.