** This is part of the CTSim program
** Copyright (C) 1983-2000 Kevin Rosenberg
**
-** $Id: ezplot.cpp,v 1.15 2000/09/09 09:31:12 kevin Exp $
+** $Id: ezplot.cpp,v 1.16 2000/12/06 01:46:43 kevin Exp $
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License (version 2) as
void
EZPlot::addCurve (const double *y, int n)
{
- double x [n];
+ double* x = new double [n];
for (int i = 0; i < n; i++)
x[i] = i;
addCurve (x, y, n);
+ delete x;
}
void
EZPlot::addCurve (const float *y, int n)
{
- double yDouble [n];
+ double* yDouble = new double [n];
for (int i = 0; i < n; i++)
yDouble[i] = y[i];
addCurve (yDouble, n);
+ delete yDouble;
}
void
EZPlot::addCurve (const float x[], const double y[], int num)
{
- double dx [num];
+ double* dx = new double [num];
for (int i = 0; i < num; i++)
dx[i] = x[i];
addCurve (dx, y, num);
+ delete dx;
}
void
EZPlot::addCurve (const double x[], const float y[], int num)
{
- double dy [num];
+ double* dy = new double [num];
for (int i = 0; i < num; i++)
dy[i] = y[i];
addCurve (x, dy, num);
+
+ delete dy;
}
// calculate legend box boundaries
int max_leg = 0; // longest legend in characters
int num_leg = 0; // number of legend titles
- for (EZPlotCurveConstIterator iterCurve = m_vecCurves.begin(); iterCurve != m_vecCurves.end(); iterCurve++) {
- const EZPlotCurve& curve = **iterCurve;
+ for (EZPlotCurveConstIterator iterCurve2 = m_vecCurves.begin(); iterCurve2 != m_vecCurves.end(); iterCurve2++) {
+ const EZPlotCurve& curve = **iterCurve2;
int nLegend = curve.m_sLegend.length();
if (nLegend > 0) {
++num_leg;
- max_leg = max (max_leg, nLegend);
+ if (nLegend > max_leg)\r
+ nLegend = max_leg;
}
}
double symwidth = charwidth;
double symheight = charheight;
- for (EZPlotCurveIterator iterCurve = m_vecCurves.begin(); iterCurve != m_vecCurves.end(); iterCurve++) {
- const EZPlotCurve& curve = **iterCurve;
+ for (EZPlotCurveIterator iterCurve3 = m_vecCurves.begin(); iterCurve3 != m_vecCurves.end(); iterCurve3++) {
+ const EZPlotCurve& curve = **iterCurve3;
rSGP.setColor (curve.m_iColor);
double delta = (maxval - minval) / nint;
double absmin = fabs(minval);
- double absmax = fabs(maxval);
- double logt = log10( max(absmin, absmax) );
+ double absmax = fabs(maxval);\r
+ if (absmin > absmax)\r
+ absmax = absmin;
+ double logt = log10( absmax );
if (fabs(logt) >= 6) { // use exponential format
if (fabs(logt) > 99)