How to draw text on a blank chart diagram table chart?

I use the Microsoft Chart control to build a series, but if I don't have data, I want to display the “No Data Series” in the area where the chart would be.

Like this:

Similarpic http://blogs.telerik.com/Libraries/MetaBlogLib/WindowsLiveWriter-CreatingabasicChart_D20D-image_thumb.sflb

I have a suspicion that this is due to the fact that I manually draw some text on the image, but I do not know where to start. Is anyone

+5
source share
1 answer

You can create an event handler after drawing, where you can draw your material:

mychart.PostPaint += new EventHandler<ChartPaintEventArgs>(PostPaintEventHandler);
...
static void PostPaintEventHandler(object sender, ChartPaintEventArgs e)
{
  //sender here is the chart... you can use that too.
  //use e.ChartGraphics object to paint something
  e.ChartGraphics.DrawString(...);
}

ILSpy, dll MSChart. Graphics.DrawString. , .

, .

+1

All Articles