예제 #1
0
파일: xsspin.c 프로젝트: jhbadger/xlispstat
LVAL iview_spin_draw_axes(V)
{
  IVIEW_WINDOW w;
  int x, y, xorig, yorig, size, xend, yend, vars, i, unit;
  char *s;
  double **a;
  StGWWinInfo *gwinfo;
  LVAL object;
  
  object = xlgaobject();
  w = (IVIEW_WINDOW) GETIVIEWADDRESS(object);
  gwinfo = StGWObWinInfo(object);
  if (! IVIEW_WINDOW_NULL(w)) {
    StGrGetContentVariables(gwinfo, &x, &y);
    StGrGetContentOrigin(gwinfo, &xorig, &yorig);
    StGrGetContentRect(gwinfo, NULL, NULL, &size, NULL);
    vars = IViewNumVariables(w);
    a = IViewTransformation(w);

    unit = size / 2;
    for (i = 0; i < vars; i++) {
      xend = xorig + a[x][i] * AXIS_FRACTION * unit;
      yend = yorig - a[y][i] * AXIS_FRACTION * unit;
      StGWDrawLine(gwinfo, xorig, yorig, xend, yend);
      s = IViewVariableLabel(w, i);
      xend += LABEL_OFFSET;
      yend -= LABEL_OFFSET;
      StGWDrawString(gwinfo, s, xend, yend);
    }
  }
  return(NIL);
}
예제 #2
0
static LVAL base_variable_label(V)
{
  int var, set = FALSE;
  char *label = NULL;
  LVAL result;
  
  var = getfixnum(xlgafixnum());
  if (moreargs()) {
    set = TRUE;
    label = (char *) getstring(xlgastring());
  }
  xllastarg();
  
  if (set) IViewSetVariableLabel(wind, var, label);
  
  label = IViewVariableLabel(wind, var);
  if (label == NULL) result = cvstring("");
  else result = cvstring(label);
  
  return(result);
}
예제 #3
0
파일: xshist.c 프로젝트: jhbadger/xlispstat
LVAL iview_hist_adjust_to_data(V)
{
  LVAL object;
  IVIEW_WINDOW w;
  StGWWinInfo *gwinfo;
  double low, high;
  int ticks, labeled, x, y, scaled, bins;
  char *label;
  LVAL arg, hdata;
  
  gethistargs(&w, &object, &hdata);

  if (! IVIEW_WINDOW_NULL(w)) {
    gwinfo = StGWObWinInfo(object);
    StGrObAdjustToData(object, FALSE);
    scaled = (slot_value(object, s_scale_type) != NIL) ? TRUE : FALSE;
    
    StGrGetContentVariables(gwinfo, &x, &y);
    IViewGetRange(w, x, &low, &high);
    label = IViewVariableLabel(w, x);
    labeled = (label != NULL && strlen(label) != 0) ? TRUE : FALSE;
    ticks = 4;
    GetNiceRange(&low, &high, &ticks);
    IViewSetRange(w, x, low, high);
    IViewSetXaxis(w, ! scaled, labeled, ticks);
    bins = 5 + log(1.0 + IViewNumPoints(w));
    GetNiceRange(&low, &high, &bins);
    if (bins > 1) bins --;
    if (bins > 30) bins = 30;
    IViewHistSetNumBins(object, hdata, bins);

    if (! xlgetkeyarg(sk_draw, &arg)) arg = s_true;
    if (arg != NIL) send_message(object, sk_resize);
    if (arg != NIL) send_message(object, sk_redraw);  
  }
  return(NIL);
}
예제 #4
0
static LVAL base_variable_label()
{
  int var, set = FALSE;
  char *label;
  LVAL result;
  
  var = getfixnum(xlgafixnum());
  if (moreargs()) {
    set = TRUE;
    label = (char *) getstring(xlgastring());
  }
  xllastarg();
  
  if (set) IViewSetVariableLabel(wind, var, label);
  
  label = IViewVariableLabel(wind, var);
  if (label == nil) result = newstring(1);
  else {
    result = newstring(strlen(label) + 1);
    strcpy(getstring(result), label);
  }
  
  return(result);
}