@@ -897,7 +897,7 @@ void chart_draw(int x1, int y1, int x2, int y2, var_num_t *vals, int count,
897897 var_num_t * xvals , int xcount , int chart , int marks ) {
898898 var_num_t lx , ly ;
899899 char buf [32 ];
900- int32_t color = 0 ;
900+ int32_t color = dev_fgcolor ;
901901 int rx1 = x1 ;
902902
903903 // ready
@@ -1052,6 +1052,7 @@ void chart_draw(int x1, int y1, int x2, int y2, var_num_t *vals, int count,
10521052 case 5 :
10531053 // line chart
10541054 // points
1055+ dev_settextcolor (color , 15 );
10551056 if (chart == 5 ) {
10561057 for (int i = 0 ; i < count ; i ++ ) {
10571058 dev_setpixel (pts [i * 2 ], pts [i * 2 + 1 ]);
@@ -1061,6 +1062,7 @@ void chart_draw(int x1, int y1, int x2, int y2, var_num_t *vals, int count,
10611062 dev_line (pts [(i - 1 ) * 2 ], pts [(i - 1 ) * 2 + 1 ], pts [i * 2 ], pts [i * 2 + 1 ]);
10621063 }
10631064 }
1065+ dev_settextcolor (0 , 15 );
10641066
10651067 // draw marks
10661068 if (marks & 0x1 ) {
@@ -1094,19 +1096,12 @@ void chart_draw(int x1, int y1, int x2, int y2, var_num_t *vals, int count,
10941096 // draw rect
10951097 color = 0 ;
10961098 for (int i = 1 ; i < count ; i ++ ) {
1097- if (os_color_depth > 2 ) {
1098- dev_setcolor (color );
1099- color ++ ;
1100- if (color >= 15 ) {
1101- color = 0 ;
1102- }
1103- }
1099+ dev_setcolor (color );
1100+ color = (color + 1 ) % 16 ;
11041101 dev_rect (pts [(i - 1 ) * 2 ], pts [(i - 1 ) * 2 + 1 ], pts [i * 2 ] - 2 , y2 , 1 );
11051102 }
11061103
1107- if (os_color_depth > 2 ) {
1108- dev_setcolor (color );
1109- }
1104+ dev_setcolor (color );
11101105 dev_rect (pts [(count - 1 ) * 2 ], pts [(count - 1 ) * 2 + 1 ],
11111106 pts [(count - 1 ) * 2 ] + lx - 1 , y2 , 1 );
11121107
@@ -1121,23 +1116,18 @@ void chart_draw(int x1, int y1, int x2, int y2, var_num_t *vals, int count,
11211116 int mx = pts [i * 2 ] + lx / 2 - fw / 2 ;
11221117 int my = pts [i * 2 + 1 ];
11231118
1124- if (os_color_depth > 2 ) {
1125- if (my - fh >= y1 ) {
1126- dev_settextcolor (0 , 15 );
1119+ if (my - fh >= y1 ) {
1120+ dev_settextcolor (0 , 15 );
1121+ } else {
1122+ if (color >= 7 && color != 8 ) {
1123+ dev_settextcolor (0 , color );
11271124 } else {
1128- if (color >= 7 && color != 8 ) {
1129- dev_settextcolor (0 , color );
1130- } else {
1131- dev_settextcolor (15 , color );
1132- }
1133- }
1134-
1135- color ++ ;
1136- if (color >= 15 ) {
1137- color = 0 ;
1125+ dev_settextcolor (15 , color );
11381126 }
11391127 }
11401128
1129+ color = (color + 1 ) % 16 ;
1130+
11411131 if (my - fh >= y1 ) {
11421132 my -= fh ;
11431133 }
0 commit comments