Skip to content

Commit

Permalink
fix - added panel
Browse files Browse the repository at this point in the history
  • Loading branch information
vitPinchuk committed Feb 9, 2024
1 parent dfe02e4 commit 88bec4e
Showing 1 changed file with 45 additions and 4 deletions.
49 changes: 45 additions & 4 deletions echarts.volkovlabs.io/home.json
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,12 @@
"format": "auto",
"height": 600
},
"editorMode": "code",
"editorMode": "visual",
"gaode": {
"key": "",
"plugin": "AMap.Scale,AMap.ToolBar"
},
"getOption": "echartsInstance.on('click', (params) => {\n locationService.replace('/d/E9NLNnFVz/bar?orgId=1');\n});\n\nconst labelRight = {\n position: 'right'\n};\n\nreturn {\n grid: {\n bottom: \"3%\",\n containLabel: true,\n left: \"3%\",\n right: \"4%\",\n top: \"4%\",\n },\n tooltip: {\n trigger: 'axis',\n axisPointer: {\n type: 'shadow'\n }\n },\n xAxis: {\n type: 'value',\n position: 'top',\n splitLine: {\n lineStyle: {\n type: 'dashed'\n }\n }\n },\n yAxis: {\n type: 'category',\n axisLine: { show: false },\n axisLabel: { show: false },\n axisTick: { show: false },\n splitLine: { show: false },\n data: [\n 'ten',\n 'nine',\n 'eight',\n 'seven',\n 'six',\n 'five',\n 'four',\n 'three',\n 'two',\n 'one'\n ]\n },\n series: [\n {\n name: 'Cost',\n type: 'bar',\n stack: 'Total',\n label: {\n show: true,\n formatter: '{b}'\n },\n data: [\n { value: -0.07, label: labelRight },\n { value: -0.09, label: labelRight },\n 0.2,\n 0.44,\n { value: -0.23, label: labelRight },\n 0.08,\n { value: -0.17, label: labelRight },\n 0.47,\n { value: -0.36, label: labelRight },\n 0.18\n ]\n }\n ],\n graphic: [\n {\n type: 'group',\n rotation: Math.PI / 4,\n bounding: 'raw',\n right: 110,\n bottom: 110,\n z: 100,\n children: [\n {\n type: 'rect',\n left: 'center',\n top: 'center',\n z: 100,\n shape: {\n width: 400,\n height: 50\n },\n style: {\n fill: 'rgba(0,0,0,0.3)'\n }\n },\n {\n type: 'text',\n left: 'center',\n top: 'center',\n z: 100,\n style: {\n fill: '#fff',\n text: 'CLICK FOR MORE',\n font: 'bold 26px sans-serif'\n }\n }\n ]\n }]\n};",
"getOption": "echartsInstance.on('click', (params) => {\n locationService.replace('/d/E9NLNnFVz/bar?orgId=1');\n});\nlet values = data.series[0].fields.find(f => f.name === 'Value').values\nlet labels = data.series[0].fields.find(f => f.name === 'Label').values\n\nconst labelRight = {\n position: 'right'\n};\n\nreturn {\n grid: {\n bottom: \"3%\",\n containLabel: true,\n left: \"3%\",\n right: \"4%\",\n top: \"4%\",\n },\n tooltip: {\n trigger: 'axis',\n axisPointer: {\n type: 'shadow'\n }\n },\n xAxis: {\n type: 'value',\n position: 'top',\n splitLine: {\n lineStyle: {\n type: 'dashed'\n }\n }\n },\n yAxis: {\n type: 'category',\n axisLine: { show: false },\n axisLabel: { show: false },\n axisTick: { show: false },\n splitLine: { show: false },\n data: labels\n },\n series: [\n {\n name: 'Cost',\n type: 'bar',\n stack: 'Total',\n label: {\n show: true,\n formatter: '{b}'\n },\n data: values\n }\n ],\n graphic: [\n {\n type: 'group',\n rotation: Math.PI / 4,\n bounding: 'raw',\n right: 110,\n bottom: 110,\n z: 100,\n children: [\n {\n type: 'rect',\n left: 'center',\n top: 'center',\n z: 100,\n shape: {\n width: 400,\n height: 50\n },\n style: {\n fill: 'rgba(0,0,0,0.3)'\n }\n },\n {\n type: 'text',\n left: 'center',\n top: 'center',\n z: 100,\n style: {\n fill: '#fff',\n text: 'CLICK FOR MORE',\n font: 'bold 26px sans-serif'\n }\n }\n ]\n }]\n};",
"google": {
"callback": "gmapReady",
"key": ""
Expand All @@ -159,13 +159,54 @@
"name": "default"
},
"visualEditor": {
"code": "console.log(context);\nreturn {\n dataset: context.editor.dataset,\n series: context.editor.series,\n xAxis: {\n type: 'time',\n },\n yAxis: {\n type: 'value',\n min: 'dataMin',\n },\n}\n",
"code": "const labelRight = {\n position: 'right'\n};\n\nreturn {\n tooltip: {\n trigger: 'axis',\n axisPointer: {\n type: 'shadow'\n }\n },\n grid: {\n bottom: \"3%\",\n containLabel: true,\n left: \"3%\",\n right: \"4%\",\n top: \"4%\",\n },\n dataset: {\n source: context.editor.dataset.source\n },\n xAxis: {\n type: 'value',\n position: 'top',\n splitLine: {\n lineStyle: {\n type: 'dashed'\n }\n }\n },\n yAxis: {\n type: 'category',\n axisLine: { show: false },\n axisLabel: { show: false },\n axisTick: { show: false },\n splitLine: { show: false }\n },\n series: [\n {\n name: 'Cost',\n type: 'bar',\n stack: 'Total',\n label: {\n show: true,\n formatter: '{b}'\n },\n encode: {\n y: 'label',\n x: 'value'\n }\n }\n ],\n graphic: [\n {\n type: 'group',\n rotation: Math.PI / 4,\n bounding: 'raw',\n right: 110,\n bottom: 110,\n z: 100,\n children: [\n {\n type: 'rect',\n left: 'center',\n top: 'center',\n z: 100,\n shape: {\n width: 400,\n height: 50\n },\n style: {\n fill: 'rgba(0,0,0,0.3)'\n }\n },\n {\n type: 'text',\n left: 'center',\n top: 'center',\n z: 100,\n style: {\n fill: '#fff',\n text: 'CLICK FOR MORE',\n font: 'bold 26px sans-serif'\n }\n }\n ]\n }]\n};",
"codeHeight": 600,
"dataset": [],
"dataset": [
{
"name": "Value",
"source": "A"
},
{
"name": "Label",
"source": "A"
}
],
"series": []
}
},
"pluginVersion": "5.2.0",
"targets": [
{
"datasource": {
"type": "marcusolsson-static-datasource",
"uid": "4ytGZmF4k"
},
"frame": {
"fields": [
{
"config": {},
"name": "Value",
"type": "number",
"values": [0]
},
{
"config": {},
"name": "Label",
"type": "string",
"values": [""]
}
],
"meta": {
"custom": {
"customCode": "const result = {\n ...frame,\n fields: frame.fields.map((field) => {\n if (field.name === 'Value') {\n return ({\n ...field,\n values: [-0.07, -0.09, 0.2, 0.44, -0.23, 0.08, -0.17, 0.47, -0.36, 0.18]\n })\n }\n return ({\n ...field,\n values: ['ten', 'nine', 'eight', 'seeven', 'six', 'five', 'four', 'three', 'two', 'one']\n })\n }\n )\n}\n\nreturn Promise.resolve(result);",
"valuesEditor": "custom"
}
},
"name": "Bars"
},
"refId": "A"
}
],
"title": "Bar",
"type": "volkovlabs-echarts-panel"
},
Expand Down

0 comments on commit 88bec4e

Please sign in to comment.