Make a separate webpage for the C++ plotter
We no longer need to select it! And we lose the wasted space up top.
Change-Id: I66f2915bda0ff21f8a01e64788a63796548f5ccc
Signed-off-by: Austin Schuh <austin.linux@gmail.com>
diff --git a/frc971/analysis/BUILD b/frc971/analysis/BUILD
index 934921b..2d71410 100644
--- a/frc971/analysis/BUILD
+++ b/frc971/analysis/BUILD
@@ -37,7 +37,6 @@
srcs = ["plot_index.ts"],
target_compatible_with = ["@platforms//os:linux"],
deps = [
- ":plot_data_utils",
"//aos:configuration_ts_fbs",
"//aos/network/www:demo_plot",
"//aos/network/www:proxy",
@@ -146,7 +145,7 @@
hdrs = ["in_process_plotter.h"],
data = [
":plotter",
- ":plotter_files",
+ "//frc971/analysis/cpp_plot:cpp_plot_files",
],
deps = [
":plot_data_fbs",
diff --git a/frc971/analysis/cpp_plot/BUILD b/frc971/analysis/cpp_plot/BUILD
new file mode 100644
index 0000000..156594c
--- /dev/null
+++ b/frc971/analysis/cpp_plot/BUILD
@@ -0,0 +1,32 @@
+load("@npm//@bazel/typescript:index.bzl", "ts_library")
+load("//tools/build_rules:js.bzl", "rollup_bundle")
+
+package(default_visibility = ["//visibility:public"])
+
+ts_library(
+ name = "cpp_plot",
+ srcs = ["cpp_plot.ts"],
+ target_compatible_with = ["@platforms//os:linux"],
+ deps = [
+ "//aos:configuration_ts_fbs",
+ "//aos/network/www:proxy",
+ "//frc971/analysis:plot_data_utils",
+ ],
+)
+
+rollup_bundle(
+ name = "cpp_plot_bundle",
+ entry_point = "cpp_plot.ts",
+ target_compatible_with = ["@platforms//os:linux"],
+ deps = [
+ ":cpp_plot",
+ ],
+)
+
+filegroup(
+ name = "cpp_plot_files",
+ srcs = [
+ "cpp_plot_bundle.min.js",
+ "index.html",
+ ],
+)
diff --git a/frc971/analysis/cpp_plot/cpp_plot.ts b/frc971/analysis/cpp_plot/cpp_plot.ts
new file mode 100644
index 0000000..ffbd485
--- /dev/null
+++ b/frc971/analysis/cpp_plot/cpp_plot.ts
@@ -0,0 +1,15 @@
+// Plotter for the C++ in-process plotter.
+import {Configuration} from 'org_frc971/aos/configuration_generated';
+import {Connection} from 'org_frc971/aos/network/www/proxy';
+import {plotData} from 'org_frc971/frc971/analysis/plot_data_utils';
+
+const rootDiv = document.createElement('div');
+rootDiv.style.width = '100%';
+document.body.appendChild(rootDiv);
+
+const conn = new Connection();
+conn.connect();
+
+conn.addConfigHandler((config: Configuration) => {
+ plotData(conn, rootDiv);
+});
diff --git a/frc971/analysis/cpp_plot/index.html b/frc971/analysis/cpp_plot/index.html
new file mode 100644
index 0000000..776c103
--- /dev/null
+++ b/frc971/analysis/cpp_plot/index.html
@@ -0,0 +1,8 @@
+<html>
+ <head>
+ <script src="cpp_plot_bundle.min.js" defer></script>
+ </head>
+ <body>
+ </body>
+</html>
+
diff --git a/frc971/analysis/in_process_plotter.cc b/frc971/analysis/in_process_plotter.cc
index f345ebc..585c933 100644
--- a/frc971/analysis/in_process_plotter.cc
+++ b/frc971/analysis/in_process_plotter.cc
@@ -6,7 +6,7 @@
namespace analysis {
namespace {
-const char *kDataPath = "frc971/analysis";
+const char *kDataPath = "frc971/analysis/cpp_plot";
const char *kConfigPath = "frc971/analysis/plotter.json";
} // namespace
diff --git a/frc971/analysis/plot_index.ts b/frc971/analysis/plot_index.ts
index 27a3ab7..af9bd73 100644
--- a/frc971/analysis/plot_index.ts
+++ b/frc971/analysis/plot_index.ts
@@ -55,7 +55,6 @@
import {plotVision as plot2022Vision} from
'org_frc971/y2022/vision/vision_plotter'
import {plotDemo} from 'org_frc971/aos/network/www/demo_plot';
-import {plotData} from 'org_frc971/frc971/analysis/plot_data_utils';
const rootDiv = document.createElement('div');
rootDiv.style.width = '100%';
@@ -126,7 +125,6 @@
['2022 Intake Back', new PlotState(plotDiv, plot2022IntakeBack)],
['2022 Climber', new PlotState(plotDiv, plot2022Climber)],
['2022 Turret', new PlotState(plotDiv, plot2022Turret)],
- ['C++ Plotter', new PlotState(plotDiv, plotData)],
['Y2021 3rd Robot Superstructure', new PlotState(plotDiv, plot2021Superstructure)],
]);