-
Notifications
You must be signed in to change notification settings - Fork 4
/
ViewOptionsActions.cs
121 lines (96 loc) · 4.57 KB
/
ViewOptionsActions.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
using System;
using System.Drawing;
using System.Globalization;
using DevExpress.Spreadsheet;
using DevExpress.Spreadsheet.Charts;
using DevExpress.Spreadsheet.Drawings;
using DevExpress.Utils;
namespace SpreadsheetChartAPIActions {
public static class ViewOptionsActions {
static void ShowAutomaticMarkers(IWorkbook workbook) {
#region #ShowAutomaticMarkers
Worksheet worksheet = workbook.Worksheets["chartTask5"];
workbook.Worksheets.ActiveWorksheet = worksheet;
// Create a chart and specify its location.
Chart chart = worksheet.Charts.Add(ChartType.Line, worksheet["B2:C8"]);
chart.TopLeftCell = worksheet.Cells["F2"];
chart.BottomRightCell = worksheet.Cells["L15"];
// Display markers using automatic style.
chart.Series[0].Marker.Symbol = MarkerStyle.Auto;
// Hide the legend.
chart.Legend.Visible = false;
#endregion #ShowAutomaticMarkers
}
static void ShowCustomMarkers(IWorkbook workbook) {
#region #ShowCustomMarkers
Worksheet worksheet = workbook.Worksheets["chartTask5"];
workbook.Worksheets.ActiveWorksheet = worksheet;
// Create a chart and specify its location.
Chart chart = worksheet.Charts.Add(ChartType.Line, worksheet["B2:C8"]);
chart.TopLeftCell = worksheet.Cells["F2"];
chart.BottomRightCell = worksheet.Cells["L15"];
// Display markers and specify the marker style.
chart.Series[0].Marker.Symbol = MarkerStyle.Circle;
// Hide the legend.
chart.Legend.Visible = false;
#endregion #ShowCustomMarkers
}
static void SetMarkerSize(IWorkbook workbook) {
#region #SetMarkerSize
Worksheet worksheet = workbook.Worksheets["chartTask5"];
workbook.Worksheets.ActiveWorksheet = worksheet;
// Create a chart and specify its location.
Chart chart = worksheet.Charts.Add(ChartType.Line, worksheet["B2:C8"]);
chart.TopLeftCell = worksheet.Cells["F2"];
chart.BottomRightCell = worksheet.Cells["L15"];
// Display markers and specify the marker style and size.
chart.Series[0].Marker.Symbol = MarkerStyle.Circle;
chart.Series[0].Marker.Size = 15;
// Hide the legend.
chart.Legend.Visible = false;
#endregion #SetMarkerSize
}
static void SmoothLines(IWorkbook workbook) {
#region #SmoothLines
Worksheet worksheet = workbook.Worksheets["chartTask5"];
workbook.Worksheets.ActiveWorksheet = worksheet;
// Create a chart and specify its location.
Chart chart = worksheet.Charts.Add(ChartType.LineMarker, worksheet["B2:C8"]);
chart.TopLeftCell = worksheet.Cells["F2"];
chart.BottomRightCell = worksheet.Cells["L15"];
// Turn on curve smoothing.
chart.Series[0].Smooth = true;
// Hide the legend.
chart.Legend.Visible = false;
#endregion #SmoothLines
}
static void GapWidth(IWorkbook workbook) {
#region #GapWidth
Worksheet worksheet = workbook.Worksheets["chartTask5"];
workbook.Worksheets.ActiveWorksheet = worksheet;
// Create a chart and specify its location.
Chart chart = worksheet.Charts.Add(ChartType.ColumnClustered, worksheet["B2:C8"]);
chart.TopLeftCell = worksheet.Cells["F2"];
chart.BottomRightCell = worksheet.Cells["L15"];
// Set the gap width between data series.
chart.Views[0].GapWidth = 33;
// Hide the legend.
chart.Legend.Visible = false;
#endregion #GapWidth
}
static void VaryColorsByPoint(IWorkbook workbook) {
#region #VaryColorsByPoint
Worksheet worksheet = workbook.Worksheets["chartTask5"];
workbook.Worksheets.ActiveWorksheet = worksheet;
// Create a chart and specify its location.
Chart chart = worksheet.Charts.Add(ChartType.ColumnClustered, worksheet["B2:C8"]);
chart.TopLeftCell = worksheet.Cells["F2"];
chart.BottomRightCell = worksheet.Cells["L15"];
// Specify that each data point in the series has a different color.
chart.Views[0].VaryColors = true;
// Hide the legend.
chart.Legend.Visible = false;
#endregion #VaryColorsByPoint
}
}
}