Skip to content

Commit ac57074

Browse files
author
wtao
committed
update dashboard
1 parent 54c6380 commit ac57074

File tree

1 file changed

+183
-9
lines changed

1 file changed

+183
-9
lines changed

sample/dashboard.json

Lines changed: 183 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
"viz": false
4848
},
4949
"insertNulls": false,
50-
"lineInterpolation": "linear",
50+
"lineInterpolation": "smooth",
5151
"lineWidth": 1,
5252
"pointSize": 5,
5353
"scaleDistribution": {
@@ -68,8 +68,7 @@
6868
"mode": "absolute",
6969
"steps": [
7070
{
71-
"color": "green",
72-
"value": null
71+
"color": "red"
7372
},
7473
{
7574
"color": "red",
@@ -86,6 +85,98 @@
8685
"x": 0,
8786
"y": 0
8887
},
88+
"id": 3,
89+
"options": {
90+
"legend": {
91+
"calcs": [],
92+
"displayMode": "list",
93+
"placement": "bottom",
94+
"showLegend": true
95+
},
96+
"tooltip": {
97+
"mode": "single",
98+
"sort": "none"
99+
}
100+
},
101+
"pluginVersion": "10.4.2",
102+
"targets": [
103+
{
104+
"datasource": {
105+
"type": "mongodb-grafana-datasource",
106+
"uid": "fdkn0wi0apkw0c"
107+
},
108+
"queryText": "{\n collection: \"movies\",\n aggregations: [\n {\n $match: {\n released: {\n $gte: new Date($from),\n $lte: new Date($to),\n },\n },\n },\n {\n $group: {\n _id: {\n year: {\n $year: \"$released\",\n },\n month: {\n $month: \"$released\",\n },\n },\n __value: {\n $sum: 1,\n },\n },\n },\n {\n $addFields: {\n __name: { $literal: \"movies in month\" },\n __timestamp: {\n $dateFromString: {\n dateString: {\n $concat: [\n {\n $toString: \"$_id.year\",\n },\n \"-\",\n {\n $toString: {\n $cond: {\n if: {\n $lte: [\"$_id.month\", 9],\n },\n then: \"0\",\n else: \"\",\n },\n },\n },\n {\n $toString: \"$_id.month\",\n },\n \"-01\",\n ],\n },\n format: \"%Y-%m-%d\",\n },\n },\n },\n },\n {\n $sort: {\n __timestamp: 1,\n },\n },\n {\n $project: {\n _id: 0,\n },\n },\n ],\n}",
109+
"queryType": "timeserie",
110+
"refId": "A"
111+
}
112+
],
113+
"title": "Panel Title",
114+
"type": "timeseries"
115+
},
116+
{
117+
"datasource": {
118+
"type": "mongodb-grafana-datasource",
119+
"uid": "fdkn0wi0apkw0c"
120+
},
121+
"fieldConfig": {
122+
"defaults": {
123+
"color": {
124+
"mode": "palette-classic"
125+
},
126+
"custom": {
127+
"axisBorderShow": false,
128+
"axisCenteredZero": false,
129+
"axisColorMode": "text",
130+
"axisLabel": "",
131+
"axisPlacement": "auto",
132+
"barAlignment": 0,
133+
"drawStyle": "bars",
134+
"fillOpacity": 0,
135+
"gradientMode": "none",
136+
"hideFrom": {
137+
"legend": false,
138+
"tooltip": false,
139+
"viz": false
140+
},
141+
"insertNulls": false,
142+
"lineInterpolation": "smooth",
143+
"lineWidth": 2,
144+
"pointSize": 5,
145+
"scaleDistribution": {
146+
"type": "linear"
147+
},
148+
"showPoints": "auto",
149+
"spanNulls": false,
150+
"stacking": {
151+
"group": "A",
152+
"mode": "none"
153+
},
154+
"thresholdsStyle": {
155+
"mode": "off"
156+
}
157+
},
158+
"mappings": [],
159+
"thresholds": {
160+
"mode": "absolute",
161+
"steps": [
162+
{
163+
"color": "green"
164+
},
165+
{
166+
"color": "red",
167+
"value": 80
168+
}
169+
]
170+
}
171+
},
172+
"overrides": []
173+
},
174+
"gridPos": {
175+
"h": 11,
176+
"w": 12,
177+
"x": 12,
178+
"y": 0
179+
},
89180
"id": 2,
90181
"options": {
91182
"legend": {
@@ -108,11 +199,96 @@
108199
"queryText": "{\n collection: \"movies\",\n aggregations: [\n {\n $match: {\n released: {\n $gte: new Date($from),\n $lte: new Date($to),\n },\n },\n },\n {\n $group: {\n _id: {\n year: {\n $year: \"$released\",\n },\n month: {\n $month: \"$released\",\n },\n },\n __value: {\n $sum: 1,\n },\n },\n },\n {\n $addFields: {\n __name: { $literal: \"movies in month\" },\n __timestamp: {\n $dateFromString: {\n dateString: {\n $concat: [\n {\n $toString: \"$_id.year\",\n },\n \"-\",\n {\n $toString: {\n $cond: {\n if: {\n $lte: [\"$_id.month\", 9],\n },\n then: \"0\",\n else: \"\",\n },\n },\n },\n {\n $toString: \"$_id.month\",\n },\n \"-01\",\n ],\n },\n format: \"%Y-%m-%d\",\n },\n },\n },\n },\n {\n $sort: {\n __timestamp: 1,\n },\n },\n {\n $project: {\n _id: 0,\n },\n },\n ],\n}",
109200
"queryType": "timeserie",
110201
"refId": "A"
202+
},
203+
{
204+
"datasource": {
205+
"type": "mongodb-grafana-datasource",
206+
"uid": "fdkn0wi0apkw0c"
207+
},
208+
"hide": false,
209+
"queryText": "{\n \"collection\": \"movies\",\n \"aggregations\": [\n {\n \"$match\": {\n \"released\": {\n \"$gte\": $from,\n \"$lte\": $to\n },\n \"genres\": { \"$elemMatch\": { \"$eq\": \"Comedy\" } }\n }\n },\n {\n \"$group\": {\n \"_id\": {\n \"year\": { \"$year\": \"$released\" },\n \"month\": { \"$month\": \"$released\" }\n },\n \"__value\": { \"$sum\": 1 }\n }\n },\n {\n \"$addFields\": {\n \"__name\": { \"$literal\": \"genre\" },\n \"__timestamp\": {\n \"$dateFromString\": {\n \"dateString\": {\n \"$concat\": [\n { \"$toString\": \"$_id.year\" },\n \"-\",\n {\n \"$toString\": {\n \"$cond\": {\n \"if\": { \"$lte\": [\"$_id.month\", 9] },\n \"then\": \"0\",\n \"else\": \"\"\n }\n }\n },\n { \"$toString\": \"$_id.month\" },\n \"-01\"\n ]\n },\n \"format\": \"%Y-%m-%d\"\n }\n }\n }\n },\n {\n \"$sort\": { \"__timestamp\": 1 }\n },\n {\n \"$project\": { \"_id\": 0 }\n }\n ]\n}\n",
210+
"queryType": "timeserie",
211+
"refId": "B"
111212
}
112213
],
113214
"title": "Panel Title",
114215
"type": "timeseries"
115216
},
217+
{
218+
"datasource": {
219+
"type": "mongodb-grafana-datasource",
220+
"uid": "fdkn0wi0apkw0c"
221+
},
222+
"fieldConfig": {
223+
"defaults": {
224+
"color": {
225+
"mode": "palette-classic"
226+
},
227+
"custom": {
228+
"hideFrom": {
229+
"legend": false,
230+
"tooltip": false,
231+
"viz": false
232+
}
233+
},
234+
"mappings": []
235+
},
236+
"overrides": []
237+
},
238+
"gridPos": {
239+
"h": 11,
240+
"w": 12,
241+
"x": 0,
242+
"y": 8
243+
},
244+
"id": 5,
245+
"options": {
246+
"displayLabels": ["name"],
247+
"legend": {
248+
"displayMode": "list",
249+
"placement": "bottom",
250+
"showLegend": true
251+
},
252+
"pieType": "pie",
253+
"reduceOptions": {
254+
"calcs": ["lastNotNull"],
255+
"fields": "",
256+
"values": true
257+
},
258+
"tooltip": {
259+
"mode": "single",
260+
"sort": "none"
261+
}
262+
},
263+
"pluginVersion": "10.4.2",
264+
"targets": [
265+
{
266+
"datasource": {
267+
"type": "mongodb-grafana-datasource",
268+
"uid": "fdkn0wi0apkw0c"
269+
},
270+
"queryText": "{\n \"collection\": \"movies\",\n \"aggregations\": [\n {\n \"$unwind\": {\n \"path\": \"$genres\"\n }\n },\n {\n \"$project\": {\n \"genres\": 1\n }\n },\n {\n \"$group\": {\n \"_id\": \"$genres\",\n \"__value\": {\n \"$sum\": 1\n }\n }\n }\n ]\n}",
271+
"queryType": "table",
272+
"refId": "A"
273+
}
274+
],
275+
"title": "Panel Title",
276+
"transformations": [
277+
{
278+
"id": "convertFieldType",
279+
"options": {
280+
"conversions": [
281+
{
282+
"destinationType": "number",
283+
"targetField": "__value"
284+
}
285+
],
286+
"fields": {}
287+
}
288+
}
289+
],
290+
"type": "piechart"
291+
},
116292
{
117293
"datasource": {
118294
"type": "mongodb-grafana-datasource",
@@ -135,8 +311,7 @@
135311
"mode": "absolute",
136312
"steps": [
137313
{
138-
"color": "green",
139-
"value": null
314+
"color": "green"
140315
},
141316
{
142317
"color": "red",
@@ -150,8 +325,8 @@
150325
"gridPos": {
151326
"h": 8,
152327
"w": 12,
153-
"x": 0,
154-
"y": 8
328+
"x": 12,
329+
"y": 11
155330
},
156331
"id": 1,
157332
"options": {
@@ -180,7 +355,6 @@
180355
"type": "table"
181356
}
182357
],
183-
"refresh": "",
184358
"schemaVersion": 39,
185359
"tags": [],
186360
"templating": {
@@ -194,6 +368,6 @@
194368
"timezone": "browser",
195369
"title": "mflix",
196370
"uid": "bdkpj0btmpr7kc",
197-
"version": 9,
371+
"version": 19,
198372
"weekStart": ""
199373
}

0 commit comments

Comments
 (0)