Hi Teddy,
Generally you can display a raster at each chart element that has a fill style - for example:
chart.Wall(
ChartWallType.Back).FillStyle = new NImageFillStyle("c:\\temp2\\test.png");assigns image fill style to the back chart wall. The NImageFillStyle also accepts a constructor taking a bitmap object. Another alternative is to use custom painting:
All Examples\Custom Painting
In your case probably the best solution is to use a feature we have internally, but which is still not exposed/documented - overlay paint callbacks - present in the upcoming SP next week. This will allow you to custom paint any content over the chart without having to refresh. The following code snippet shows a sample use of the OverlayPaintCallback:
static Bitmap bmp = new Bitmap(100, 100);
static Point point = new Point();
class NCustomPaintCallback : NPaintCallback
{
public override void OnAfterPaint(NPanel panel, NPanelPaintEventArgs eventArgs)
{
eventArgs.Graphics.DeviceGraphics.DrawImage(bmp, point);
}
}
private void Form1_Load(object sender, EventArgs e)
{
using (Graphics g = Graphics.FromImage(bmp))
{
using (SolidBrush brush = new SolidBrush(Color.Red))
{
g.FillRectangle(brush, new RectangleF(0, 0, 100, 100));
}
}
NChart chart = nChartControl1.Charts[0];
chart.BoundsMode = BoundsMode.Stretch;
chart.OverlayPaintCallback = new NCustomPaintCallback();
NBarSeries bar = new NBarSeries();
bar.Values.Add(10);
bar.Values.Add(20);
bar.Values.Add(30);
bar.FillStyles[0] = new NColorFillStyle(Color.Red);
bar.FillStyles[1] = new NColorFillStyle(Color.Green);
bar.FillStyles[2] = new NColorFillStyle(Color.Blue);
chart.Series.Add(bar);
nChartControl1.MouseMove += new MouseEventHandler(nChartControl1_MouseMove);
}
void nChartControl1_MouseMove(object sender, MouseEventArgs e)
{
point = new Point(e.X, e.Y);
nChartControl1.Invalidate();
}
Hope this helps - let us know if you meet any problems or have any questions.
Best Regards,
Nevron Support Team