Spark graph functions
This commit is contained in:
parent
ccf33e2a26
commit
0857cdbfe4
22
spark.cc
Normal file
22
spark.cc
Normal file
@ -0,0 +1,22 @@
|
||||
#include <string>
|
||||
#include <cstring>
|
||||
|
||||
#include "spark.h"
|
||||
|
||||
char getSparkByPrecentage(unsigned value) {
|
||||
char ticks = " ▁▂▃▄▅▆▇█9";
|
||||
|
||||
unsigned tickVal = (float(value) / 10);
|
||||
|
||||
return ticks[tickVal];
|
||||
}
|
||||
|
||||
|
||||
char getSparkByValue(unsigned value, unsigned max) {
|
||||
char ticks = " ▁▂▃▄▅▆▇█9";
|
||||
|
||||
unsigned tickVal = (float(value) / float(max) * 10);
|
||||
|
||||
return ticks[tickVal];
|
||||
}
|
||||
|
7
spark.h
Normal file
7
spark.h
Normal file
@ -0,0 +1,7 @@
|
||||
#ifndef SPARK_H_
|
||||
#define SPARK_H_
|
||||
|
||||
char * getSparkByPrecentage(unsigned);
|
||||
char * getSparkByValue(unsigned, unsigned);
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user