File size: 8,776 Bytes
42ee455
 
 
 
 
2465927
 
 
 
b699ae9
42ee455
b699ae9
42ee455
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22b0b94
42ee455
 
 
b699ae9
 
 
 
 
 
 
 
 
 
 
 
42ee455
 
 
 
b699ae9
42ee455
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b699ae9
 
 
 
 
 
 
 
 
 
 
 
42ee455
 
 
 
b699ae9
42ee455
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b699ae9
 
 
 
 
 
 
 
 
 
 
 
42ee455
 
 
b699ae9
 
42ee455
b699ae9
42ee455
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b699ae9
 
 
 
 
 
 
 
 
 
 
 
42ee455
 
 
 
b699ae9
42ee455
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b699ae9
 
 
 
 
 
 
 
 
 
 
 
42ee455
 
2465927
b699ae9
2465927
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b699ae9
 
 
 
 
 
 
 
 
 
 
2465927
 
 
b699ae9
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
"""Time charts."""

import vizro.models as vm

from pages._factories import column_and_line_factory, connected_scatter_factory
from pages._pages_utils import (
    PAGE_GRID,
    make_code_clipboard_from_py_file,
)
from pages.examples import area, gantt, heatmap, line, stepped_line, time_column

line_page = vm.Page(
    title="Line",
    path="time/line",
    layout=vm.Layout(grid=PAGE_GRID),
    components=[
        vm.Card(
            text="""

            #### What is a line chart?

            A line chart presents a series of data points over a continuous interval or time period, joined together
            with straight lines.

             

            #### When should I use it?

            You should select a line chart when you want to show trends over time. Usually, your y-axis will show a
            quantitative value and your x-axis will be marked as a timescale or a sequence of intervals. You can also
            display negative values below the x-axis. To group several lines (different data series) in the
            same chart, try to limit yourself to 3-4 to avoid cluttering up your chart.
        """
        ),
        vm.Graph(figure=line.fig),
        vm.Tabs(
            tabs=[
                vm.Container(
                    title="Vizro dashboard", components=[make_code_clipboard_from_py_file("line.py", mode="vizro")]
                ),
                vm.Container(
                    title="Plotly figure",
                    components=[make_code_clipboard_from_py_file("line.py", mode="plotly")],
                ),
            ]
        ),
    ],
)

# Note: Code example for magnitude/column differs from time/column. The text description is the same.
column_page = vm.Page(
    id="time-column",
    path="time/column",
    title="Column",
    layout=vm.Layout(grid=PAGE_GRID),
    components=[
        vm.Card(
            text="""
                #### What is a column chart?

                A column chart is a type of bar chart where data is represented with vertical columns. Each
                column's height corresponds to the value it represents, with the y-axis starting from zero.

                 

                #### When should I use it?

                Use a column chart to compare sizes and identify patterns in categorical data, including time-based
                data. Arrange columns to fit your message, and for time-based data, order them chronologically to
                highlight trends. Ensure clear labeling, especially with many categories, and consider using a legend
                or abbreviations with fuller descriptions below.
        """
        ),
        vm.Graph(figure=time_column.fig),
        vm.Tabs(
            tabs=[
                vm.Container(
                    title="Vizro dashboard",
                    components=[make_code_clipboard_from_py_file("time_column.py", mode="vizro")],
                ),
                vm.Container(
                    title="Plotly figure",
                    components=[make_code_clipboard_from_py_file("time_column.py", mode="plotly")],
                ),
            ]
        ),
    ],
)

area_page = vm.Page(
    title="Area",
    path="time/area",
    layout=vm.Layout(grid=PAGE_GRID),
    components=[
        vm.Card(
            text="""

            #### What is an area chart?

            An area chart displays data points over a continuous interval or time period, with the area between the line
            and the axis filled in to emphasize the magnitude of the values.

             

            #### When should I use it?

            An area chart is ideal for showing trends over time and emphasizing the volume of data. Typically,
            the y-axis represents a quantitative value, while the x-axis is marked with a timescale or sequence of
            intervals. Area charts can also display negative values below the x-axis. If you need to compare multiple
            data series in the same chart, try to limit yourself to 3-4 to maintain clarity and avoid clutter.
        """
        ),
        vm.Graph(figure=area.fig),
        vm.Tabs(
            tabs=[
                vm.Container(
                    title="Vizro dashboard", components=[make_code_clipboard_from_py_file("area.py", mode="vizro")]
                ),
                vm.Container(
                    title="Plotly figure",
                    components=[make_code_clipboard_from_py_file("area.py", mode="plotly")],
                ),
            ]
        ),
    ],
)

connected_scatter_page = connected_scatter_factory("time")
column_and_line_page = column_and_line_factory("time")

stepped_line_page = vm.Page(
    title="Stepped line",
    path="time/stepped-line",
    layout=vm.Layout(grid=PAGE_GRID),
    components=[
        vm.Card(
            text="""

            #### What is a stepped line chart?

            A stepped line chart is much like a standard line chart but, instead of connecting two points with the
            shortest line, the line forms a series of steps between data points.

             

            #### When should I use it?

            You should use a stepped line chart when you wish to draw attention to changes occurring at specific points.
            By contrast, a line chart would suggest that changes occur gradually.
        """
        ),
        vm.Graph(figure=stepped_line.fig),
        vm.Tabs(
            tabs=[
                vm.Container(
                    title="Vizro dashboard",
                    components=[make_code_clipboard_from_py_file("stepped_line.py", mode="vizro")],
                ),
                vm.Container(
                    title="Plotly figure",
                    components=[make_code_clipboard_from_py_file("stepped_line.py", mode="plotly")],
                ),
            ]
        ),
    ],
)

heatmap_page = vm.Page(
    title="Heatmap",
    path="time/heatmap",
    layout=vm.Layout(grid=PAGE_GRID),
    components=[
        vm.Card(
            text="""
            #### What is a heatmap?
            A heatmap chart depicts values for a main variable of interest across two axis variables as a grid of
            colored squares. The color intensity of each cell represents the value of the main variable within a
            specific range.

             

            #### When should I use it?

            Use a heatmap chart to visualize time patterns and identify trends between two variables.
            Typically, the x-axis represents time intervals (e.g., hours, days, months), while the y-axis represents
            categories or different variables. By observing color changes across the grid, you can easily spot
            patterns and correlations.
        """
        ),
        vm.Graph(figure=heatmap.fig),
        vm.Tabs(
            tabs=[
                vm.Container(
                    title="Vizro dashboard", components=[make_code_clipboard_from_py_file("heatmap.py", mode="vizro")]
                ),
                vm.Container(
                    title="Plotly figure",
                    components=[make_code_clipboard_from_py_file("heatmap.py", mode="plotly")],
                ),
            ]
        ),
    ],
)

gantt_page = vm.Page(
    title="Gantt",
    path="time/gantt",
    layout=vm.Layout(grid=PAGE_GRID),
    components=[
        vm.Card(
            text="""
                #### What is a gantt chart?

                A gantt chart is a type of bar chart that visualizes a project schedule.
It shows the start and end dates of a project element, such as tasks, activities, or
events, in a timeline format. Each element is represented by a bar whose length indicates
its duration.

                 

                #### When should I use it?

                Gantt charts are ideal for visualizing project timelines, tracking
progress, and managing dependencies. They clearly display task start and end dates, making
it easy to monitor project status and manage interdependencies. However, they can become
complex if not regularly updated, especially for large projects.
        """
        ),
        vm.Graph(figure=gantt.fig),
        vm.Tabs(
            tabs=[
                vm.Container(
                    title="Vizro dashboard", components=[make_code_clipboard_from_py_file("gantt.py", mode="vizro")]
                ),
                vm.Container(
                    title="Plotly figure",
                    components=[make_code_clipboard_from_py_file("gantt.py", mode="plotly")],
                ),
            ]
        ),
    ],
)
pages = [
    line_page,
    column_page,
    area_page,
    connected_scatter_page,
    column_and_line_page,
    stepped_line_page,
    heatmap_page,
    gantt_page,
]