X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Foutput%2Fcharts%2Fplot-chart.c;h=8a1dc0bd1fbed3f5f3943dc41adb69935b7fce8f;hb=f70f1b22e925d55c246372376de1c6ffaacf8a4b;hp=f965a6fed1aa746779f21960a6eaf15018bfa9f7;hpb=000e3e8c5818476c3afbc75fad9347aefb6e902a;p=pspp diff --git a/src/output/charts/plot-chart.c b/src/output/charts/plot-chart.c index f965a6fed1..8a1dc0bd1f 100644 --- a/src/output/charts/plot-chart.c +++ b/src/output/charts/plot-chart.c @@ -18,6 +18,7 @@ 02110-1301, USA. */ #include + #include #include #include @@ -27,13 +28,18 @@ #include #include -#include "chart-geometry.h" -#include "plot-chart.h" -#include "str.h" -#include "alloc.h" -#include "manager.h" -#include "output.h" -#include "plot-chart.h" +#include + +#include + + + +#include +#include +#include +#include +#include + const char *data_colour[] = { "brown", @@ -71,7 +77,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]; @@ -171,3 +177,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); +}