Skip to content

Commit

Permalink
Fix provisioning dashboards
Browse files Browse the repository at this point in the history
  • Loading branch information
asimonok committed Mar 22, 2024
1 parent af2e9eb commit 8c409ed
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion provisioning/dashboards/e2e.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"key": "",
"plugin": "AMap.Scale,AMap.ToolBar"
},
"getOption": "let names = [];\nlet amounts = [];\ndata.series.map((s) => {\n names = s.fields.find((f) => f.name === 'Name').values;\n amounts = s.fields.find((f) => f.name === 'Amount').values;\n});\n\nreturn {\n grid: {\n bottom: \"3%\",\n containLabel: true,\n left: \"3%\",\n right: \"4%\",\n top: \"4%\",\n },\n tooltip: {},\n legend: {\n data: [replaceVariables('$var')]\n },\n xAxis: {\n data: names\n },\n yAxis: {},\n toolbox: { feature: { restore: {} } },\n series: [\n {\n name: replaceVariables('$var'),\n type: 'bar',\n data: amounts\n }\n ]\n};\n",
"getOption": "let names = [];\nlet amounts = [];\ncontext.panel.data.series.map((s) => {\n names = s.fields.find((f) => f.name === 'Name').values;\n amounts = s.fields.find((f) => f.name === 'Amount').values;\n});\n\nreturn {\n grid: {\n bottom: \"3%\",\n containLabel: true,\n left: \"3%\",\n right: \"4%\",\n top: \"4%\",\n },\n tooltip: {},\n legend: {\n data: [context.grafana.replaceVariables('$var')]\n },\n xAxis: {\n data: names\n },\n yAxis: {},\n toolbox: { feature: { restore: {} } },\n series: [\n {\n name: context.grafana.replaceVariables('$var'),\n type: 'bar',\n data: amounts\n }\n ]\n};\n",
"google": {
"callback": "gmapReady",
"key": ""
Expand Down
6 changes: 3 additions & 3 deletions provisioning/dashboards/streaming.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"key": "",
"plugin": "AMap.Scale,AMap.ToolBar"
},
"getOption": "const series = data.series.map((s) => {\n const sData = s.fields.find((f) => f.type === 'number').values.buffer || s.fields.find((f) => f.type === 'number').values;\n const sTime = s.fields.find((f) => f.type === 'time').values.buffer || s.fields.find((f) => f.type === 'time').values;\n\n return {\n name: s.refId,\n type: 'line',\n name: 'Live',\n showSymbol: false,\n areaStyle: {\n opacity: 0.1,\n },\n lineStyle: {\n width: 1,\n },\n data: sData.map((d, i) => [sTime[i], d.toFixed(2)]),\n };\n});\n\nreturn {\n backgroundColor: 'transparent',\n tooltip: {\n trigger: 'axis',\n },\n legend: {\n left: '0',\n bottom: '0',\n textStyle: {\n color: 'rgba(128, 128, 128, .9)',\n },\n },\n xAxis: {\n type: 'time',\n },\n yAxis: {\n type: 'value',\n min: 'dataMin',\n },\n grid: {\n left: '2%',\n right: '2%',\n top: '2%',\n bottom: 24,\n containLabel: true,\n },\n series,\n};",
"getOption": "const series = context.panel.data.series.map((s) => {\n const sData = s.fields.find((f) => f.type === 'number').values.buffer || s.fields.find((f) => f.type === 'number').values;\n const sTime = s.fields.find((f) => f.type === 'time').values.buffer || s.fields.find((f) => f.type === 'time').values;\n\n return {\n name: s.refId,\n type: 'line',\n name: 'Live',\n showSymbol: false,\n areaStyle: {\n opacity: 0.1,\n },\n lineStyle: {\n width: 1,\n },\n data: sData.map((d, i) => [sTime[i], d.toFixed(2)]),\n };\n});\n\nreturn {\n backgroundColor: 'transparent',\n tooltip: {\n trigger: 'axis',\n },\n legend: {\n left: '0',\n bottom: '0',\n textStyle: {\n color: 'rgba(128, 128, 128, .9)',\n },\n },\n xAxis: {\n type: 'time',\n },\n yAxis: {\n type: 'value',\n min: 'dataMin',\n },\n grid: {\n left: '2%',\n right: '2%',\n top: '2%',\n bottom: 24,\n containLabel: true,\n },\n series,\n};",
"google": {
"callback": "gmapReady",
"key": ""
Expand Down Expand Up @@ -109,7 +109,7 @@
"key": "",
"plugin": "AMap.Scale,AMap.ToolBar"
},
"getOption": "let sData = []\nconst series = data.series.map((s) => {\n sData = s.fields.find((f) => f.type === 'number').values.buffer || s.fields.find((f) => f.type === 'number').values;\n});\n\nreturn {\n version: 2,\n config: { notMerge: true },\n option: {\n tooltip: {\n formatter: '{a} <br/>{b} : {c}%'\n },\n series: [\n {\n name: 'Pressure',\n type: 'gauge',\n detail: {\n formatter: '{value}'\n },\n data: [\n {\n value: Math.round(sData[sData.length - 1] * 100) / 100,\n name: 'SCORE'\n }\n ]\n }\n ]\n },\n unsubscribe: () => {\n console.log('unsubscribeFunction')\n }\n};",
"getOption": "let sData = []\nconst series = context.panel.data.series.map((s) => {\n sData = s.fields.find((f) => f.type === 'number').values.buffer || s.fields.find((f) => f.type === 'number').values;\n});\n\nreturn {\n version: 2,\n config: { notMerge: true },\n option: {\n tooltip: {\n formatter: '{a} <br/>{b} : {c}%'\n },\n series: [\n {\n name: 'Pressure',\n type: 'gauge',\n detail: {\n formatter: '{value}'\n },\n data: [\n {\n value: Math.round(sData[sData.length - 1] * 100) / 100,\n name: 'SCORE'\n }\n ]\n }\n ]\n },\n unsubscribe: () => {\n console.log('unsubscribeFunction')\n }\n};",
"google": {
"callback": "gmapReady",
"key": ""
Expand Down Expand Up @@ -165,7 +165,7 @@
"key": "",
"plugin": "AMap.Scale,AMap.ToolBar"
},
"getOption": "const values = {}\nconst series = data.series.map((s) => {\n names = s.fields.find((f) => f.name === 'name').values.buffer || s.fields.find((f) => f.name === 'name').values;\n amounts = s.fields.find((f) => f.name === 'amount').values.buffer || s.fields.find((f) => f.name === 'amount').values;\n\n names.forEach((d, i) => values[d] = amounts[i]);\n});\n\nreturn {\n grid: {\n bottom: \"3%\",\n containLabel: true,\n left: \"3%\",\n right: \"4%\",\n top: \"4%\",\n },\n animation: false,\n tooltip: {},\n xAxis: {\n data: Object.keys(values)\n },\n yAxis: {},\n series: [\n {\n name: 'Streaming',\n type: 'bar',\n data: Object.values(values)\n }\n ]\n};\n",
"getOption": "const values = {}\nconst series = context.panel.data.series.map((s) => {\n names = s.fields.find((f) => f.name === 'name').values.buffer || s.fields.find((f) => f.name === 'name').values;\n amounts = s.fields.find((f) => f.name === 'amount').values.buffer || s.fields.find((f) => f.name === 'amount').values;\n\n names.forEach((d, i) => values[d] = amounts[i]);\n});\n\nreturn {\n grid: {\n bottom: \"3%\",\n containLabel: true,\n left: \"3%\",\n right: \"4%\",\n top: \"4%\",\n },\n animation: false,\n tooltip: {},\n xAxis: {\n data: Object.keys(values)\n },\n yAxis: {},\n series: [\n {\n name: 'Streaming',\n type: 'bar',\n data: Object.values(values)\n }\n ]\n};\n",
"google": {
"callback": "gmapReady",
"key": ""
Expand Down

0 comments on commit 8c409ed

Please sign in to comment.