public void CreateChart()
{
Excel.Worksheet thisWorksheet;
thisWorksheet = thisWorkbook.ActiveSheet as Excel.Worksheet;
Excel.ChartObjects charts =
(Excel.ChartObjects)thisWorksheet.ChartObjects(Type.Missing);
// Adds a chart at x = 100, y = 300, 500 points wide and 300 tall.
Excel.ChartObject chartObj = charts.Add(100, 300, 500, 300);
Excel.Chart chart = chartObj.Chart;
// Gets the cells that define the bounds of the data to be charted.
Excel.Range chartRange = thisWorksheet.get_Range("A5","D8");
chart.SetSourceData(chartRange,Type.Missing);