X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Foutput%2Fcharts%2Fnp-plot.c;h=eeffbc1fa1d5f0cf3beae266974f1f95dd89bd25;hb=ab90a86a87d3f006fbb362907b1c41110a117a79;hp=ccccbeff36ae192b844a3f95b25aa6ca9c4b6534;hpb=81579d9e9f994fb2908f50af41c3eb033d216e58;p=pspp diff --git a/src/output/charts/np-plot.c b/src/output/charts/np-plot.c index ccccbeff36..eeffbc1fa1 100644 --- a/src/output/charts/np-plot.c +++ b/src/output/charts/np-plot.c @@ -23,21 +23,19 @@ #include "data/casereader.h" #include "libpspp/cast.h" #include "math/np.h" -#include "output/chart-item-provider.h" +#include "output/chart-provider.h" #include "gl/minmax.h" -static struct chart_item * +static struct chart * make_np_plot (const struct np *np, const struct casereader *reader, const char *label, bool detrended) { - struct np_plot_chart *npp; - - if (np->n < 1.0) + if (np->n <= 1.0) return NULL; - npp = xzalloc (sizeof *npp); - chart_item_init (&npp->chart_item, &np_plot_chart_class, label); + struct np_plot_chart *npp = XZALLOC (struct np_plot_chart); + chart_init (&npp->chart, &np_plot_chart_class, label); npp->data = casereader_clone (reader); npp->y_min = np->y_min; npp->y_max = np->y_max; @@ -58,7 +56,7 @@ make_np_plot (const struct np *np, const struct casereader *reader, npp->x_upper = MAX (np->y_max, (npp->y_last - npp->intercept) / npp->slope); npp->slack = (npp->x_upper - npp->x_lower) * 0.05; - return &npp->chart_item; + return &npp->chart; } /* Creates and returns a normal probability plot corresponding to @@ -69,7 +67,7 @@ make_np_plot (const struct np *np, const struct casereader *reader, Returns a null pointer if the data set is empty. The caller retains ownership of NP and READER. */ -struct chart_item * +struct chart * np_plot_create (const struct np *np, const struct casereader *reader, const char *label) { @@ -85,7 +83,7 @@ np_plot_create (const struct np *np, const struct casereader *reader, Returns a null pointer if the data set is empty. The caller retains ownership of NP and READER. */ -struct chart_item * +struct chart * dnp_plot_create (const struct np *np, const struct casereader *reader, const char *label) { @@ -93,14 +91,14 @@ dnp_plot_create (const struct np *np, const struct casereader *reader, } static void -np_plot_chart_destroy (struct chart_item *chart_item) +np_plot_chart_destroy (struct chart *chart) { - struct np_plot_chart *npp = to_np_plot_chart (chart_item); + struct np_plot_chart *npp = to_np_plot_chart (chart); casereader_destroy (npp->data); free (npp); } -const struct chart_item_class np_plot_chart_class = +const struct chart_class np_plot_chart_class = { np_plot_chart_destroy };