+typedef void (*cairo_draw_func)(cairo_t *cr, double x, double y);
+
+static struct ScreenPoint to_screen(BVChartPrivate *priv,
+ GtkAllocation *allocation,
+ struct BVChartPoint *p) {
+ int margin = 3;
+ float xscale = (allocation->width - 2 * margin) / (priv->maxx - priv->minx);
+ float yscale = (allocation->height - 2 * margin) / (priv->miny - priv->maxy);
+ struct ScreenPoint screen_p = {
+ .x = xscale * (p->x - priv->minx) + margin,
+ .y = yscale * (p->y - priv->maxy) + margin,
+ };
+ return screen_p;
+}
+