Rev 209 | Rev 223 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 209 | Rev 220 | ||
---|---|---|---|
Line 134... | Line 134... | ||
134 | h1[h1d]->id=H1D_ID; |
134 | h1[h1d]->id=H1D_ID; |
135 | h1[h1d]->nx = nx; |
135 | h1[h1d]->nx = nx; |
136 | 136 | ||
137 | 137 | ||
138 | h1[h1d]->minx = minx; |
138 | h1[h1d]->minx = minx; |
139 | h1[h1d]->stepx = (nx> |
139 | h1[h1d]->stepx = (nx>0)?(maxx-minx)/nx:0; |
140 | 140 | ||
141 | 141 | ||
142 | h1[h1d]->size = h1[h1d]->nx*sizeof(double); |
142 | h1[h1d]->size = h1[h1d]->nx*sizeof(double); |
143 | h1[h1d]->data = (double *) malloc(h1[h1d]->size); |
143 | h1[h1d]->data = (double *) malloc(h1[h1d]->size); |
144 | h1[h1d]->len=sizeof(H1D)-sizeof(double *)+h1[h1d]->size; |
144 | h1[h1d]->len=sizeof(H1D)-sizeof(double *)+h1[h1d]->size; |
Line 149... | Line 149... | ||
149 | 149 | ||
150 | } |
150 | } |
151 | 151 | ||
152 | 152 | ||
153 | double _VI_FUNC H1D_GetXBinCenter(int h1d,int xbin) { |
153 | double _VI_FUNC H1D_GetXBinCenter(int h1d,int xbin) { |
154 | return h1[h1d]->minx+xbin*h1[h1d]->stepx; |
154 | return h1[h1d]->minx+(xbin+0.5)*h1[h1d]->stepx; |
155 | } |
155 | } |
156 | 156 | ||
157 | 157 | ||
158 | int _VI_FUNC H1D_Write2File(int h1d,FILE *fp) { |
158 | int _VI_FUNC H1D_Write2File(int h1d,FILE *fp) { |
159 | 159 | ||
Line 231... | Line 231... | ||
231 | if (h1[h]) return h1[h]->minx; |
231 | if (h1[h]) return h1[h]->minx; |
232 | else return 0; |
232 | else return 0; |
233 | } |
233 | } |
234 | 234 | ||
235 | double _VI_FUNC H1D_GetMaxX(int h){ |
235 | double _VI_FUNC H1D_GetMaxX(int h){ |
236 | return h1[h]->minx+ |
236 | return h1[h]->minx+ h1[h]->nx-*h1[h]->stepx; |
237 | } |
237 | } |
238 | 238 | ||
239 | 239 | ||
240 | double _VI_FUNC H1D_GetStepX(int h) { |
240 | double _VI_FUNC H1D_GetStepX(int h) { |
241 | if (h1[h]) return h1[h]->stepx; |
241 | if (h1[h]) return h1[h]->stepx; |
Line 268... | Line 268... | ||
268 | 268 | ||
269 | #ifdef _CVI_ |
269 | #ifdef _CVI_ |
270 | if (*plothandle> 0 ) DeleteGraphPlot (panel, control, *plothandle, VAL_IMMEDIATE_DRAW); |
270 | if (*plothandle> 0 ) DeleteGraphPlot (panel, control, *plothandle, VAL_IMMEDIATE_DRAW); |
271 | 271 | ||
272 | *plothandle = PlotWaveform (panel, control, H1D_GetData(histogram), H1D_GetNbinsX(histogram), VAL_DOUBLE, 1, 0, |
272 | *plothandle = PlotWaveform (panel, control, H1D_GetData(histogram), H1D_GetNbinsX(histogram), VAL_DOUBLE, 1, 0, |
273 |
|
273 | H1D_GetXBinCenter(histogram,0), H1D_GetStepX(histogram), VAL_FAT_LINE, VAL_SMALL_SOLID_SQUARE, VAL_SOLID, 1, |
274 | hcolors[histogram%8]); |
274 | hcolors[histogram%8]); |
275 | RefreshGraph (panel, control); |
275 | RefreshGraph (panel, control); |
276 | ProcessSystemEvents (); |
276 | ProcessSystemEvents (); |
277 | #endif |
277 | #endif |
278 | 278 |