1 module libxlsxd.chartseries;
2 
3 import libxlsxd.xlsxwrap;
4 
5 struct Chartseries {
6 	lxw_chart_series* handle;
7 	import libxlsxd.chart;
8 	import std.exception : enforce;
9 	import std.string : toStringz;
10 	import std.conv : to;
11 
12 	this(lxw_chart_series* handle) @nogc nothrow pure @safe {
13 		this.handle = handle;
14 	}
15 
16 	void setCategories(string sheetName, lxw_row_t firstRow, lxw_col_t
17 			firstCol, lxw_row_t lastRow, lxw_col_t lastCol)
18 	{
19 		chart_series_set_categories(this.handle, toStringz(sheetName),
20 				firstRow, firstCol, lastRow, lastCol
21 			);
22 	}
23 
24 	void setValues(string sheetname, lxw_row_t firstRow, lxw_col_t
25 			firstCol, lxw_row_t lastRow, lxw_col_t lastCol)
26 	{
27 		chart_series_set_values(this.handle, toStringz(sheetname), firstRow,
28 				firstCol, lastRow, lastCol
29 			);
30 	}
31 
32 	void setName(string name) {
33 		chart_series_set_name(this.handle, toStringz(name));
34 	}
35 
36 	void setNameRange(string sheetname, lxw_row_t row, lxw_col_t col) {
37 		chart_series_set_name_range(this.handle, toStringz(sheetname), row,
38 				col
39 			);
40 	}
41 
42 	void setLine(lxw_chart_line* line) nothrow @nogc {
43 		chart_series_set_line(this.handle, line);
44 	}
45 
46 	void setFill(lxw_chart_fill* fill) nothrow @nogc {
47 		chart_series_set_fill(this.handle, fill);
48 	}
49 
50 	void setInvertIfNegative() nothrow @nogc {
51 		chart_series_set_invert_if_negative(this.handle);
52 	}
53 
54 	void setPattern(lxw_chart_pattern* pattern) nothrow @nogc {
55 		chart_series_set_pattern(this.handle, pattern);
56 	}
57 
58 	void setMarkerType(ubyte mark) nothrow @nogc {
59 		chart_series_set_marker_type(this.handle, mark);
60 	}
61 
62 	void setMarkerSize(ubyte size) nothrow @nogc {
63 		chart_series_set_marker_size(this.handle, size);
64 	}
65 
66 	void setMarkerLine(lxw_chart_line* line) nothrow @nogc {
67 		chart_series_set_marker_line(this.handle, line);
68 	}
69 
70 	void setMarkerFill(lxw_chart_fill* fill) nothrow @nogc {
71 		chart_series_set_marker_fill(this.handle, fill);
72 	}
73 
74 	void setMarkerPattern(lxw_chart_pattern* pattern) nothrow @nogc {
75 		chart_series_set_marker_pattern(this.handle, pattern);
76 	}
77 
78 	void setPoints(lxw_chart_point** point) {
79 		enforce(chart_series_set_points(this.handle, point)
80 				== LXW_NO_ERROR
81 			);
82 	}
83 
84 	void setSmooth(ubyte smooth) nothrow @nogc {
85 		chart_series_set_smooth(this.handle, smooth);
86 	}
87 
88 	void setLabels() nothrow @nogc {
89 		chart_series_set_labels(this.handle);
90 	}
91 
92 	void setLabelsOptions(bool showName, bool showCategory ,
93 			bool showValue)
94 	{
95 		chart_series_set_labels_options(this.handle, to!ubyte(showName),
96 				to!ubyte(showCategory), to!ubyte(showValue)
97 			);
98 	}
99 
100 	void setLabelsSeparator(ubyte seperator) nothrow @nogc {
101 		chart_series_set_labels_separator(this.handle, seperator);
102 	}
103 
104 	void setLabelsPosition(ubyte position) nothrow @nogc {
105 		chart_series_set_labels_position(this.handle, position);
106 	}
107 
108 	void setLabelsLeaderLine() nothrow @nogc {
109 		chart_series_set_labels_leader_line(this.handle);
110 	}
111 
112 	void setLabelsLegend() nothrow @nogc {
113 		chart_series_set_labels_legend(this.handle);
114 	}
115 
116 	void setLabelsPercentage() nothrow @nogc {
117 		chart_series_set_labels_percentage(this.handle);
118 	}
119 
120 	void setLabelsNumFormat(string format) {
121 		chart_series_set_labels_num_format(this.handle, toStringz(format));
122 	}
123 
124 	void setLabelsFont(lxw_chart_font* font) nothrow @nogc {
125 		chart_series_set_labels_font(this.handle, font);
126 	}
127 
128 	void setTrendline(ubyte type, ubyte value) nothrow @nogc {
129 		chart_series_set_trendline(this.handle, type, value);
130 	}
131 
132 	void setTrendlineForecast(double forward, double backward) nothrow @nogc {
133 		chart_series_set_trendline_forecast(this.handle, forward, backward);
134 	}
135 
136 	void setTrendlineEquation() nothrow @nogc {
137 		chart_series_set_trendline_equation(this.handle);
138 	}
139 
140 	void setTrendlineRsquared() nothrow @nogc {
141 		chart_series_set_trendline_r_squared(this.handle);
142 	}
143 
144 	void setTrendlineIntercept(double intercept) nothrow @nogc {
145 		chart_series_set_trendline_intercept(this.handle, intercept);
146 	}
147 
148 	void setTrendlineName(string name) {
149 		chart_series_set_trendline_name(this.handle, toStringz(name));
150 	}
151 
152 	void setTrendlineLine(lxw_chart_line* line) nothrow @nogc {
153 		chart_series_set_trendline_line(this.handle, line);
154 	}
155 
156 	lxw_series_error_bars* getErrorBars( lxw_chart_error_bar_axis axis) nothrow 
157 			@nogc 
158 	{
159 		return chart_series_get_error_bars(this.handle, axis);
160 	}
161 
162 	void setErrorBars(lxw_series_error_bars* bars, ubyte type, double value)
163 			nothrow @nogc 
164 	{
165 		chart_series_set_error_bars(bars, type, value);
166 	}
167 
168 	void setErrorBarsDirection(lxw_series_error_bars* bars,
169 			ubyte direction) nothrow @nogc 
170 	{
171 		chart_series_set_error_bars_direction(bars, direction);
172 	}
173 
174 	void setErrorBarsEndcap(lxw_series_error_bars* bars,
175 			ubyte endcap) nothrow @nogc 
176 	{
177 		chart_series_set_error_bars_endcap(bars, endcap);
178 	}
179 
180 	void setErrorBarsLine(lxw_series_error_bars* bars,
181 			lxw_chart_line* line) nothrow @nogc 
182 	{
183 		chart_series_set_error_bars_line(bars, line);
184 	}
185 }