for parallel gencharts

This commit is contained in:
olli 2023-11-01 11:35:31 +01:00
parent 2b403cf1f2
commit 62eb075739

View File

@ -10,8 +10,10 @@ function genchart {
local colors=$4
[ -z "${colors}" ] && colors="White,Gold,Silver,Blue,DarkMagenta,DarkViolet,Indigo,MediumBlue,DarkOrchid,MidnightBlue,CornflowerBlue,CadetBlue,DarkCyan,DarkSlateBlue,DeepSkyBlue,DodgerBlue,Teal"
local f_tmp_data="${g_tmp}-data-$RANDOM"
local f_tmp_headline="${g_tmp}-headline-$RANDOM"
local f_tmp="${f_tmp}/$RANDOM"
local f_tmp_data="${f_tmp}-data"
local f_tmp_headline="${f_tmp}-headline"
mkdir -p ${f_tmp}/g_genchart
local awkfields=$(echo "${fields}" | sed 's/,/ \",\" \$/g; s/^/\$/')
#tail -n ${lastlines} "${file}" | cut -d, -f${fields} | egrep "^[-0-9]" >${f_tmp_data}
@ -42,7 +44,6 @@ function genchart {
local color="green"
tail -n1 ${f_tmp_data} | cut -d, -f1 | grep -q "^-" && color="red"
mkdir ${g_tmp}/g_genchart
local RND=$RANDOM
echo "<table id='noborder' width='100%'><tr><td id='noborder' width='100%'>"
echo "<div id='$RND'>"
@ -58,7 +59,7 @@ function genchart {
echo "<p class='legend'><font color='${color}'>${linename} (${linelastvalue})</font></p>"
else
echo "<p class='legend'><font color='${linecolor}'>${linename} (${linelastvalue})</font></p>"
fi >>${g_tmp}/g_genchart/legend
fi >>${f_tmp}/g_genchart/legend
local linenum=1
for line in $(cat ${f_tmp_data})
do
@ -73,7 +74,7 @@ function genchart {
echo "<td style='--color: ${color}; --start: calc( ${calcstart} ); --end: calc( ${calcend} );'> <span class='tooltip'> ${mark} </span> </td>"
else
echo "<td style='--color: ${linecolor}; --start: calc( ${calcstart} ); --end: calc( ${calcend} );'> </td>"
fi >>${g_tmp}/g_genchart/${linenum}
fi >>${f_tmp}/g_genchart/${linenum}
((linenum=linenum+1))
lastmark=${mark}
done
@ -84,7 +85,7 @@ function genchart {
for linenum in $(seq 2 ${lines})
do
echo "<tr>"
cat ${g_tmp}/g_genchart/${linenum}
cat ${f_tmp}/g_genchart/${linenum}
echo "</tr>"
done
echo "</table></div>"
@ -93,7 +94,7 @@ function genchart {
if grep -q ',' ${f_tmp_headline}
then
echo "<td id='noborder'>"
tac ${g_tmp}/g_genchart/legend
tac ${f_tmp}/g_genchart/legend
echo "</td>"
fi
@ -104,6 +105,6 @@ function genchart {
echo "</tr></table>"
rm -r ${g_tmp}/g_genchart
rm -r ${f_tmp}/g_genchart
}