-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Gantt: historic timeline – three-digit years and inverted scale (for BC years) #4437
Comments
I was looking into using Mermaid to make a Gantt chart for historic timelines in BC and this looks exactly like what I was looking for if it supported BC dates. I understand this could be difficult if the underlying data time object does not support it. |
I'm having a similar issue. My strategy was to try and use negative years BP (before present). But mermaid-js doesn't seem to recognize negative numbers for the start/end dates for items. I think the issue is that mermaid-js uses day-js to parse dates and day-js can't parse negative years (it can calculate with them, via subtract from a positive year, but it can't parse a negative year from a string). I just filled a bug report with dayjs (iamkun/dayjs#2636) to see if this can get fixed. It's not easy though with things like the Julian to Gregorian change etc... |
I've used Gantt charts for historical purposes with previous versions of Mermaid on Notable (markdown notes creator and manager) and with the current and they work well. All you have to do is to write negative numbers and establish the duration adding it literally (1y = 1 year). This is the code:
This is the rendering on GitHub: gantt
dateFormat YYYY
axisFormat %Y
section 431-404 a.C. Guerra del Peloponeso
431–404 a.C. Guerra del Peloponeso: a0, -0431, 28y
440 a.C. Ruptura de la paz: rebelión de Samos contra Atenas:a1, -0440, 1y
435-433 a.C. Guerra entre Corinto y Córcira: a6, -0435, 3y
431-421 a.C. La guerra arquidámica :a2, -0431, 10y
421 a.C. Paz Nicias :a3, -0421, 1y
415-413 a.C. Expedición a Sicilia :a4, -0415, 3y
414-404 a.C. Apoyo aqueménida a Esparta: a5, -0414, 11y
413-404 La segunda guerra Guerra de Decelia: a5, -0413, 10y
411 a.C. Revolución oligárquica, los Cuatrocientos: a7, -0411, 1y
404 a.C. El gobierno de los Treinta Tiranos: a7, -0404, 1y
404 a.C. Rendición de Atenas: a6, -0404, 1y
403 a.C. Trasíbulo restaura la democracia: a7, -0403, 1y
section Lisias
459 a.C. Nacimiento :a1, -459, 1y
445 a.C. Nacimiento :a1, -445, 1y
445-430 a.C. Vida en Atenas :a1, -445, 16y
444 a.C. Fundacion de Turio : a2, -444, 1y
430-412 a.C. Estancia en Turio : a2, -430, 19y
412 a.C. Expulsión de Turio y regreso a Atenas: a2, -412, 1y
404 a.C. Pérdida de bienes y muerte de Polemarco: a2, -404, 1y
Post ±403 a.C. Acciones legales contra Eratóstenes: a2, -403, 1y
±403-380 a.C. Acciones legales contra Eratóstenes: a2, -403, 24y
380 a.C. Muerte :a2, -380, 1y
Enjoy. |
Thanks for your replies. Your suggestion to use durations rather than specifying absolute dates solves problem (a). But I can't reproduce a working Gantt chart including negative numbers using that strategy (using the mermaid live editor for testing) –– and your GitHub rendering doesn't either. Updated (a') works as required:
Altered (b') does not display BC-events correctly but makes them all AC (i.e. positive numbers and ascending); it seems to ignore the minus sign:
|
Code:
Rendering gantt
title A Historic Gantt Diagram (b')
dateFormat YYY
axisFormat %Y
section Section
An intended "negative" historic event :-0200,20y
Another "negative" historic event :-0210,20y
A "positive" event :0200,20y
|
Anyway, there is several problems with negative years. I think this should be fixed, because Gantt graphs are FAR much better that the TimeLine graphs for creating time lines. |
This seems to change depnding on which program mermaid is being rendered in, but I've found a workaround: If you set the date format to X Using this system this:
|
Description
The Gantt-charts could be a perfect option for historic timelines (whereas the timeline diagrams are not, as they do not allow for partially overlapping events such as the ones given in the examples below).
However, (a) years with only three (or less) digits, such as '230', do not seem to work as inputs.
Furthermore, (b) it doesn't seem possible to allow events to span across years before Christ, from, say 230 (BC) to 200 (BC) – as the scale only ever displays positively increasing years (such as from 200 to 230).
Steps to reproduce
Here is a working Gantt chart example:
But the following diagram (a) displays no extended events in the live editor:
Nor does the following example (b) display the correct scale or events:
Screenshots
No response
Code Sample
No response
Setup
Additional Context
No response
The text was updated successfully, but these errors were encountered: