public static void Run()
{
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_Charts();
// Create an instance of Presentation class
Presentation presentation = new Presentation();
// Get reference of the slide
ISlide slide = presentation.Slides[0];
// Add a clustered column chart on the slide
IChart chart = slide.Shapes.AddChart(ChartType.ClusteredColumn, 50, 50, 500, 500);
// Set Legend Properties
chart.Legend.X = 50 / chart.Width;
chart.Legend.Y = 50 / chart.Height;
chart.Legend.Width = 100 / chart.Width;
chart.Legend.Height = 100 / chart.Height;
// Write presentation to disk
presentation.Save(dataDir + "Legend_out.pptx", SaveFormat.Pptx);
}
}