mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-19 14:25:20 +03:00
reorganizing update helpers
This commit is contained in:
parent
3421916c21
commit
3a5741d9ed
2 changed files with 19 additions and 21 deletions
|
@ -156,9 +156,18 @@ function tab_initialize_receiver() {
|
||||||
}
|
}
|
||||||
|
|
||||||
var samples = 0;
|
var samples = 0;
|
||||||
|
|
||||||
var svg = d3.select("svg");
|
var svg = d3.select("svg");
|
||||||
|
|
||||||
|
var width, height, widthScale, heightScale;
|
||||||
|
function update_receiver_plot_size() {
|
||||||
|
var margin = {top: 20, right: 20, bottom: 10, left: 40};
|
||||||
|
width = $('#RX_plot').width() - margin.left - margin.right;
|
||||||
|
height = $('#RX_plot').height() - margin.top - margin.bottom;
|
||||||
|
|
||||||
|
widthScale.range([0, width]);
|
||||||
|
heightScale.range([height, 0]);
|
||||||
|
}
|
||||||
|
|
||||||
function update_ui() {
|
function update_ui() {
|
||||||
meter_array[0].val(RC.throttle);
|
meter_array[0].val(RC.throttle);
|
||||||
meter_values_array[0].text('[ ' + RC.throttle + ' ]');
|
meter_values_array[0].text('[ ' + RC.throttle + ' ]');
|
||||||
|
@ -207,24 +216,14 @@ function tab_initialize_receiver() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// update required parts of the plot
|
// update required parts of the plot
|
||||||
var widthScale = d3.scale.linear().
|
widthScale = d3.scale.linear().
|
||||||
domain([(samples - 299), samples]);
|
domain([(samples - 299), samples]);
|
||||||
|
|
||||||
var heightScale = d3.scale.linear().
|
heightScale = d3.scale.linear().
|
||||||
domain([800, 2200]);
|
domain([800, 2200]);
|
||||||
|
|
||||||
var margin, width, height;
|
|
||||||
function update_receiver_plot_size() {
|
|
||||||
margin = {top: 20, right: 20, bottom: 10, left: 40};
|
|
||||||
width = $('#RX_plot').width() - margin.left - margin.right;
|
|
||||||
height = $('#RX_plot').height() - margin.top - margin.bottom;
|
|
||||||
widthScale.range([0, width]);
|
|
||||||
heightScale.range([height, 0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
update_receiver_plot_size();
|
update_receiver_plot_size();
|
||||||
|
|
||||||
|
|
||||||
var xGrid = d3.svg.axis().
|
var xGrid = d3.svg.axis().
|
||||||
scale(widthScale).
|
scale(widthScale).
|
||||||
orient("bottom").
|
orient("bottom").
|
||||||
|
|
|
@ -40,14 +40,13 @@ function tab_initialize_sensors() {
|
||||||
return sampleNumber + 1;
|
return sampleNumber + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
var margin, width, height;
|
|
||||||
function updateGraphHelperSize(selector, helpers) {
|
function updateGraphHelperSize(selector, helpers) {
|
||||||
margin = {top: 20, right: 20, bottom: 10, left: 40};
|
var margin = {top: 20, right: 20, bottom: 10, left: 40};
|
||||||
width = $(selector).width() - margin.left - margin.right;
|
helpers.width = $(selector).width() - margin.left - margin.right;
|
||||||
height = $(selector).height() - margin.top - margin.bottom;
|
helpers.height = $(selector).height() - margin.top - margin.bottom;
|
||||||
|
|
||||||
helpers.widthScale.range([0, width]);
|
helpers.widthScale.range([0, helpers.width]);
|
||||||
helpers.heightScale.range([height, 0]);
|
helpers.heightScale.range([helpers.height, 0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
function initGraphHelpers(selector, sampleNumber, heightDomain) {
|
function initGraphHelpers(selector, sampleNumber, heightDomain) {
|
||||||
|
@ -67,14 +66,14 @@ function tab_initialize_sensors() {
|
||||||
.scale(helpers.widthScale)
|
.scale(helpers.widthScale)
|
||||||
.orient("bottom")
|
.orient("bottom")
|
||||||
.ticks(5)
|
.ticks(5)
|
||||||
.tickSize(-height, 0, 0)
|
.tickSize(-helpers.height, 0, 0)
|
||||||
.tickFormat("");
|
.tickFormat("");
|
||||||
|
|
||||||
helpers.yGrid = d3.svg.axis()
|
helpers.yGrid = d3.svg.axis()
|
||||||
.scale(helpers.heightScale)
|
.scale(helpers.heightScale)
|
||||||
.orient("left")
|
.orient("left")
|
||||||
.ticks(5)
|
.ticks(5)
|
||||||
.tickSize(-width, 0, 0)
|
.tickSize(-helpers.width, 0, 0)
|
||||||
.tickFormat("");
|
.tickFormat("");
|
||||||
|
|
||||||
helpers.xAxis = d3.svg.axis()
|
helpers.xAxis = d3.svg.axis()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue