Here I'm including my code for Draw; and it's clear there's something about the graphics context I don't understand.
The Chart output should show SQUARES proportional to data, and colored either RED or GREEN at Y axis 90 or -90 but, as you can see, I get only the first -90 yAxis uses for ALL, and only GREEN used for ALL.
To possibly account for IMMUTABILITY of objects, I've created Arrays where each is created fresh for each data point; and that doesn't work either, to get the desired behavior.
Posting the Draw code, where I'm sure you'll find problem(s):
protected override void Draw(RenderContext context) {
// verified, if (DRAW_PRINT) parentForm.getStrategy().ninjaPrint2(" ...calling Draw");
if (_seriesIndex < 0) {
parentForm.getStrategy().ninjaPrint2(" Draw seriesIndex not provided ! ");
return;
}
if (_myPlot == null) {
parentForm.getStrategy().ninjaPrint2(" Draw Plot reference not provided ! ");
return;
}
Axis xAxis = context.GetXAxis();
Axis yAxis = context.GetYAxis();
// we can determine whether a data point falls within the visible Axes
// _myPlot is the "component" we will use for the visibility testing
int posCount = 0; // ensuring we get both positive and negative values, verified
int negCount = 0;
int pointCount = mySeries.doubleDateTimestampList.Count;
// creating arrays of possibly immutable objects, for testing ??
PointF[] myPoints = new PointF[pointCount];
RectangleF[] rects = new RectangleF[pointCount];
Brush[] brushes = new Brush[pointCount];
for (int i = 0; i < pointCount; i++) { // all are same length
double _X = mySeries.GetValue(i, TIMESTAMP_DIMENSION); // x axis realtime timestamp
double _Y = mySeries.GetValue(i, YVALUE_DIMENSION); // y axis "price'
float d = (float)(mySeries.GetValue(i, DATA3D_DIMENSION) * 5); // the 3rd dimension size/color square
Color c = Color.Gray; // overwritten
if (d < 0) {
_Y = 90; // we are overriding the Y value to be either +90 or -90 temporarily
c = Color.Red;
++negCount;
} else {
_Y = -90;
c = Color.Green;
++posCount;
}
// now test whether the data values are within the visible Axes intervals
if (!xAxis.InRange(_X)) continue;
// not needed with this application; if ( !yAxis.InRange(_Y)) continue;
// it is within the visible x-axis plot area; so now convert the data to a pixel
myPoints[i] = GetPixel( // I guess each of these becomes immutable?
_X, xAxis,
_Y, yAxis,
_myPlot);
rects[i] = new System.Drawing.RectangleF( // these may also each be immutable?
myPoints[i].X - d / 2, myPoints[i].Y - d / 2, d, d);
brushes[i] = new System.Drawing.SolidBrush(c); // IDisposable
context.Graphics.FillRectangle(brushes[i], rects[i]);
}
// would be in a finally clause
for(int i=0; i<brushes.Length; i++) {
if (brushes[i] != null) brushes[i].Dispose();
}
//if (posCount==0 || negCount==0) { // it appears we do have both pos and neg values, verified
// parentForm.getStrategy().ninjaPrint2(" Draw pos: " + posCount + " neg: " + negCount + " drawn");
//}
} // end Draw
And will also try to post the visual result, where GREEN squares are seen always at -90 on the y-Axis and nowhere else, and no color changes either. Of course, I'm missing some key concept here, and I hope you'll clear it up for me, please. This is a fast real-time chart with a lot of indicators, which I hope you'll be able to ignore !