OK, I am making good progress, but have a problem with the X axis.
These are realtime lineCharts, and on all my other dozen or so default series (2D), mapped onto the same Plot, I am using a long value for the x axis, which is derived, I think from:
DateTime now = DateTime.UtcNow;
long ticks = now.Ticks; // the x axis timestamp
This works great for all of my default rendered series. The xAxis timebase is perfect.
However, now with the new renderer I believe I have to use a double for the xAxis timebase; and that is clearly not working.
List<double> doubleDateTimestampList; // was long, now required to be double for 3D ? So Convert.ToDouble(long) ?
So I need to understand how to map the data onto the xAxis with the new renderer; given that I don't think I can use the long
data type any more...?
Maybe this is all confused, but I assumed that converting the long into a double would serve the purpose of representing the xAxis timebase. Should that work?
Maybe you could help me understand that issue, even though I'm not explaining it very well...? In my defense, this is a huge realtime order entry and analysis system which extends beyond what I could chart with NinjaTrader, and so I've adopted a couple of MindFusion charts in order to be able to do the charting complexity, so I'm just barely proficient with it.... Mea culpa.
[EDIT] all of my Realtime data is buffered, of course, and then inserted into the MindFusion chart only on the GUI thread, and Invalidated/refreshed only a couple of times per second at a controlled rate...
[EDIT2] This Draw is invoked as expected, and I think it does the testing whether the data is in the visible region, perhaps the general logic isn't right... Usually I don't use "var" but use the specific type; but I'm sure that's fine...?
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
for (int i=0; i<mySeries.yValuesList.Count; i++) { // all are same length
double x = mySeries.GetValue(i, DATE_DIMENSION); // x axis realtime timestamp
double y = mySeries.GetValue(i, YVALUE_DIMENSION); // y axis "price'
// now test whether the data values are within the visible Axes intervals
if ( !xAxis.InRange(x)) continue;
if ( !yAxis.InRange(y)) continue;
parentForm.getStrategy().ninjaPrint2(" Draw x: "+x+" y: "+y+" drawn");
// it is within the visible plot area; so now convert the data to a pixel
PointF myPoint = GetPixel(
x, xAxis,
y, yAxis,
_myPlot);
var d = (float)(mySeries.GetValue(i, DATA3D_DIMENSION) * 6); // the 3rd dimension size/color square
var color = d < 0 ? Color.Red : Color.Green;
var rect = new System.Drawing.RectangleF(
myPoint.X - d / 2, myPoint.Y - d / 2, d, d);
using (Brush brush = new System.Drawing.SolidBrush(color))
context.Graphics.FillRectangle(brush, rect);
}
} // end Draw
hyper