00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 #ifndef _CPLOT_H_
00039 #define _CPLOT_H_
00040
00041 #ifdef __cplusplus
00042 extern "C"
00043 {
00044 #endif
00045
00046 typedef int BOOL;
00047
00048 #ifndef FALSE
00049 #define FALSE (0)
00050 #endif
00051 #ifndef TRUE
00052 #define TRUE (1)
00053 #endif
00054
00055
00056 typedef enum
00057 {
00058 CPLOT_WHITE = 0,
00059 CPLOT_BLACK = 1,
00060 CPLOT_BLUE = 2,
00061 CPLOT_GREEN = 3,
00062 CPLOT_PURPLE = 4,
00063 CPLOT_MAGENTA = 5,
00064 CPLOT_DARKBLUE = 6,
00065 CPLOT_INDIANRED = 7,
00066 CPLOT_BABYBLUE = 8,
00067 CPLOT_PAISLYBLUE = 9,
00068 CPLOT_LIGHTPURPLE = 10,
00069 CPLOT_DARKPURPLE = 11,
00070 CPLOT_GREYPURPLE = 12,
00071 CPLOT_BROWN = 13,
00072 CPLOT_RED = 14,
00073 CPLOT_PINK = 15,
00074 CPLOT_YELLOW = 16,
00075 CPLOT_ORANGE = 17,
00076 CPLOT_CYAN = 18,
00077 CPLOT_LIMEGREEN = 19,
00078 CPLOT_GREY = 20,
00079 CPLOT_LIGHTGREY = 21
00080 } CPLOT_enumColor;
00081
00082
00083
00084 typedef struct
00085 {
00086 BOOL doNotUseDefault;
00087 double val;
00088 } CPLOT_structAxisSubOption;
00089
00090
00091 typedef struct
00092 {
00093 char* label;
00094 CPLOT_structAxisSubOption lowerlimit;
00095 CPLOT_structAxisSubOption upperlimit;
00096 CPLOT_structAxisSubOption tickstart;
00097 CPLOT_structAxisSubOption ticksize;
00098 CPLOT_structAxisSubOption tickend;
00099 BOOL isGridOn;
00100
00101 }CPLOT_structAxisOptions;
00102
00103
00104
00105 typedef struct
00106 {
00107 int numberOfSeries;
00108 int PlotSize_Width_cm;
00109 int PlotSize_Height_cm;
00110 char* title;
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128 char* y_label_right;
00129 double y_label_right_scale_factor;
00130 double y_label_right_bias;
00131 CPLOT_enumColor RightYLabelColor;
00132
00133 CPLOT_structAxisOptions x;
00134 CPLOT_structAxisOptions y;
00135
00136
00137
00138
00139
00140
00141
00142
00143 BOOL useGPSLabel;
00144 int UTCOffset;
00145
00146 BOOL plotStatistics;
00147
00148 BOOL plotLabelOnRight;
00149
00150 CPLOT_enumColor figureBackgroundColor;
00151
00152 double endOfWarmupEpoch;
00153
00154 BOOL redrawAxes;
00155
00156 }CPLOT_structPlotOptions;
00157
00158
00159
00160
00161
00162
00163
00164
00165 typedef struct
00166 {
00167 int Width;
00168 int Height;
00169 } CPLOT_structImageSizeInPixels;
00170
00171
00172 typedef struct CPLOT_structAxes
00173 {
00174 int StartX;
00175 int StartY;
00176 int FinishX;
00177 int FinishY;
00178 int Width;
00179 int Height;
00180 int TickDashInPixels;
00181 } CPLOT_structAxes;
00182
00183
00184 typedef struct
00185 {
00186 double min;
00187 double max;
00188 double mean;
00189 double stdev;
00190 double rms;
00191 double range;
00192 } CPLOT_structStats;
00193
00194
00195 typedef struct
00196 {
00197 double *X;
00198 double *Y;
00199 int n;
00200
00201 CPLOT_structStats xStats;
00202 CPLOT_structStats yStats;
00203
00204 BOOL connected;
00205 CPLOT_enumColor color;
00206 char* label;
00207 char* units;
00208 int precision;
00209 BOOL markOutlierData;
00210
00211 }CPLOT_structSeries;
00212
00213
00214
00215 typedef struct
00216 {
00217 unsigned char Blue;
00218 unsigned char Green;
00219 unsigned char Red;
00220 unsigned char Reserved;
00221 } CPLOT_structRGB;
00222
00223
00224
00225 typedef struct
00226 {
00227 double xtickstart;
00228 double xtickend;
00229 double xticksize;
00230 double ytickstart;
00231 double ytickend;
00232 double yticksize;
00233 double RangeX;
00234 double RangeY;
00235 double OnePercentRangeX;
00236 double OnePercentRangeY;
00237 double ScaleX;
00238 double ScaleY;
00239 double MinX;
00240 double MaxX;
00241 double MinY;
00242 double MaxY;
00243 } CPLOT_structInfoInDataUnits;
00244
00245
00246 typedef struct
00247 {
00248 CPLOT_structRGB White;
00249 CPLOT_structRGB Black;
00250 CPLOT_structRGB Blue;
00251 CPLOT_structRGB Green;
00252 CPLOT_structRGB Purple;
00253 CPLOT_structRGB Magenta;
00254 CPLOT_structRGB DarkBlue;
00255 CPLOT_structRGB IndianRed;
00256 CPLOT_structRGB BabyBlue;
00257 CPLOT_structRGB PaislyBlue;
00258 CPLOT_structRGB LightPurple;
00259 CPLOT_structRGB DarkPurple;
00260 CPLOT_structRGB GreyPurple;
00261 CPLOT_structRGB Brown;
00262 CPLOT_structRGB Red;
00263 CPLOT_structRGB Pink;
00264 CPLOT_structRGB Yellow;
00265 CPLOT_structRGB Orange;
00266 CPLOT_structRGB Cyan;
00267 CPLOT_structRGB LimeGreen;
00268 CPLOT_structRGB Grey;
00269 CPLOT_structRGB LightGrey;
00270
00271 }CPLOT_structColorTable;
00272
00273
00274
00275 typedef struct
00276 {
00277 unsigned nrows;
00278 unsigned ncols;
00279 unsigned char **data;
00280
00281 } CPLOT_structByteMatrix;
00282
00283
00284
00285 typedef struct
00286 {
00287 BOOL mIsAxesDrawn;
00288 int mSeriesIndex;
00289 int mFootNoteIndex;
00290
00291 int mLabelWidth;
00292 int mStatsValueHeight;
00293 int mYLabelAllowance;
00294 int mRightYLabelAllowance;
00295 int mTitleAllowance;
00296 int mXLabelAllowance;
00297
00298 CPLOT_structImageSizeInPixels mImage;
00299
00300 CPLOT_structAxes mAxes;
00301
00302 CPLOT_structInfoInDataUnits mData;
00303
00304 CPLOT_structPlotOptions mOptions;
00305
00306
00307 CPLOT_structColorTable mDefaultColorTable;
00308 BOOL mUseDefaultColorTable;
00309 unsigned char* mColorTable;
00310
00311 CPLOT_structByteMatrix mPlotData;
00312
00313 } CPLOT;
00314
00315
00316
00317
00318 BOOL CPLOT_PlotOptionsInit( CPLOT_structPlotOptions *Opt );
00319
00320
00321
00322
00323 BOOL CPLOT_Init( CPLOT* P );
00324
00325
00326
00327 BOOL CPLOT_SetPlotOptions(
00328 CPLOT *P,
00329 CPLOT_structPlotOptions *opt
00330 );
00331
00332
00333
00334
00335 BOOL CPLOT_Plot(
00336 CPLOT *P,
00337 CPLOT_structSeries *Series
00338 );
00339
00340
00341
00342
00343 BOOL CPLOT_SaveToFile(
00344 CPLOT *P,
00345 const char *FileName
00346 );
00347
00348
00349 BOOL CPLOT_IsNAN( double value );
00350 BOOL CPLOT_IsPostiveINF( double value );
00351 BOOL CPLOT_IsNegativeINF( double value );
00352
00353 #ifdef __cplusplus
00354 }
00355 #endif
00356
00357
00358 #endif // _CPLOT_H_
00359
00360
00361
00362
00363