1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-24 16:55:36 +03:00

reorganizing update helpers

This commit is contained in:
cTn 2014-04-21 12:14:03 +02:00
parent 3421916c21
commit 3a5741d9ed
2 changed files with 19 additions and 21 deletions

View file

@ -156,9 +156,18 @@ function tab_initialize_receiver() {
}
var samples = 0;
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() {
meter_array[0].val(RC.throttle);
meter_values_array[0].text('[ ' + RC.throttle + ' ]');
@ -207,24 +216,14 @@ function tab_initialize_receiver() {
}
// update required parts of the plot
var widthScale = d3.scale.linear().
widthScale = d3.scale.linear().
domain([(samples - 299), samples]);
var heightScale = d3.scale.linear().
heightScale = d3.scale.linear().
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();
var xGrid = d3.svg.axis().
scale(widthScale).
orient("bottom").