Skip to content

Instantly share code, notes, and snippets.

@mckn
Created January 12, 2023 09:39
Show Gist options
  • Save mckn/a0721af1f9aaa7cb103bd4752cae1443 to your computer and use it in GitHub Desktop.
Save mckn/a0721af1f9aaa7cb103bd4752cae1443 to your computer and use it in GitHub Desktop.
{
"__inputs": [
{
"name": "DS_FUNNEL",
"label": "Funnel",
"description": "",
"type": "datasource",
"pluginId": "marcusolsson-static-datasource",
"pluginName": "Static"
}
],
"__elements": {},
"__requires": [
{
"type": "panel",
"id": "bilibala-echarts-panel",
"name": "Echarts",
"version": "2.2.4"
},
{
"type": "grafana",
"id": "grafana",
"name": "Grafana",
"version": "9.4.0-pre"
},
{
"type": "datasource",
"id": "marcusolsson-static-datasource",
"name": "Static",
"version": "2.1.0"
}
],
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": {
"type": "grafana",
"uid": "-- Grafana --"
},
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
"target": {
"limit": 100,
"matchAny": false,
"tags": [],
"type": "dashboard"
},
"type": "dashboard"
}
]
},
"editable": true,
"fiscalYearStartMonth": 0,
"graphTooltip": 0,
"id": null,
"links": [],
"liveNow": false,
"panels": [
{
"datasource": {
"type": "marcusolsson-static-datasource",
"uid": "${DS_FUNNEL}"
},
"gridPos": {
"h": 14,
"w": 9,
"x": 0,
"y": 0
},
"id": 2,
"options": {
"followTheme": false,
"getOption": "const series = data.series.reduce((result, s) => {\n const values = s.fields.find((f) => f.type === 'number').values.buffer;\n const labels = s.fields.find((f) => f.type === 'string').values.buffer;\n const data = labels.map((l, i) => ({ name: l, value: values[i] }));\n \n Array.prototype.push.apply(result.labels, labels);\n Array.prototype.push.apply(result.data, data);\n \n return result;\n}, { data: [], labels: [] });\n\nreturn {\n tooltip: {\n trigger: 'item',\n formatter: '{a} <br/>{b} : {c}%'\n },\n legend: {\n right: 10,\n bottom: 10,\n orient: 'vertical',\n textStyle: {\n color: theme.colors.text,\n },\n data: series.labels,\n },\n series: [\n {\n name: 'Funnel',\n type: 'funnel',\n top: 30,\n bottom: 60,\n width: '80%',\n min: 0,\n max: 100,\n minSize: '0%',\n maxSize: '100%',\n sort: 'descending',\n gap: 2,\n label: {\n show: true,\n position: 'inside'\n },\n labelLine: {\n length: 10,\n lineStyle: {\n width: 1,\n type: 'solid'\n }\n },\n itemStyle: {\n borderWidth: 0\n },\n emphasis: {\n label: {\n fontSize: 20\n }\n },\n data: series.data,\n }\n ]\n};"
},
"targets": [
{
"datasource": {
"type": "marcusolsson-static-datasource",
"uid": "${DS_FUNNEL}"
},
"frame": {
"fields": [
{
"config": {},
"name": "label",
"type": "string",
"values": [
"Show",
"Click",
"Visit",
"Inquiry",
"Order"
]
},
{
"config": {},
"name": "value",
"type": "number",
"values": [
100,
80,
60,
40,
20
]
}
],
"meta": {},
"name": "data"
},
"refId": "A"
}
],
"title": "Funnel",
"type": "bilibala-echarts-panel"
}
],
"revision": 1,
"schemaVersion": 37,
"style": "dark",
"tags": [],
"templating": {
"list": []
},
"time": {
"from": "now-6h",
"to": "now"
},
"timepicker": {},
"timezone": "",
"title": "Echart: Funnel",
"uid": "RijytL24z",
"version": 2,
"weekStart": ""
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment