try to calculated the height etc in the same way on progressbar and graph
some issue is still there (anyway). When there are e.g. 5 horizontal bars the width of that progressbar (multiply of 5 or similar) may won't be the same like a graph. So some tweaking on the graphs' height is necessary then.
This commit is contained in:
parent
b1b2b48a4c
commit
d1e216936c
|
@ -99,12 +99,14 @@ graph_draw(Widget *widget, DrawCtx *ctx, int offset,
|
|||
if(!widget->user_supplied_y)
|
||||
widget->area.y = 0;
|
||||
|
||||
margin_top = (int) ((widget->statusbar->height * (1 - d->height)) / 2 + 0.5 + widget->area.y);
|
||||
left_offset = widget->area.x + d->padding_left;
|
||||
|
||||
/* box = the graph inside the rectangle */
|
||||
if(!(d->box_height))
|
||||
d->box_height = (int) (widget->statusbar->height * d->height + 0.5) - 2;
|
||||
|
||||
margin_top = (int)((widget->statusbar->height - (d->box_height + 2)) / 2 + 0.5) + widget->area.y;
|
||||
|
||||
rectangle.x = left_offset;
|
||||
rectangle.y = margin_top;
|
||||
rectangle.width = d->size + 2;
|
||||
|
|
|
@ -75,15 +75,15 @@ progressbar_draw(Widget *widget, DrawCtx *ctx, int offset,
|
|||
d->width,
|
||||
offset,
|
||||
widget->alignment);
|
||||
|
||||
if(!widget->user_supplied_y)
|
||||
widget->area.y = 0;
|
||||
|
||||
/* TODO: maybe prevent (use Data-values) to calculate that stuff below over and over again */
|
||||
/* data for the first rectangle (data-bar) to draw */
|
||||
if(d->vertical)
|
||||
{
|
||||
pb_width = (int) ((d->width - d->padding - (d->gap * (d->data_items - 1))) / d->data_items + 0.5);
|
||||
pb_height = (int) (widget->statusbar->height * d->height);
|
||||
pb_height = (int) (widget->statusbar->height * d->height + 0.5);
|
||||
pb_y = widget->area.y + (int)((widget->statusbar->height - pb_height) / 2 + 0.5);
|
||||
}
|
||||
else /* horizontal */
|
||||
|
|
Loading…
Reference in New Issue