Commit 9ebb7c0d authored by Arnaud Blanchard's avatar Arnaud Blanchard
Browse files

Improve float graphs

parent 7ff821fd
......@@ -447,7 +447,6 @@ void blc_array::fprint_tsv(FILE *file){
FREE(tmp_dims);
}
void blc_array::update_with_tsv_file(char const *filename){
FILE *file;
char const *ext;
......@@ -538,8 +537,6 @@ void blc_array::save_tsv_file(char const *filename){
fclose(file);
}
void blc_array::fprint_surface_uchars(FILE *file, int ansi_terminal){
blc_fprint_3Darray(file, this->uchars, this->size, 0, 1, 1, dims[0].step, dims[0].length, dims[1].step, dims[1].length, ansi_terminal);
}
......
......@@ -186,7 +186,7 @@ void blc_mems_fprint_graph_floats(blc_mem *const*mems, int mems_nb, FILE *file,
size_t i, total_size = 0;
float range;
int ordinate_name_length, ordinate_name_position;
int j, graph_id;
int j, graph_id, percent;
float threhold, threhold1;
char c;
char vertical_arrow[] = "^|";
......@@ -226,7 +226,9 @@ void blc_mems_fprint_graph_floats(blc_mem *const*mems, int mems_nb, FILE *file,
value = mems[graph_id]->floats[i];
if (value - min > threhold1) fprintf(file, " []");
else if (value - min >= threhold) {
fprintf(file, " %.2d", (int)(99 * (value - min) / range));
percent=99 * (value - min) / range;
if (percent >= 100) percent=99;
fprintf(file, " %.2d", percent);
}
else fprintf(file, " ");
}
......
......@@ -300,8 +300,7 @@ void blc_fprint_3Darray(FILE *file, uchar *data, size_t size, int offset, int st
if (!ansi_texts) {
ansi_texts = MANY_ALLOCATIONS(256*3, char);
lookup_bar_colors = MANY_ALLOCATIONS(256, char);
FOR(i, 256)
{
FOR(i, 256){
sprintf(tmp_string, "%.3d ", i);
memcpy(ansi_texts+i*3, tmp_string, 3);
lookup_bar_colors[i] = blc_bar_colors[i*BLC_BAR_COLORS_NB/256];
......@@ -323,13 +322,11 @@ void blc_fprint_3Darray(FILE *file, uchar *data, size_t size, int offset, int st
if (color_id != previous_color_id){
console_buffer.chars[console_size++]=27; //ESC
console_buffer.chars[console_size++]='[';
if (color_id & BLC_BRIGHT)
{
if (color_id & BLC_BRIGHT){
console_buffer.chars[console_size++]='9';
console_buffer.chars[console_size++]=color_id+40;
}
else
{
else{
console_buffer.chars[console_size++]='3';
console_buffer.chars[console_size++]=color_id+48;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment