X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Foutput%2Fcharts%2Fcartesian.c;h=c029b1bf9a68709eb6403167846e2a6a7be262a1;hb=f5c108becd49d78f4898cab11352291f5689d24e;hp=3f4c782b84a04359e0b89e737a32b2946f01604c;hpb=7eee0554f378481faf447e2d2e940f389d6b05ec;p=pspp-builds.git diff --git a/src/output/charts/cartesian.c b/src/output/charts/cartesian.c index 3f4c782b..c029b1bf 100644 --- a/src/output/charts/cartesian.c +++ b/src/output/charts/cartesian.c @@ -39,7 +39,7 @@ struct dataset #define DATASETS 2 -static const struct dataset dataset[DATASETS] = +static const struct dataset dataset[DATASETS] = { { 13, "male"}, { 11, "female"}, @@ -50,41 +50,41 @@ static const struct dataset dataset[DATASETS] = void chart_datum(struct chart *ch, int dataset UNUSED, double x, double y) { - if ( ! ch ) + if ( ! ch ) return ; { - const double x_pos = - (x - ch->x_min) * ch->abscissa_scale + ch->data_left ; + const double x_pos = + (x - ch->x_min) * ch->abscissa_scale + ch->data_left ; - const double y_pos = + const double y_pos = (y - ch->y_min) * ch->ordinate_scale + ch->data_bottom ; - pl_savestate_r(ch->lp); - + pl_savestate_r(ch->lp); + pl_fmarker_r(ch->lp, x_pos, y_pos, 6, 15); - pl_restorestate_r(ch->lp); + pl_restorestate_r(ch->lp); } } /* Draw a line with slope SLOPE and intercept INTERCEPT. between the points limit1 and limit2. - If lim_dim is CHART_DIM_Y then the limit{1,2} are on the + If lim_dim is CHART_DIM_Y then the limit{1,2} are on the y axis otherwise the x axis */ void -chart_line(struct chart *ch, double slope, double intercept, +chart_line(struct chart *ch, double slope, double intercept, double limit1, double limit2, enum CHART_DIM lim_dim) { double x1, y1; double x2, y2 ; - if ( ! ch ) + if ( ! ch ) return ; - if ( lim_dim == CHART_DIM_Y ) + if ( lim_dim == CHART_DIM_Y ) { x1 = ( limit1 - intercept ) / slope ; x2 = ( limit2 - intercept ) / slope ; @@ -104,10 +104,10 @@ chart_line(struct chart *ch, double slope, double intercept, x1 = (x1 - ch->x_min) * ch->abscissa_scale + ch->data_left ; x2 = (x2 - ch->x_min) * ch->abscissa_scale + ch->data_left ; - pl_savestate_r(ch->lp); + pl_savestate_r(ch->lp); pl_fline_r(ch->lp, x1, y1, x2, y2); - pl_restorestate_r(ch->lp); - + pl_restorestate_r(ch->lp); + }