X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Foutput%2Fcharts%2Fnp-plot-cairo.c;h=ae866831f65d62ee34795d64048fb554d1bf6bee;hb=ff79bb95e5c3de40d359a60214ece51db8561d3e;hp=e9a1e07033fbf02296458fd8c69ab90004d8aaa6;hpb=0df9cdd3df66caf4353128feff3008289cda8115;p=pspp diff --git a/src/output/charts/np-plot-cairo.c b/src/output/charts/np-plot-cairo.c index e9a1e07033..ae866831f6 100644 --- a/src/output/charts/np-plot-cairo.c +++ b/src/output/charts/np-plot-cairo.c @@ -27,20 +27,23 @@ #define _(msgid) gettext (msgid) static void -np_plot_chart_draw (const struct chart_item *chart_item, cairo_t *cr, +np_plot_chart_draw (const struct chart *chart, cairo_t *cr, struct xrchart_geometry *geom) { - const struct np_plot_chart *npp = to_np_plot_chart (chart_item); + const struct np_plot_chart *npp = to_np_plot_chart (chart); struct casereader *data; struct ccase *c; - xrchart_write_title (cr, geom, _("Normal Q-Q Plot of %s"), chart_item->title); + xrchart_write_title (cr, geom, _("Normal Q-Q Plot of %s"), chart->title); xrchart_write_xlabel (cr, geom, _("Observed Value")); xrchart_write_ylabel (cr, geom, _("Expected Normal")); - xrchart_write_xscale (cr, geom, + if (! xrchart_write_xscale (cr, geom, npp->x_lower - npp->slack, - npp->x_upper + npp->slack); - xrchart_write_yscale (cr, geom, npp->y_first, npp->y_last); + npp->x_upper + npp->slack)) + return; + + if (! xrchart_write_yscale (cr, geom, npp->y_first, npp->y_last)) + return; data = casereader_clone (npp->data); for (; (c = casereader_read (data)) != NULL; case_unref (c)) @@ -54,18 +57,20 @@ np_plot_chart_draw (const struct chart_item *chart_item, cairo_t *cr, } static void -dnp_plot_chart_draw (const struct chart_item *chart_item, cairo_t *cr, +dnp_plot_chart_draw (const struct chart *chart, cairo_t *cr, struct xrchart_geometry *geom) { - const struct np_plot_chart *dnpp = to_np_plot_chart (chart_item); + const struct np_plot_chart *dnpp = to_np_plot_chart (chart); struct casereader *data; struct ccase *c; - xrchart_write_title (cr, geom, _("Detrended Normal Q-Q Plot of %s"), chart_item->title); + xrchart_write_title (cr, geom, _("Detrended Normal Q-Q Plot of %s"), chart->title); xrchart_write_xlabel (cr, geom, _("Observed Value")); xrchart_write_ylabel (cr, geom, _("Dev from Normal")); - xrchart_write_xscale (cr, geom, dnpp->y_min, dnpp->y_max); - xrchart_write_yscale (cr, geom, dnpp->dns_min, dnpp->dns_max); + if (! xrchart_write_xscale (cr, geom, dnpp->y_min, dnpp->y_max)) + return; + if (! xrchart_write_yscale (cr, geom, dnpp->dns_min, dnpp->dns_max)) + return; data = casereader_clone (dnpp->data); for (; (c = casereader_read (data)) != NULL; case_unref (c)) @@ -77,13 +82,13 @@ dnp_plot_chart_draw (const struct chart_item *chart_item, cairo_t *cr, } void -xrchart_draw_np_plot (const struct chart_item *chart_item, cairo_t *cr, +xrchart_draw_np_plot (const struct chart *chart, cairo_t *cr, struct xrchart_geometry *geom) { - const struct np_plot_chart *npp = to_np_plot_chart (chart_item); + const struct np_plot_chart *npp = to_np_plot_chart (chart); if (npp->detrended) - dnp_plot_chart_draw (chart_item, cr, geom); + dnp_plot_chart_draw (chart, cr, geom); else - np_plot_chart_draw (chart_item, cr, geom); + np_plot_chart_draw (chart, cr, geom); }