Use CSS to size plots instead of absolute position
This will make things a lot easier to resize and track. Absolute
positions are tough on other elements. Have the plot fill the whole
containing element.
Change-Id: I9463c86a723e257bf8c9b083b1a8dcc31a544604
Signed-off-by: Austin Schuh <austin.linux@gmail.com>
Signed-off-by: James Kuszmaul <jabukuszmaul@gmail.com>
diff --git a/frc971/analysis/in_process_plotter.cc b/frc971/analysis/in_process_plotter.cc
index c7a715a..0eaf719 100644
--- a/frc971/analysis/in_process_plotter.cc
+++ b/frc971/analysis/in_process_plotter.cc
@@ -25,6 +25,9 @@
color_wheel_.push_back(Color(1, 1, 0));
color_wheel_.push_back(Color(0, 1, 1));
color_wheel_.push_back(Color(1, 0, 1));
+ color_wheel_.push_back(Color(1, 0.6, 0));
+ color_wheel_.push_back(Color(0.6, 0.3, 0));
+ color_wheel_.push_back(Color(1, 1, 1));
}
void Plotter::Spin() { event_loop_factory_.Run(); }
diff --git a/frc971/analysis/plot_data_utils.ts b/frc971/analysis/plot_data_utils.ts
index def34ed..5d1f4a0 100644
--- a/frc971/analysis/plot_data_utils.ts
+++ b/frc971/analysis/plot_data_utils.ts
@@ -29,9 +29,6 @@
plotSelect.add(new Option('Select Plot', invalidSelectValue));
const plotDiv = document.createElement('div');
- plotDiv.style.position = 'absolute';
- plotDiv.style.top = '30';
- plotDiv.style.left = '0';
parentDiv.appendChild(plotDiv);
conn.addReliableHandler(
@@ -50,12 +47,11 @@
for (let ii = 0; ii < plotFb.figuresLength(); ++ii) {
const figure = plotFb.figures(ii);
const figureDiv = document.createElement('div');
- figureDiv.style.top = figure.position().top().toString();
- figureDiv.style.left = figure.position().left().toString();
- figureDiv.style.position = 'absolute';
+ figureDiv.style.width = figure.position().width().toString() + "px";
+ figureDiv.style.height = figure.position().height().toString() + "px";
+ figureDiv.style.position = 'relative';
div.appendChild(figureDiv);
- const plot = new Plot(
- figureDiv, figure.position().width(), figure.position().height());
+ const plot = new Plot(figureDiv);
if (figure.title()) {
plot.getAxisLabels().setTitle(figure.title());