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) @trusted
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) @trusted
26 	{
27 		chart_series_set_values(this.handle, toStringz(sheetname), firstRow,
28 				firstCol, lastRow, lastCol
29 			);
30 	}
31 
32 	void setName(string name) @trusted {
33 		chart_series_set_name(this.handle, toStringz(name));
34 	}
35 
36 	void setNameRange(string sheetname, lxw_row_t row, lxw_col_t col) @trusted {
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 @trusted {
43 		chart_series_set_line(this.handle, line);
44 	}
45 
46 	void setFill(lxw_chart_fill* fill) nothrow @nogc @trusted {
47 		chart_series_set_fill(this.handle, fill);
48 	}
49 
50 	void setInvertIfNegative() nothrow @nogc @trusted {
51 		chart_series_set_invert_if_negative(this.handle);
52 	}
53 
54 	void setPattern(lxw_chart_pattern* pattern) nothrow @nogc @trusted {
55 		chart_series_set_pattern(this.handle, pattern);
56 	}
57 
58 	void setMarkerType(ubyte mark) nothrow @nogc @trusted {
59 		chart_series_set_marker_type(this.handle, mark);
60 	}
61 
62 	void setMarkerSize(ubyte size) nothrow @nogc @trusted {
63 		chart_series_set_marker_size(this.handle, size);
64 	}
65 
66 	void setMarkerLine(lxw_chart_line* line) nothrow @nogc @trusted {
67 		chart_series_set_marker_line(this.handle, line);
68 	}
69 
70 	void setMarkerFill(lxw_chart_fill* fill) nothrow @nogc @trusted {
71 		chart_series_set_marker_fill(this.handle, fill);
72 	}
73 
74 	void setMarkerPattern(lxw_chart_pattern* pattern) nothrow @nogc @trusted {
75 		chart_series_set_marker_pattern(this.handle, pattern);
76 	}
77 
78 	void setPoints(lxw_chart_point** point) @trusted {
79 		enforce(chart_series_set_points(this.handle, point)
80 				== LXW_NO_ERROR
81 			);
82 	}
83 
84 	void setSmooth(ubyte smooth) nothrow @nogc @trusted {
85 		chart_series_set_smooth(this.handle, smooth);
86 	}
87 
88 	void setLabels() nothrow @nogc @trusted {
89 		chart_series_set_labels(this.handle);
90 	}
91 
92 	void setLabelsOptions(bool showName, bool showCategory ,
93 			bool showValue) @trusted
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 @trusted {
101 		chart_series_set_labels_separator(this.handle, seperator);
102 	}
103 
104 	void setLabelsPosition(ubyte position) nothrow @nogc @trusted {
105 		chart_series_set_labels_position(this.handle, position);
106 	}
107 
108 	void setLabelsLeaderLine() nothrow @nogc @trusted {
109 		chart_series_set_labels_leader_line(this.handle);
110 	}
111 
112 	void setLabelsLegend() nothrow @nogc @trusted {
113 		chart_series_set_labels_legend(this.handle);
114 	}
115 
116 	void setLabelsPercentage() nothrow @nogc @trusted {
117 		chart_series_set_labels_percentage(this.handle);
118 	}
119 
120 	void setLabelsNumFormat(string format) @trusted {
121 		chart_series_set_labels_num_format(this.handle, toStringz(format));
122 	}
123 
124 	void setLabelsFont(lxw_chart_font* font) nothrow @nogc @trusted {
125 		chart_series_set_labels_font(this.handle, font);
126 	}
127 
128 	void setTrendline(ubyte type, ubyte value) nothrow @nogc @trusted {
129 		chart_series_set_trendline(this.handle, type, value);
130 	}
131 
132 	void setTrendlineForecast(double forward, double backward) nothrow @nogc
133 			@trusted
134 	{
135 		chart_series_set_trendline_forecast(this.handle, forward, backward);
136 	}
137 
138 	void setTrendlineEquation() nothrow @nogc @trusted {
139 		chart_series_set_trendline_equation(this.handle);
140 	}
141 
142 	void setTrendlineRsquared() nothrow @nogc @trusted {
143 		chart_series_set_trendline_r_squared(this.handle);
144 	}
145 
146 	void setTrendlineIntercept(double intercept) nothrow @nogc @trusted {
147 		chart_series_set_trendline_intercept(this.handle, intercept);
148 	}
149 
150 	void setTrendlineName(string name) @trusted {
151 		chart_series_set_trendline_name(this.handle, toStringz(name));
152 	}
153 
154 	void setTrendlineLine(lxw_chart_line* line) nothrow @nogc @trusted {
155 		chart_series_set_trendline_line(this.handle, line);
156 	}
157 
158 	lxw_series_error_bars* getErrorBars( lxw_chart_error_bar_axis axis) nothrow
159 			@nogc @trusted
160 	{
161 		return chart_series_get_error_bars(this.handle, axis);
162 	}
163 
164 	void setErrorBars(lxw_series_error_bars* bars, ubyte type, double value)
165 			nothrow @nogc @trusted
166 	{
167 		chart_series_set_error_bars(bars, type, value);
168 	}
169 
170 	void setErrorBarsDirection(lxw_series_error_bars* bars,
171 			ubyte direction) nothrow @nogc @trusted
172 	{
173 		chart_series_set_error_bars_direction(bars, direction);
174 	}
175 
176 	void setErrorBarsEndcap(lxw_series_error_bars* bars,
177 			ubyte endcap) nothrow @nogc @trusted
178 	{
179 		chart_series_set_error_bars_endcap(bars, endcap);
180 	}
181 
182 	void setErrorBarsLine(lxw_series_error_bars* bars,
183 			lxw_chart_line* line) nothrow @nogc @trusted
184 	{
185 		chart_series_set_error_bars_line(bars, line);
186 	}
187 }