从excel向图表添加值和图例

时间:2017-11-24 12:03:42

标签: c# excel charts

我已经建立了一个关于Excel Worksbook价值的图表。然后保存图片。

Excel.ChartObjects xlCharts = (Excel.ChartObjects)xlWorkSheet.ChartObjects(Type.Missing);
Excel.ChartObject myChart = (Excel.ChartObject)xlCharts.Add(10, 80, 300, 250);
Excel.Chart chartPage = myChart.Chart;
// Diagram 2
chartRange = xlWorkSheet.get_Range("B12", "B15");

chartPage.SetSourceData(chartRange, misValue);
chartPage.ChartType = Excel.XlChartType.xl3DPieExploded;
foreach (Series series in chartPage.SeriesCollection())
{
    series.Name = "Уровень удовлетворенности респондентов длительностью ожидания";
}

// export chart as picture file
String destPath = Directory.GetCurrentDirectory();
chartPage.Export(Directory.GetCurrentDirectory() + "\\dig2.bmp", "BMP", misValue);

如何在图表中添加图例和值?

0 个答案:

没有答案