|
| 1 | +{ |
| 2 | + "cells": [ |
| 3 | + { |
| 4 | + "cell_type": "markdown", |
| 5 | + "id": "085034b4-0d83-4c2b-8b2a-d123cfa82446", |
| 6 | + "metadata": {}, |
| 7 | + "source": [ |
| 8 | + "# Basic Gantt Demo\n", |
| 9 | + "This notebook demonstrates assembling a basic Gantt chart." |
| 10 | + ] |
| 11 | + }, |
| 12 | + { |
| 13 | + "cell_type": "markdown", |
| 14 | + "id": "79193a65-ad7a-4e73-8c37-a8c81bbacd76", |
| 15 | + "metadata": {}, |
| 16 | + "source": [ |
| 17 | + "## Import Dependencies" |
| 18 | + ] |
| 19 | + }, |
| 20 | + { |
| 21 | + "cell_type": "code", |
| 22 | + "execution_count": null, |
| 23 | + "id": "6c2c5355-e40a-44e6-ba6e-4269818a4316", |
| 24 | + "metadata": {}, |
| 25 | + "outputs": [], |
| 26 | + "source": [ |
| 27 | + "from highcharts_gantt.chart import Chart\n", |
| 28 | + "from highcharts_gantt.options.series.gantt import GanttSeries\n", |
| 29 | + "import datetime" |
| 30 | + ] |
| 31 | + }, |
| 32 | + { |
| 33 | + "cell_type": "markdown", |
| 34 | + "id": "cbad4ca8-6538-45a6-8829-6da7ebf8707b", |
| 35 | + "metadata": {}, |
| 36 | + "source": [ |
| 37 | + "## Configure Options" |
| 38 | + ] |
| 39 | + }, |
| 40 | + { |
| 41 | + "cell_type": "code", |
| 42 | + "execution_count": null, |
| 43 | + "id": "c9c83903-99d1-4b17-86b2-5f4ee371e6aa", |
| 44 | + "metadata": {}, |
| 45 | + "outputs": [], |
| 46 | + "source": [ |
| 47 | + "options_as_dict = {\n", |
| 48 | + " 'title': {\n", |
| 49 | + " 'text': 'Gantt Chart with Progress Indicators',\n", |
| 50 | + " 'align': 'left'\n", |
| 51 | + " },\n", |
| 52 | + "\n", |
| 53 | + " 'xAxis': {\n", |
| 54 | + " 'min': datetime.date(2014, 10, 17),\n", |
| 55 | + " 'max': datetime.date(2014, 10, 30)\n", |
| 56 | + " },\n", |
| 57 | + "\n", |
| 58 | + " 'accessibility': {\n", |
| 59 | + " 'point': {\n", |
| 60 | + " 'descriptionFormatter': \"\"\"function (point) {\n", |
| 61 | + " var completedValue = point.completed ?\n", |
| 62 | + " point.completed.amount || point.completed : null,\n", |
| 63 | + " completed = completedValue ?\n", |
| 64 | + " ' Task completed ' + Math.round(completedValue * 1000) / 10 + '%.' :\n", |
| 65 | + " '';\n", |
| 66 | + " return Highcharts.format(\n", |
| 67 | + " '{point.yCategory}.{completed} Start {point.x:%Y-%m-%d}, end {point.x2:%Y-%m-%d}.',\n", |
| 68 | + " { point, completed }\n", |
| 69 | + " );\n", |
| 70 | + " }\"\"\"\n", |
| 71 | + " }\n", |
| 72 | + " },\n", |
| 73 | + "\n", |
| 74 | + " 'lang': {\n", |
| 75 | + " 'accessibility': {\n", |
| 76 | + " 'axis': {\n", |
| 77 | + " 'xAxisDescriptionPlural': 'The chart has a two-part X axis showing time in both week numbers and days.'\n", |
| 78 | + " }\n", |
| 79 | + " }\n", |
| 80 | + " },\n", |
| 81 | + "\n", |
| 82 | + " 'series': [{\n", |
| 83 | + " 'type': 'gantt',\n", |
| 84 | + " 'name': 'Project 1',\n", |
| 85 | + " 'data': [{\n", |
| 86 | + " 'name': 'Start prototype',\n", |
| 87 | + " 'start': datetime.date(2014, 10, 18),\n", |
| 88 | + " 'end': datetime.date(2014, 10, 25),\n", |
| 89 | + " 'completed': 0.25\n", |
| 90 | + " }, {\n", |
| 91 | + " 'name': 'Test prototype',\n", |
| 92 | + " 'start': datetime.date(2014, 10, 27),\n", |
| 93 | + " 'end': datetime.date(2014, 10, 29)\n", |
| 94 | + " }, {\n", |
| 95 | + " 'name': 'Develop',\n", |
| 96 | + " 'start': datetime.date(2014, 10, 20),\n", |
| 97 | + " 'end': datetime.date(2014, 10, 25),\n", |
| 98 | + " 'completed': {\n", |
| 99 | + " 'amount': 0.12,\n", |
| 100 | + " 'fill': '#fa0'\n", |
| 101 | + " }\n", |
| 102 | + " }, {\n", |
| 103 | + " 'name': 'Run acceptance tests',\n", |
| 104 | + " 'start': datetime.date(2014, 10, 23),\n", |
| 105 | + " 'end': datetime.date(2014, 10, 26)\n", |
| 106 | + " }]\n", |
| 107 | + " }]\n", |
| 108 | + "}" |
| 109 | + ] |
| 110 | + }, |
| 111 | + { |
| 112 | + "cell_type": "markdown", |
| 113 | + "id": "f575f6d0-16fc-4568-8faa-7c58d3c3b6e8", |
| 114 | + "metadata": {}, |
| 115 | + "source": [ |
| 116 | + "## Assemble and Display Chart" |
| 117 | + ] |
| 118 | + }, |
| 119 | + { |
| 120 | + "cell_type": "code", |
| 121 | + "execution_count": null, |
| 122 | + "id": "43f4325d-d9eb-4c91-b6c8-ec483efb51e9", |
| 123 | + "metadata": { |
| 124 | + "tags": [] |
| 125 | + }, |
| 126 | + "outputs": [], |
| 127 | + "source": [ |
| 128 | + "chart = Chart.from_options(options_as_dict, chart_kwargs = {'is_gantt_chart': True})\n", |
| 129 | + "chart.display()" |
| 130 | + ] |
| 131 | + }, |
| 132 | + { |
| 133 | + "cell_type": "code", |
| 134 | + "execution_count": null, |
| 135 | + "id": "4ec7bbf0-a11a-45e6-812d-501d1e421396", |
| 136 | + "metadata": {}, |
| 137 | + "outputs": [], |
| 138 | + "source": [] |
| 139 | + } |
| 140 | + ], |
| 141 | + "metadata": { |
| 142 | + "kernelspec": { |
| 143 | + "display_name": "Python 3 (ipykernel)", |
| 144 | + "language": "python", |
| 145 | + "name": "python3" |
| 146 | + }, |
| 147 | + "language_info": { |
| 148 | + "codemirror_mode": { |
| 149 | + "name": "ipython", |
| 150 | + "version": 3 |
| 151 | + }, |
| 152 | + "file_extension": ".py", |
| 153 | + "mimetype": "text/x-python", |
| 154 | + "name": "python", |
| 155 | + "nbconvert_exporter": "python", |
| 156 | + "pygments_lexer": "ipython3", |
| 157 | + "version": "3.10.5" |
| 158 | + } |
| 159 | + }, |
| 160 | + "nbformat": 4, |
| 161 | + "nbformat_minor": 5 |
| 162 | +} |
0 commit comments