private static ExcelBubbleChart AddBubble(ExcelWorksheet ws, eBubbleChartType type, string name, int row, int col, ePresetChartStyle style, Action <ExcelBubbleChart> SetProperties) { var chart = ws.Drawings.AddBubbleChart(name, type); chart.SetPosition(row, 0, col, 0); chart.To.Column = col + 12; chart.To.ColumnOff = 0; chart.To.Row = row + 18; chart.To.RowOff = 0; var serie = chart.Series.Add("D2:D8", "A2:A8"); SetProperties(chart); chart.StyleManager.SetChartStyle(style); return(chart); }
/// <summary> /// Adds a new bubble chart to the worksheet. /// </summary> /// <param name="Name"></param> /// <param name="ChartType">Type of chart</param> /// <param name="PivotTableSource">The pivottable source for a pivotchart</param> /// <returns>The chart</returns> public ExcelBubbleChart AddBubbleChart(string Name, eBubbleChartType ChartType, ExcelPivotTable PivotTableSource) { return((ExcelBubbleChart)AddChart(Name, (eChartType)ChartType, PivotTableSource)); }
/// <summary> /// Adds a new bubble chart to the worksheet. /// </summary> /// <param name="Name"></param> /// <param name="ChartType">Type of chart</param> /// <returns>The chart</returns> public ExcelBubbleChart AddBubbleChart(string Name, eBubbleChartType ChartType) { return((ExcelBubbleChart)AddChart(Name, (eChartType)ChartType, null)); }
private static void BubbleStyle(ExcelWorksheet ws, eBubbleChartType chartType) { //Style 1 AddBubble(ws, chartType, "BubbleChartStyle1", 0, 5, ePresetChartStyle.BubbleChartStyle1, c => { c.Legend.Position = eLegendPosition.Bottom; }); //Style 2 AddBubble(ws, chartType, "BubbleChartStyle2", 0, 18, ePresetChartStyle.BubbleChartStyle2, c => { c.Legend.Position = eLegendPosition.Top; }); //Style 3 AddBubble(ws, chartType, "BubbleChartStyle3", 0, 31, ePresetChartStyle.BubbleChartStyle3, c => { c.DataLabel.ShowPercent = true; }); //Style 4 AddBubble(ws, chartType, "BubbleChartStyle4", 22, 5, ePresetChartStyle.BubbleChartStyle4, c => { c.Legend.Position = eLegendPosition.Bottom; }); //Style 5 AddBubble(ws, chartType, "BubbleChartStyle5", 22, 18, ePresetChartStyle.BubbleChartStyle5, c => { c.Legend.Position = eLegendPosition.Bottom; }); //Style 6 AddBubble(ws, chartType, "BubbleChartStyle6", 22, 31, ePresetChartStyle.BubbleChartStyle6, c => { }); //Style 7 AddBubble(ws, chartType, "BubbleChartStyle7", 44, 5, ePresetChartStyle.BubbleChartStyle7, c => { c.Legend.Position = eLegendPosition.Bottom; }); //Style 8 AddBubble(ws, chartType, "BubbleChartStyle8", 44, 18, ePresetChartStyle.BubbleChartStyle8, c => { c.Legend.Position = eLegendPosition.Top; c.DataLabel.ShowPercent = true; }); //Style 9 AddBubble(ws, chartType, "BubbleChartStyle9", 44, 31, ePresetChartStyle.BubbleChartStyle9, c => { c.Legend.Remove(); c.DataLabel.ShowValue = true; c.DataLabel.ShowPercent = true; c.DataLabel.ShowCategory = true; }); //Style 10 AddBubble(ws, chartType, "BubbleChartStyle10", 66, 5, ePresetChartStyle.BubbleChartStyle10, c => { c.Legend.Position = eLegendPosition.Bottom; c.DataLabel.ShowPercent = true; }); //Style 11 AddBubble(ws, chartType, "BubbleChartStyle11", 66, 18, ePresetChartStyle.BubbleChartStyle11, c => { }); }