1 /* 2 * $Id: oleo_plot.h,v 1.10 2000/08/10 21:02:51 danny Exp $ 3 * 4 * Copyright � 1998-1999 Free Software Foundation, Inc. 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2, or (at your option) 9 * any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this software; see the file COPYING. If not, write to 18 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 19 */ 20 21 #ifndef _OLEO_PLOT_H_ 22 #define _OLEO_PLOT_H_ 23 24 #include "line.h" 25 26 /* Define the devices that we can generate plots for. */ 27 enum graph_device { 28 GRAPH_NONE, 29 GRAPH_POSTSCRIPT, 30 GRAPH_TEK, 31 GRAPH_X, 32 GRAPH_X_MONO, /* ??? */ 33 GRAPH_PNG, 34 GRAPH_GIF, 35 GRAPH_METAFILE, 36 GRAPH_ILLUSTRATOR, 37 GRAPH_FIG, 38 GRAPH_PCL, 39 GRAPH_HPGL, 40 GRAPH_REGIS, 41 GRAPH_PNM, 42 GRAPH_SVG, 43 GRAPH_CGM, 44 }; 45 46 enum graph_type { 47 GRAPH_XY, 48 GRAPH_PIE, 49 GRAPH_BAR, 50 }; 51 52 enum graph_style { 53 GRAPH_STYLE_DEFAULT, 54 GRAPH_STYLE_LINES, 55 GRAPH_STYLE_MARKS, 56 GRAPH_STYLE_BOTH, 57 GRAPH_STYLE_NONE /* to hide ?? */ 58 }; 59 60 struct PlotutilsDevices { 61 enum graph_type t; 62 char *pus; /* plotutils string */ 63 char *ext; /* filename suffix */ 64 char *desc; /* description */ 65 }; 66 extern struct PlotutilsDevices PlotutilsDeviceArray[]; 67 68 /* 69 * The public functions in plot.c should all have the same signature, 70 * as indicated in the typedef PuFunction. 71 */ 72 typedef void (*PuFunction)(char *, FILE *); 73 74 /* 75 * The first argument is the PlotUtils plotter (can be one of several character 76 * strings such as "ps"; see the Plotutils documentation). 77 * 78 * The second argument, if relevant, is a standard file pointer which has 79 * already been opened for writing. 80 */ 81 void PuPieChart(char *plotter, FILE *outfile); 82 void PuBarChart(char *plotter, FILE *outfile); 83 void PuXYChart(char *plotter, FILE *outfile); 84 85 void PlotInit(void); 86 void PuPlot(enum graph_type gt, enum graph_device gd, FILE *fp); 87 88 struct PlotGlobalType { 89 double XYMin[graph_num_axis], XYMax[graph_num_axis]; 90 int XYAuto[graph_num_axis]; 91 int LineToOffscreen; 92 int img_width, img_height; 93 struct line graph_axis_title[graph_num_axis]; 94 struct line graph_rng_lo [graph_num_axis]; 95 struct line graph_rng_hi [graph_num_axis]; 96 int graph_logness [graph_num_axis]; /* set logarithmic */ 97 /* The ranges (if any) of the symbolic names 98 * for integer coordinates starting at 0. 99 * If none, these will have lr == NON_ROW. 100 */ 101 struct rng graph_axis_symbols [graph_num_axis]; 102 enum graph_ordering graph_axis_ordering [graph_num_axis]; 103 104 /* Names to print along the axes */ 105 struct rng graph_axis_labels [graph_num_axis]; 106 107 /* plot .... with %s */ 108 struct line graph_style[NUM_DATASETS]; 109 struct line graph_title[NUM_DATASETS]; 110 struct rng graph_data[NUM_DATASETS]; 111 112 /* SciPlot */ 113 int ticktype[graph_num_axis]; 114 char *tickformat[graph_num_axis]; 115 116 /* Plotutils */ 117 enum graph_device device; 118 enum graph_type graph_type; 119 char *output_file; 120 char *dashdot[NUM_DATASETS]; 121 enum graph_style style[NUM_DATASETS]; 122 }; 123 124 #define XYxMin Global->PlotGlobal->XYMin[0] 125 #define XYxMax Global->PlotGlobal->XYMax[0] 126 #define XYyMin Global->PlotGlobal->XYMin[1] 127 #define XYyMax Global->PlotGlobal->XYMax[1] 128 #define XYxAuto Global->PlotGlobal->XYAuto[0] 129 #define XYyAuto Global->PlotGlobal->XYAuto[1] 130 131 /* Defaults */ 132 #define PLOT_WINDOW_WIDTH 600 133 #define PLOT_WINDOW_HEIGHT 600 134 135 #endif /* _OLEO_PLOT_H_ */ 136