-
Notifications
You must be signed in to change notification settings - Fork 0
G02: Add gantt chart with Journeys Visualization #16
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
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,22 +1,114 @@ | ||
| Highcharts.ganttChart('container', { | ||
|
|
||
| title: { | ||
| text: 'Journeys (visualization)' | ||
| }, | ||
| const day = 1000 * 60 * 60 * 24; | ||
| const dateMin = Date.UTC(2024, 0, 1), | ||
| dateMax = Date.UTC(2024, 0, 8); | ||
|
|
||
| series: [{ | ||
| name: 'Journeys', | ||
| data: [{ | ||
| name: 'Cruises', | ||
| id: 'cruises', | ||
| start: Date.UTC(2024, 0, 1), | ||
| end: Date.UTC(2024, 0, 4) | ||
| }, { | ||
| name: 'Flights', | ||
| id: 'flights', | ||
| start: Date.UTC(2024, 0, 3), | ||
| end: Date.UTC(2024, 0, 7) | ||
| }] | ||
| }] | ||
|
|
||
| Highcharts.ganttChart('container', { | ||
| title: { | ||
| text: 'Journeys (visualization)' | ||
| }, | ||
| chart: { | ||
| events: { | ||
| load() { | ||
| // Navigator doesn't display all data on start by default... | ||
| this.series.forEach(s => s.update({}, false)); | ||
| } | ||
| } | ||
| }, | ||
| xAxis: { | ||
| units: [['day']], | ||
| labels: { | ||
| formatter: function () { | ||
| return `Day ${Math.floor((this.value - dateMin) / day) + 1}`; | ||
| } | ||
| } | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of using
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably about
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Exactly! |
||
| }, | ||
| navigator: { | ||
| enabled: true, | ||
| liveRedraw: false | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This option doesn't exist in the API |
||
| }, | ||
| plotOptions: { | ||
| series: { | ||
| dataLabels: { | ||
| enabled: true, | ||
| format: `{point.options.label}` | ||
| }, | ||
| dragDrop: { | ||
| draggableX: true, | ||
| liveRedraw: false, | ||
| dragPrecisionX: day, | ||
| dragMinX: dateMin, | ||
| dragMaxX: dateMax, | ||
| } | ||
| } | ||
| }, | ||
| series: [{ | ||
| name: 'Journeys', | ||
| data: [{ | ||
| name: 'Cruises', | ||
| id: 'cruises', | ||
| start: Date.UTC(2024, 0, 1), | ||
| end: Date.UTC(2024, 0, 4) | ||
| }, { | ||
| name: 'Norway - England', | ||
| id: 'norway-england-cruise', | ||
| parent: 'cruises', | ||
| dependency: 'cruises', | ||
| start: Date.UTC(2024, 0, 2), | ||
| end: Date.UTC(2024, 0, 3) | ||
| }, { | ||
| name: 'Flights', | ||
| id: 'flights', | ||
| start: Date.UTC(2024, 0, 3), | ||
| end: Date.UTC(2024, 0, 7) | ||
| }, { | ||
| name: 'Domestic flights', | ||
| id: 'domestic-flights', | ||
| parent: 'flights', | ||
| start: Date.UTC(2024, 0, 4), | ||
| end: Date.UTC(2024, 0, 6) | ||
| }, { | ||
| name: 'Beijing - Hong Kong', | ||
| id: 'beijing-hongkong-flight', | ||
| parent: 'domestic-flights', | ||
| dependency: ['flights', 'domestic-flights'], | ||
| start: Date.UTC(2024, 0, 4), | ||
| end: Date.UTC(2024, 0, 5) | ||
| }, { | ||
| name: 'International flights', | ||
| id: 'international-flights', | ||
| parent: 'flights', | ||
| start: Date.UTC(2024, 0, 4), | ||
| end: Date.UTC(2024, 0, 7) | ||
| }, { | ||
| name: 'Norway - Brazil', | ||
| id: 'norway-brazil-flight', | ||
| label: 'Show full adventure', | ||
| drilldown: 'norway-brazil-flight-full', | ||
| parent: 'international-flights', | ||
| dependency: ['flights', 'international-flights'], | ||
| color: 'orange', | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nitpicking, but the color of this point as well as the drilldown points doesn't match the gif colors exactly. Could you please update it? |
||
| start: Date.UTC(2024, 0, 5), | ||
| end: Date.UTC(2024, 0, 8) | ||
| }] | ||
| }], | ||
| drilldown: { | ||
| series: [{ | ||
| showInNavigator: true, | ||
| name: 'Norway - Brazil full', | ||
| id: 'norway-brazil-flight-full', | ||
| data: [{ | ||
| name: 'Norway - Spain', | ||
| id: 'norway-spain-flight', | ||
| color: 'orange', | ||
| start: Date.UTC(2024, 0, 5), | ||
| end: Date.UTC(2024, 0, 6) | ||
| }, { | ||
| name: 'Spain - Brazil', | ||
| id: 'spain-brazil-flight', | ||
| color: 'orange', | ||
| start: Date.UTC(2024, 0, 6), | ||
| end: Date.UTC(2024, 0, 8) | ||
| }] | ||
| }] | ||
| } | ||
| }); | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like you've found the issue with Navigator not rendering the rows correctly, that's is a really nice workaround!