X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Foutput%2Fcharts%2Fplot-chart.c;h=3f5619fef9a0631e6037b64522e0975ffbb16127;hb=470affdb48180aebfa764941bbdb353062978444;hp=6b91045273122af627eeba060f163d3a90cc1283;hpb=a19b858e0ac3c69e4a28c0ca6d8674427268a863;p=pspp diff --git a/src/output/charts/plot-chart.c b/src/output/charts/plot-chart.c index 6b91045273..3f5619fef9 100644 --- a/src/output/charts/plot-chart.c +++ b/src/output/charts/plot-chart.c @@ -1,6 +1,5 @@ /* PSPP - computes sample statistics. Copyright (C) 2004 Free Software Foundation, Inc. - Written by John Darrington This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -28,7 +27,6 @@ #include #include -#include #include #include @@ -37,11 +35,12 @@ #include #include +#include #include #include -const char *data_colour[] = { +const char *const data_colour[] = { "brown", "red", "orange", @@ -77,7 +76,7 @@ draw_tick(struct chart *chart, else if (orientation == TICK_ORDINATE ) pl_flinerel_r(chart->lp, 0, position, -tickSize, position); else - assert(0); + NOT_REACHED (); if ( label ) { char buf[10]; @@ -177,3 +176,38 @@ chart_write_yscale(struct chart *ch, double smin, double smax, int ticks) (y - ch->y_min) * ch->ordinate_scale, "%g", y); } } + + +/* Write the abscissa label */ +void +chart_write_xlabel(struct chart *ch, const char *label) +{ + if ( ! ch ) + return ; + + pl_savestate_r(ch->lp); + + pl_move_r(ch->lp,ch->data_left, ch->abscissa_top); + pl_alabel_r(ch->lp,0,'t',label); + + pl_restorestate_r(ch->lp); + +} + + + +/* Write the ordinate label */ +void +chart_write_ylabel(struct chart *ch, const char *label) +{ + if ( ! ch ) + return ; + + pl_savestate_r(ch->lp); + + pl_move_r(ch->lp, ch->data_bottom, ch->ordinate_right); + pl_textangle_r(ch->lp, 90); + pl_alabel_r(ch->lp, 0, 0, label); + + pl_restorestate_r(ch->lp); +}