You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 8216bed
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: index.md
+43-14Lines changed: 43 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,6 +8,22 @@ UDAV is designed to enable different disciplines to display their automatic pre-
8
8
- Visual editor
9
9
- Different export options
10
10
11
+
## Widgets
12
+
13
+
UDAV currently contains the following widgets:
14
+
15
+
- Text (static)
16
+
- Image (static)
17
+
- Video (static)
18
+
- Inline Frame (static)
19
+
- Table
20
+
- Bar Chart
21
+
- Pie Chart
22
+
- Line Chart
23
+
- Highlight Text
24
+
- Simple Map
25
+
- Network Graph
26
+
11
27
### Demo
12
28
13
29
You can find a demo [here](udav/demo) where you can play around a little.
@@ -135,7 +151,7 @@ The only exception is the data API, which uses a custom ChartHandler to support
135
151
136
152
# Webpage
137
153
138
-
The frontend uses [Freemarker](https://freemarker.apache.org/) to render the html templates, [d3.js](https://d3js.org/) for some of the visualization components, [gridstack.js](https://gridstackjs.com/) for the draggable grid in the editor and [Bootstrap](https://getbootstrap.com/) for icons and styling.
154
+
The frontend uses [Freemarker](https://freemarker.apache.org/) to render the html templates, [d3.js](https://d3js.org/) for some of the visualization components, [gridstack.js](https://gridstackjs.com/) for the draggable grid in the editor, [Floating UI](https://floating-ui.com/) for some UI components and [Bootstrap](https://getbootstrap.com/) for icons and styling.
139
155
140
156
## Structure
141
157
@@ -154,6 +170,7 @@ Global CSS variables are defined in `variables.css`. The widgets are registered
154
170
│ │ ├─ 📁 pages
155
171
│ │ ├─ 📁 shared
156
172
│ │ └─ 📄 variables.css
173
+
│ ├─ 📁 data
157
174
│ ├─ 📁 img
158
175
│ ├─ 📁 js
159
176
│ │ ├─ 📁 api
@@ -176,16 +193,17 @@ Global CSS variables are defined in `variables.css`. The widgets are registered
176
193
│ │ │ ├─ 📁 charts
177
194
│ │ │ ├─ 📁 static
178
195
│ │ │ ├─ 📄 D3Visualization.js
196
+
│ │ │ ├─ 📄 WidgetInterface.js
179
197
│ │ │ └─ 📄 widgets.js
180
198
│ ├─ 📁 packages
181
199
│ └─ 📄 favicon.ico
182
200
└─ 📁 templates
201
+
├─ 📁 error
183
202
├─ 📁 pages
184
203
│ ├─ 📁 editor
185
204
│ │ ├─ 📄 editor.ftl
186
205
│ │ ├─ 📄 editorGrid.ftl
187
206
│ │ └─ 📄 editorSidebar.ftl
188
-
│ ├─ 📁 error
189
207
│ ├─ 📁 index
190
208
│ └─ 📁 view
191
209
└─ 📁 shared
@@ -217,17 +235,16 @@ To add a new chart widget, follow these steps:
217
235
- label: The label displayed to the user.
218
236
- options (optional): Additional configuration for the input.
219
237
220
-
4. To support the controls sidepanel and export functionality of the chart's toolbar, create a ControlsHandler and an ExportHandler in the constructor.
221
-
222
-
5. Provide a `data` property, an `init` and a `render` method.
223
-
- The data property is used to cache the latest data which allows re-rendering the chart without fetching the data again.
238
+
4. Extend the `WidgetInterface` class and implement a `init` and a `render` method.
224
239
- The init method will be called once after creation of the widget and should contain the first data fetch and rendering as well as the configuration of the controls.
225
240
- The render method will be called every time the chart data changes, for example after a filter is applied.
241
+
242
+
5. If your new widget uses d3.js to create an svg, you can extend the `D3Visualization` class instead. This class already provides helpful functions for svg initialization and resizing, tooltips or axis creation.
226
243
227
244
6. You can use this template as a starting point:
228
245
229
246
```js
230
-
exportdefaultclassNewChart {
247
+
exportdefaultclassNewChartextendsWidgetInterface{
231
248
static defaultConfig = {
232
249
type:"NewChart",
233
250
title:"New Chart",
@@ -249,24 +266,30 @@ To add a new chart widget, follow these steps:
249
266
},
250
267
};
251
268
252
-
constructor(root, getData, options) {
253
-
this.controls=newControlsHandler(this);
254
-
this.exports=newExportHandler(this);
269
+
constructor(root, config) {
270
+
super(root, config);
271
+
}
255
272
256
-
this.data;
273
+
clear() {
274
+
// Clear and set-up chart inside chart area
257
275
}
258
276
259
277
init() {
260
-
constdata=this.getData();
261
-
this.render(data);
278
+
const { data, meta } =awaitthis.fetch();
279
+
this.render(data[0]);
280
+
281
+
// Initialize export options
282
+
this.exports.init(meta.total>1);
283
+
this.filter= {
284
+
// Initialize filter
285
+
};
262
286
263
287
// Add controls ...
264
288
}
265
289
266
290
render(data) {
267
291
this.clear();
268
292
269
-
// Append svg to root
270
293
// Render chart data ...
271
294
272
295
this.data= data;
@@ -340,6 +363,12 @@ To add a new generator, follow these steps:
340
363
};
341
364
```
342
365
366
+
### Formular configuration
367
+
368
+
The widget controls and option modals in the editor are defined through a JSON structure. This structure is used by the `ControlsHandler` for widgets, as well as by the `formConfig` parameter of widgets, source and generator configurations. It defines the form input fields, including their types, labels, and available options.
369
+
370
+
Available input types are implemented in inputFactories.js, which acts as a central registry for creating the form inputs. If additional input types are needed, they can be easily extended by adding new implementations to inputFactories.js.
0 commit comments