From 1990749b4aed17dd09cb54591f5e2f917d62728d Mon Sep 17 00:00:00 2001 From: fehrlich Date: Wed, 11 Aug 2021 12:50:24 +0200 Subject: [PATCH] add domain for plotly --- playground/src/demo.editable.json | 4 ++++ .../src/visualizers/plotly-visualizer/index.tsx | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/playground/src/demo.editable.json b/playground/src/demo.editable.json index f16911c..7323a14 100644 --- a/playground/src/demo.editable.json +++ b/playground/src/demo.editable.json @@ -12,6 +12,10 @@ "dataSrc": "{\r\n \"kind\":{ \"plotly\": true },\r\n \"data\": [{\r\n \"header\": {\r\n \"values\": [\"H1\", \"H2\", \"H3\"]\r\n },\r\n \"cells\": {\r\n \"values\": [\r\n [\"A\", \"B\", \"C\"],\r\n [341319, 281489, 294786],\r\n [4488916, 3918072, 3892124]\r\n ]\r\n },\r\n \"type\": \"table\"\r\n }],\r\n \"layout\": {}\r\n}", "name": "Plotly Table Visualizer" }, + { + "dataSrc": "{\n \"kind\": {\n \"plotly\": true\n },\n \"data\": [{\n \"mode\": \"lines\",\n \"type\": \"scatter\",\n \"x\": [\"A\", \"B\", \"C\"],\n \"xaxis\": \"x\",\n \"y\": [4488916, 3918072, 3892124],\n \"yaxis\": \"y\"\n }, {\n \"cells\": {\n \"values\": [\n [\"A\", \"B\", \"C\"],\n [341319, 281489, 294786],\n [4488916, 3918072, 3892124]\n ]\n },\n \"domain\": {\n \"x\": [0.0, 1.0],\n \"y\": [0.0, 0.60]\n },\n \"header\": {\n \"align\": \"left\",\n \"font\": {\n \"size\": 10\n },\n \"values\": [\"Date\", \"Number\", \"Output\"]\n },\n \"type\": \"table\"\n }],\n \"layout\": {\n \"xaxis\": {\n \"anchor\": \"y\",\n \"domain\": [0.0, 1.0]\n },\n \"yaxis\": {\n \"anchor\": \"x\",\n \"domain\": [0.75, 1.0]\n }\n }\n}", + "name": "Plotly multi Visualizer" + }, { "dataSrc": "{\r\n \"kind\": { \"graph\": true },\r\n \"nodes\": [\r\n { \"id\": \"1\", \"label\": \"1\" },\r\n { \"id\": \"2\", \"label\": \"2\", \"color\": \"orange\" },\r\n { \"id\": \"3\", \"label\": \"3\" }\r\n ],\r\n \"edges\": [\r\n { \"from\": \"1\", \"to\": \"2\", \"color\": \"red\" },\r\n { \"from\": \"1\", \"to\": \"3\" }\r\n ]\r\n}", "name": "VisJS Graph Visualizer" diff --git a/visualization-bundle/src/visualizers/plotly-visualizer/index.tsx b/visualization-bundle/src/visualizers/plotly-visualizer/index.tsx index 5686ae6..4b0f3b2 100644 --- a/visualization-bundle/src/visualizers/plotly-visualizer/index.tsx +++ b/visualization-bundle/src/visualizers/plotly-visualizer/index.tsx @@ -51,6 +51,10 @@ export const plotlyVisualizer = createVisualizer({ header: sOptionalProp(sOpenObject({ values: sDatumArr, })), + domain: sOptionalProp(sOpenObject({ + x: sArrayOf(sNumber()), + y: sArrayOf(sNumber()), + })), type: sOptionalProp( sUnion([ sLiteral("bar"),