@amcharts/amcharts5-mcp 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.gitmodules +3 -0
- package/README.md +82 -0
- package/amcharts5-skill/README.md +50 -0
- package/amcharts5-skill/amcharts5-skill/SKILL.md +667 -0
- package/amcharts5-skill/amcharts5-skill/references/flow.md +523 -0
- package/amcharts5-skill/amcharts5-skill/references/gantt.md +410 -0
- package/amcharts5-skill/amcharts5-skill/references/hierarchy.md +568 -0
- package/amcharts5-skill/amcharts5-skill/references/map.md +574 -0
- package/amcharts5-skill/amcharts5-skill/references/pie.md +663 -0
- package/amcharts5-skill/amcharts5-skill/references/radar.md +584 -0
- package/amcharts5-skill/amcharts5-skill/references/stock.md +664 -0
- package/amcharts5-skill/amcharts5-skill/references/timeline.md +449 -0
- package/amcharts5-skill/amcharts5-skill/references/ui-elements.md +393 -0
- package/amcharts5-skill/amcharts5-skill/references/venn.md +368 -0
- package/amcharts5-skill/amcharts5-skill/references/wordcloud.md +339 -0
- package/amcharts5-skill/amcharts5-skill/references/xy.md +1150 -0
- package/amcharts5-skill/cursorrules +820 -0
- package/package.json +27 -0
- package/src/index.js +329 -0
- package/test.js +153 -0
|
@@ -0,0 +1,410 @@
|
|
|
1
|
+
# Gantt Chart
|
|
2
|
+
|
|
3
|
+
Docs: https://www.amcharts.com/docs/v5/charts/gantt/
|
|
4
|
+
|
|
5
|
+
Gantt is a standalone chart class (not just a simulated XY chart). It auto-creates axes, series, and toolbar — you only provide data. It supports editable tasks, task linking, progress tracking, collapsible groups, weekends/holidays, and a color picker.
|
|
6
|
+
|
|
7
|
+
## Imports
|
|
8
|
+
|
|
9
|
+
### ES modules / TypeScript
|
|
10
|
+
```ts
|
|
11
|
+
import * as am5 from "@amcharts/amcharts5";
|
|
12
|
+
import * as am5xy from "@amcharts/amcharts5/xy";
|
|
13
|
+
import * as am5gantt from "@amcharts/amcharts5/gantt";
|
|
14
|
+
import am5plugins_colorPicker from "@amcharts/amcharts5/plugins/colorPicker";
|
|
15
|
+
import am5themes_Animated from "@amcharts/amcharts5/themes/Animated";
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
### CDN / script tags
|
|
19
|
+
```html
|
|
20
|
+
<script src="https://cdn.amcharts.com/lib/5/index.js"></script>
|
|
21
|
+
<script src="https://cdn.amcharts.com/lib/5/xy.js"></script>
|
|
22
|
+
<script src="https://cdn.amcharts.com/lib/5/plugins/colorPicker.js"></script>
|
|
23
|
+
<script src="https://cdn.amcharts.com/lib/5/gantt.js"></script>
|
|
24
|
+
<script src="https://cdn.amcharts.com/lib/5/themes/Animated.js"></script>
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Core setup
|
|
28
|
+
|
|
29
|
+
```js
|
|
30
|
+
var root = am5.Root.new("chartdiv");
|
|
31
|
+
root.setThemes([am5themes_Animated.new(root)]);
|
|
32
|
+
|
|
33
|
+
var chart = root.container.children.push(
|
|
34
|
+
am5gantt.Gantt.new(root, {
|
|
35
|
+
editable: true,
|
|
36
|
+
durationUnit: "day"
|
|
37
|
+
})
|
|
38
|
+
);
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
**Important:** Gantt auto-creates axes (`chart.xAxis`, `chart.xAxisMinor`, `chart.yAxis`) and series (`chart.series`). Do NOT create them manually.
|
|
42
|
+
|
|
43
|
+
## Chart settings
|
|
44
|
+
|
|
45
|
+
| Setting | Type | Default | Description |
|
|
46
|
+
|---------|------|---------|-------------|
|
|
47
|
+
| `editable` | boolean | `true` | Allow user to add, edit, remove, drag tasks |
|
|
48
|
+
| `durationUnit` | string | `"day"` | `"year"`, `"month"`, `"week"`, `"day"`, `"hour"`, `"minute"`, `"second"` |
|
|
49
|
+
| `weekends` | number[] | `[0, 6]` | Non-working days (0=Sun, 1=Mon, ... 6=Sat) |
|
|
50
|
+
| `excludeWeekends` | boolean | `true` | Whether to exclude weekends from task durations |
|
|
51
|
+
| `holidays` | Date[] | `[]` | Specific non-working dates |
|
|
52
|
+
| `snapThreshold` | number | `0.5` | Drag snap position within a period (0–1) |
|
|
53
|
+
| `sidebarWidth` | number | — | Sidebar width in pixels or Percent |
|
|
54
|
+
|
|
55
|
+
## Data structure
|
|
56
|
+
|
|
57
|
+
**CRITICAL:** Data is set in TWO separate calls — category data on the Y axis, and task data on the series:
|
|
58
|
+
|
|
59
|
+
```js
|
|
60
|
+
// 1. Category data → chart.yAxis.data.setAll()
|
|
61
|
+
// Flat array with parentId for hierarchy (NOT nested children)
|
|
62
|
+
chart.yAxis.data.setAll([
|
|
63
|
+
{ id: "design", name: "Design Phase", color: am5.color(0x297373) },
|
|
64
|
+
{ id: "wireframes", name: "Wireframes", parentId: "design" },
|
|
65
|
+
{ id: "mockups", name: "Mockups", parentId: "design" },
|
|
66
|
+
{ id: "dev", name: "Development", color: am5.color(0xffc857) },
|
|
67
|
+
{ id: "frontend", name: "Frontend", parentId: "dev" },
|
|
68
|
+
{ id: "backend", name: "Backend", parentId: "dev" }
|
|
69
|
+
]);
|
|
70
|
+
|
|
71
|
+
// 2. Task/series data → chart.series.data.setAll()
|
|
72
|
+
// Each item's id must match a category id from above
|
|
73
|
+
chart.series.data.setAll([
|
|
74
|
+
{ id: "design", start: new Date(2024, 0, 1).getTime(), duration: 10, progress: 100 },
|
|
75
|
+
{ id: "wireframes", start: new Date(2024, 0, 1).getTime(), duration: 4, progress: 100 },
|
|
76
|
+
{ id: "mockups", start: new Date(2024, 0, 7).getTime(), duration: 6, progress: 100 },
|
|
77
|
+
{ id: "dev", start: new Date(2024, 0, 15).getTime(), duration: 20, progress: 60 },
|
|
78
|
+
{ id: "frontend", start: new Date(2024, 0, 15).getTime(), duration: 15, progress: 80 },
|
|
79
|
+
{ id: "backend", start: new Date(2024, 0, 20).getTime(), duration: 15, progress: 40 }
|
|
80
|
+
]);
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Category data fields (yAxis)
|
|
84
|
+
|
|
85
|
+
| Field | Default Key | Description |
|
|
86
|
+
|-------|------------|-------------|
|
|
87
|
+
| `idField` | `"id"` | Unique category identifier |
|
|
88
|
+
| `nameField` | `"name"` | Display name in sidebar |
|
|
89
|
+
| `parentIdField` | `"parentId"` | Parent category id for hierarchy |
|
|
90
|
+
| `collapsedField` | `"collapsed"` | Whether group starts collapsed |
|
|
91
|
+
| `colorField` | `"color"` | Task bar color |
|
|
92
|
+
|
|
93
|
+
Customize field names:
|
|
94
|
+
```js
|
|
95
|
+
chart.yAxis.setAll({
|
|
96
|
+
nameField: "task",
|
|
97
|
+
collapsedField: "closed"
|
|
98
|
+
});
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Series data fields
|
|
102
|
+
|
|
103
|
+
| Field | Default Key | Description |
|
|
104
|
+
|-------|------------|-------------|
|
|
105
|
+
| `idField` | `"id"` | Must match a category id |
|
|
106
|
+
| `openValueXField` | `"start"` | Start timestamp (ms) |
|
|
107
|
+
| `durationField` | `"duration"` | Duration in durationUnits |
|
|
108
|
+
| `progressField` | `"progress"` | 0–100 completion |
|
|
109
|
+
| `linkToField` | `"linkTo"` | Array of ids to link to |
|
|
110
|
+
|
|
111
|
+
Customize field names:
|
|
112
|
+
```js
|
|
113
|
+
chart.series.setAll({
|
|
114
|
+
durationField: "days",
|
|
115
|
+
progressField: "completion"
|
|
116
|
+
});
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Task linking (dependencies)
|
|
120
|
+
|
|
121
|
+
```js
|
|
122
|
+
chart.series.data.setAll([
|
|
123
|
+
{ id: "task1", start: timestamp, duration: 5, progress: 100, linkTo: ["task2"] },
|
|
124
|
+
{ id: "task2", start: timestamp, duration: 3, progress: 0 }
|
|
125
|
+
]);
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### Zero-duration tasks (milestones)
|
|
129
|
+
|
|
130
|
+
Set `duration: 0` to create milestone markers.
|
|
131
|
+
|
|
132
|
+
## Y-axis configuration (categories)
|
|
133
|
+
|
|
134
|
+
```js
|
|
135
|
+
chart.yAxis.setAll({
|
|
136
|
+
minCellHeight: 80, // row height in pixels (default: 70)
|
|
137
|
+
childCellSize: 1, // child row size relative to parent (default: 0.7, 1 = same)
|
|
138
|
+
childShift: 0 // child label indent in pixels (default: 25)
|
|
139
|
+
});
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## X-axis (timeline)
|
|
143
|
+
|
|
144
|
+
Access: `chart.xAxis` (primary) and `chart.xAxisMinor` (secondary).
|
|
145
|
+
|
|
146
|
+
```js
|
|
147
|
+
// Hide the secondary axis
|
|
148
|
+
chart.xAxisMinor.hide();
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
## Weekend & holiday configuration
|
|
152
|
+
|
|
153
|
+
```js
|
|
154
|
+
var chart = root.container.children.push(
|
|
155
|
+
am5gantt.Gantt.new(root, {
|
|
156
|
+
durationUnit: "day",
|
|
157
|
+
weekends: [0, 5, 6],
|
|
158
|
+
excludeWeekends: true,
|
|
159
|
+
holidays: [
|
|
160
|
+
new Date(2025, 0, 1),
|
|
161
|
+
new Date(2025, 6, 4),
|
|
162
|
+
new Date(2025, 10, 27)
|
|
163
|
+
]
|
|
164
|
+
})
|
|
165
|
+
);
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## Read-only mode
|
|
169
|
+
|
|
170
|
+
```js
|
|
171
|
+
am5gantt.Gantt.new(root, {
|
|
172
|
+
editable: false
|
|
173
|
+
})
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
## Control buttons
|
|
177
|
+
|
|
178
|
+
| Property | Description |
|
|
179
|
+
|----------|-------------|
|
|
180
|
+
| `chart.addButton` | Add new task |
|
|
181
|
+
| `chart.colorPickerButton` | Invoke color picker |
|
|
182
|
+
| `chart.expandButton` | Expand all categories |
|
|
183
|
+
| `chart.collapseButton` | Collapse all categories |
|
|
184
|
+
| `chart.linkButton` | Toggle auto-linking |
|
|
185
|
+
| `chart.clearButton` | Delete all data (with confirmation) |
|
|
186
|
+
| `chart.editButton` | Toggle edit/read-only (hidden by default) |
|
|
187
|
+
| `chart.zoomOutButton` | Zoom to full width |
|
|
188
|
+
| `chart.fitButton` | Fit tasks to view |
|
|
189
|
+
| `chart.controls` | Container holding all controls |
|
|
190
|
+
|
|
191
|
+
```js
|
|
192
|
+
// Hide specific buttons
|
|
193
|
+
chart.colorPickerButton.hide(0);
|
|
194
|
+
chart.clearButton.hide(0);
|
|
195
|
+
|
|
196
|
+
// Hide ALL controls
|
|
197
|
+
chart.controls.hide(0);
|
|
198
|
+
|
|
199
|
+
// Show edit toggle
|
|
200
|
+
chart.editButton.show(0);
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
## Series customization
|
|
204
|
+
|
|
205
|
+
```js
|
|
206
|
+
chart.series.columns.template.setAll({
|
|
207
|
+
strokeWidth: 2,
|
|
208
|
+
height: am5.percent(90)
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
chart.series.columns.template.adapters.add("stroke", function() {
|
|
212
|
+
return am5.color(0x000000);
|
|
213
|
+
});
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
## Color customization
|
|
217
|
+
|
|
218
|
+
```js
|
|
219
|
+
// Set custom color palette
|
|
220
|
+
chart.get("colors").set("colors", [
|
|
221
|
+
am5.color(0x095256),
|
|
222
|
+
am5.color(0x087f8c),
|
|
223
|
+
am5.color(0x5aaa95),
|
|
224
|
+
am5.color(0x86a873),
|
|
225
|
+
am5.color(0xbb9f06)
|
|
226
|
+
]);
|
|
227
|
+
|
|
228
|
+
// Single color for all tasks
|
|
229
|
+
chart.get("colors").setAll({
|
|
230
|
+
colors: [am5.color(0x095256)],
|
|
231
|
+
step: 0
|
|
232
|
+
});
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
## Events and serialization
|
|
236
|
+
|
|
237
|
+
```js
|
|
238
|
+
// Listen for data changes
|
|
239
|
+
chart.events.on("valueschanged", function(ev) {
|
|
240
|
+
console.log("Data changed");
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
// Debounced version
|
|
244
|
+
chart.events.onDebounced("valueschanged", function(ev) {
|
|
245
|
+
// Fires once after 500ms of last change
|
|
246
|
+
}, 500);
|
|
247
|
+
|
|
248
|
+
// Serialize data for saving
|
|
249
|
+
var ganttData = {
|
|
250
|
+
axis: chart.yAxis.data.values,
|
|
251
|
+
series: chart.series.data.values
|
|
252
|
+
};
|
|
253
|
+
var serialized = JSON.stringify(ganttData);
|
|
254
|
+
|
|
255
|
+
// Restore saved data
|
|
256
|
+
var restored = JSON.parse(serialized);
|
|
257
|
+
chart.yAxis.data.setAll(restored.axis);
|
|
258
|
+
chart.series.data.setAll(restored.series);
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
---
|
|
262
|
+
|
|
263
|
+
## Example 1: Full Gantt chart with am5gantt.Gantt
|
|
264
|
+
|
|
265
|
+
```html
|
|
266
|
+
<!DOCTYPE html>
|
|
267
|
+
<html>
|
|
268
|
+
<head>
|
|
269
|
+
<meta charset="UTF-8">
|
|
270
|
+
<title>Gantt Chart</title>
|
|
271
|
+
<script src="https://cdn.amcharts.com/lib/5/index.js"></script>
|
|
272
|
+
<script src="https://cdn.amcharts.com/lib/5/xy.js"></script>
|
|
273
|
+
<script src="https://cdn.amcharts.com/lib/5/gantt.js"></script>
|
|
274
|
+
<script src="https://cdn.amcharts.com/lib/5/plugins/colorPicker.js"></script>
|
|
275
|
+
<script src="https://cdn.amcharts.com/lib/5/themes/Animated.js"></script>
|
|
276
|
+
<style>
|
|
277
|
+
#chartdiv { width: 100%; height: 500px; }
|
|
278
|
+
</style>
|
|
279
|
+
</head>
|
|
280
|
+
<body>
|
|
281
|
+
<div id="chartdiv"></div>
|
|
282
|
+
<script>
|
|
283
|
+
var root = am5.Root.new("chartdiv");
|
|
284
|
+
root.setThemes([am5themes_Animated.new(root)]);
|
|
285
|
+
|
|
286
|
+
var chart = root.container.children.push(
|
|
287
|
+
am5gantt.Gantt.new(root, {
|
|
288
|
+
editable: true,
|
|
289
|
+
durationUnit: "day",
|
|
290
|
+
weekends: [0, 6],
|
|
291
|
+
excludeWeekends: true
|
|
292
|
+
})
|
|
293
|
+
);
|
|
294
|
+
|
|
295
|
+
// Category data (yAxis) — flat with parentId for hierarchy
|
|
296
|
+
chart.yAxis.data.setAll([
|
|
297
|
+
{ id: "planning", name: "Planning", color: am5.color(0x297373) },
|
|
298
|
+
{ id: "requirements", name: "Requirements", parentId: "planning" },
|
|
299
|
+
{ id: "architecture", name: "Architecture", parentId: "planning" },
|
|
300
|
+
{ id: "design", name: "Design", color: am5.color(0xe9724c) },
|
|
301
|
+
{ id: "wireframes", name: "Wireframes", parentId: "design" },
|
|
302
|
+
{ id: "visual", name: "Visual Design", parentId: "design" },
|
|
303
|
+
{ id: "dev", name: "Development", color: am5.color(0xffc857) },
|
|
304
|
+
{ id: "frontend", name: "Frontend", parentId: "dev" },
|
|
305
|
+
{ id: "backend", name: "Backend API", parentId: "dev" },
|
|
306
|
+
{ id: "integration", name: "Integration", parentId: "dev" },
|
|
307
|
+
{ id: "launch", name: "Launch" }
|
|
308
|
+
]);
|
|
309
|
+
|
|
310
|
+
// Task data (series) — ids must match category ids
|
|
311
|
+
chart.series.data.setAll([
|
|
312
|
+
{ id: "planning", start: new Date(2024, 0, 1).getTime(), duration: 5, progress: 100 },
|
|
313
|
+
{ id: "requirements", start: new Date(2024, 0, 1).getTime(), duration: 3, progress: 100 },
|
|
314
|
+
{ id: "architecture", start: new Date(2024, 0, 4).getTime(), duration: 2, progress: 100, linkTo: ["design"] },
|
|
315
|
+
{ id: "design", start: new Date(2024, 0, 8).getTime(), duration: 10, progress: 80 },
|
|
316
|
+
{ id: "wireframes", start: new Date(2024, 0, 8).getTime(), duration: 4, progress: 100 },
|
|
317
|
+
{ id: "visual", start: new Date(2024, 0, 14).getTime(), duration: 6, progress: 60, linkTo: ["dev"] },
|
|
318
|
+
{ id: "dev", start: new Date(2024, 0, 22).getTime(), duration: 25, progress: 40 },
|
|
319
|
+
{ id: "frontend", start: new Date(2024, 0, 22).getTime(), duration: 20, progress: 50 },
|
|
320
|
+
{ id: "backend", start: new Date(2024, 0, 22).getTime(), duration: 18, progress: 45 },
|
|
321
|
+
{ id: "integration", start: new Date(2024, 1, 15).getTime(), duration: 7, progress: 10, linkTo: ["launch"] },
|
|
322
|
+
{ id: "launch", start: new Date(2024, 2, 1).getTime(), duration: 0, progress: 0 }
|
|
323
|
+
]);
|
|
324
|
+
|
|
325
|
+
chart.appear(1000, 100);
|
|
326
|
+
</script>
|
|
327
|
+
</body>
|
|
328
|
+
</html>
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
## Example 2: Simulated Gantt with XY chart (no Gantt license needed)
|
|
332
|
+
|
|
333
|
+
```html
|
|
334
|
+
<!DOCTYPE html>
|
|
335
|
+
<html>
|
|
336
|
+
<head>
|
|
337
|
+
<meta charset="UTF-8">
|
|
338
|
+
<title>Simulated Gantt (XY)</title>
|
|
339
|
+
<script src="https://cdn.amcharts.com/lib/5/index.js"></script>
|
|
340
|
+
<script src="https://cdn.amcharts.com/lib/5/xy.js"></script>
|
|
341
|
+
<script src="https://cdn.amcharts.com/lib/5/themes/Animated.js"></script>
|
|
342
|
+
<style>
|
|
343
|
+
#chartdiv { width: 100%; height: 400px; }
|
|
344
|
+
</style>
|
|
345
|
+
</head>
|
|
346
|
+
<body>
|
|
347
|
+
<div id="chartdiv"></div>
|
|
348
|
+
<script>
|
|
349
|
+
var root = am5.Root.new("chartdiv");
|
|
350
|
+
root.setThemes([am5themes_Animated.new(root)]);
|
|
351
|
+
|
|
352
|
+
var chart = root.container.children.push(am5xy.XYChart.new(root, {
|
|
353
|
+
panX: false,
|
|
354
|
+
panY: false,
|
|
355
|
+
layout: root.verticalLayout
|
|
356
|
+
}));
|
|
357
|
+
|
|
358
|
+
var data = [
|
|
359
|
+
{ task: "Research", start: new Date(2024, 0, 1).getTime(), end: new Date(2024, 0, 12).getTime(), progress: 1 },
|
|
360
|
+
{ task: "Design", start: new Date(2024, 0, 8).getTime(), end: new Date(2024, 0, 22).getTime(), progress: 1 },
|
|
361
|
+
{ task: "Frontend", start: new Date(2024, 0, 15).getTime(), end: new Date(2024, 1, 10).getTime(), progress: 0.7 },
|
|
362
|
+
{ task: "Backend", start: new Date(2024, 0, 20).getTime(), end: new Date(2024, 1, 15).getTime(), progress: 0.5 },
|
|
363
|
+
{ task: "Testing", start: new Date(2024, 1, 5).getTime(), end: new Date(2024, 1, 20).getTime(), progress: 0.2 },
|
|
364
|
+
{ task: "Deployment", start: new Date(2024, 1, 18).getTime(), end: new Date(2024, 1, 25).getTime(), progress: 0 }
|
|
365
|
+
];
|
|
366
|
+
|
|
367
|
+
var yAxis = chart.yAxes.push(am5xy.CategoryAxis.new(root, {
|
|
368
|
+
categoryField: "task",
|
|
369
|
+
renderer: am5xy.AxisRendererY.new(root, { inversed: true, minGridDistance: 20 })
|
|
370
|
+
}));
|
|
371
|
+
|
|
372
|
+
var xAxis = chart.xAxes.push(am5xy.DateAxis.new(root, {
|
|
373
|
+
baseInterval: { timeUnit: "day", count: 1 },
|
|
374
|
+
renderer: am5xy.AxisRendererX.new(root, {})
|
|
375
|
+
}));
|
|
376
|
+
|
|
377
|
+
var series = chart.series.push(am5xy.ColumnSeries.new(root, {
|
|
378
|
+
xAxis: xAxis,
|
|
379
|
+
yAxis: yAxis,
|
|
380
|
+
openValueXField: "start",
|
|
381
|
+
valueXField: "end",
|
|
382
|
+
categoryYField: "task",
|
|
383
|
+
tooltip: am5.Tooltip.new(root, {
|
|
384
|
+
labelText: "{task}\n{openValueX.formatDate('MMM dd')} – {valueX.formatDate('MMM dd')}"
|
|
385
|
+
})
|
|
386
|
+
}));
|
|
387
|
+
|
|
388
|
+
series.columns.template.setAll({
|
|
389
|
+
height: am5.percent(60),
|
|
390
|
+
cornerRadiusBR: 4, cornerRadiusTR: 4,
|
|
391
|
+
cornerRadiusBL: 4, cornerRadiusTL: 4,
|
|
392
|
+
strokeOpacity: 0
|
|
393
|
+
});
|
|
394
|
+
|
|
395
|
+
series.columns.template.adapters.add("fill", function(fill, target) {
|
|
396
|
+
var p = target.dataItem.dataContext.progress;
|
|
397
|
+
if (p >= 1) return am5.color(0x4caf50);
|
|
398
|
+
if (p > 0) return am5.color(0xff9800);
|
|
399
|
+
return am5.color(0x2196f3);
|
|
400
|
+
});
|
|
401
|
+
|
|
402
|
+
yAxis.data.setAll(data);
|
|
403
|
+
series.data.setAll(data);
|
|
404
|
+
|
|
405
|
+
series.appear(1000);
|
|
406
|
+
chart.appear(1000, 100);
|
|
407
|
+
</script>
|
|
408
|
+
</body>
|
|
409
|
+
</html>
|
|
410
|
+
```
|