fix ticks to be even hours/mins/secs on graph

pull/146/head
jbruce 2022-11-15 10:46:00 -05:00
rodzic 30716f3bb5
commit bfde2e0421
2 zmienionych plików z 57 dodań i 15 usunięć

Wyświetl plik

@ -107,7 +107,7 @@ sim_R_ho_air = 0.05 # K/W " with internal air circulation
temp_scale = "f" # c = Celsius | f = Fahrenheit - Unit to display
time_scale_slope = "h" # s = Seconds | m = Minutes | h = Hours - Slope displayed in temp_scale per time_scale_slope
time_scale_profile = "m" # s = Seconds | m = Minutes | h = Hours - Enter and view target time in time_scale_profile
time_scale_profile = "h" # s = Seconds | m = Minutes | h = Hours - Enter and view target time in time_scale_profile
# emergency shutoff the profile if this temp is reached or exceeded.
# This just shuts off the profile. If your SSR is working, your kiln will

Wyświetl plik

@ -188,23 +188,51 @@ function hazardTemp(){
}
}
function timeTickFormatter(val)
{
if (val < 1800)
function timeTickFormatter(val,axis)
{
console.log(val)
// hours
if(axis.max>3600) {
//var hours = Math.floor(val / (3600));
//return hours;
return Math.floor(val/3600);
}
// minutes
if(axis.max<=3600) {
return Math.floor(val/60);
}
// seconds
if(axis.max<=60) {
return val;
}
else
{
var hours = Math.floor(val / (3600));
var div_min = val % (3600);
var minutes = Math.floor(div_min / 60);
if (hours < 10) {hours = "0"+hours;}
if (minutes < 10) {minutes = "0"+minutes;}
return hours+":"+minutes;
}
//var div_min = val % (3600);
//var minutes = Math.floor(div_min / 60);
//if(val < 60) { return "0:00:" + ("00"+val).slice(-3);}
//if(val > 60 and val < 3600) { return "0:
// if (val < 1800)
// {
// return val;
// }
// else
// {
// var hours = Math.floor(val / (3600));
// var div_min = val % (3600);
// var minutes = Math.floor(div_min / 60);
// if (hours < 10) {hours = "0"+hours;}
// if (minutes < 10) {minutes = "0"+minutes;}
//return hours+":"+minutes;
// return hours+":00";
// }
}
function runTask()
@ -366,6 +394,19 @@ function saveProfile()
leaveEditMode();
}
function get_tick_size() {
switch(time_scale_profile){
case "s":
return 1;
case "m":
return 60;
case "h":
return 3600;
}
return 3600;
}
function getOptions()
{
@ -395,6 +436,7 @@ function getOptions()
min: 0,
tickColor: 'rgba(216, 211, 197, 0.2)',
tickFormatter: timeTickFormatter,
tickSize: get_tick_size(),
font:
{
size: 14,