1 module libxlsxd.chart;
2 
3 import libxlsxd.xlsxwrap;
4 
5 struct Chart {
6 	import libxlsxd.types;
7 	import std.exception : enforce;
8 	import std.string : toStringz;
9 	import libxlsxd.chartseries;
10 	import libxlsxd.chartaxis;
11 
12 	lxw_chart* handle;
13 
14 	this(lxw_chart* handle) @nogc nothrow pure @safe {
15 		this.handle = handle;
16 	}
17 
18 	void free() {
19 		lxw_chart_free(this.handle);
20 	}
21 
22 	void assembleXmlFile() {
23 		lxw_chart_assemble_xml_file(this.handle);
24 	}
25 
26 	Chartseries addChartseries(string categories, string values) {
27 		return Chartseries(chart_add_series(this.handle, toStringz(categories),
28 					toStringz(values)
29 				));
30 	}
31 
32 	Chartaxis axisGet(lxw_chart_axis_type axisType) {
33 		return Chartaxis(chart_axis_get(this.handle, axisType));
34 	}
35 
36 	void titleSetName(string title) nothrow {
37 		chart_title_set_name(this.handle, toStringz(title));
38 	}
39 	
40 	void titleSetNameRange(string sheetname, RowType row, ColType col) nothrow {
41 		chart_title_set_name_range(this.handle, toStringz(sheetname), row, col);
42 	}
43 
44 	void titleSetNameFont(lxw_chart_font* font) nothrow @nogc {
45 		chart_title_set_name_font(this.handle, font);
46 	}
47 
48 	void titleOff() nothrow @nogc {
49 		chart_title_off(this.handle);
50 	}
51 
52 	void legendSetPosition(ubyte pos) nothrow @nogc {
53 		chart_legend_set_position(this.handle, pos);
54 	}
55 
56 	void legendSetFont(lxw_chart_font* font) nothrow @nogc {
57 		chart_legend_set_font(this.handle, font);
58 	}
59 
60 	lxw_error legendDeleteSeries(short[] series) nothrow @nogc {
61 		return chart_legend_delete_series(this.handle, series.ptr);
62 	}
63 
64 	void chartareaSetLine(lxw_chart_line* line) nothrow @nogc {
65 		chart_chartarea_set_line(this.handle, line);
66 	}
67 
68 	void chartareaSetFill(lxw_chart_fill* fill) nothrow @nogc {
69 		chart_chartarea_set_fill(this.handle, fill);
70 	}
71 
72 	void chartareaSetPattern(lxw_chart_pattern* pattern) nothrow @nogc {
73 		chart_chartarea_set_pattern(this.handle, pattern);
74 	}
75 
76 	void plotareaSetLine(lxw_chart_line* line) nothrow @nogc {
77 		chart_plotarea_set_line(this.handle, line);
78 	}
79 
80 	void plotareaSetFill(lxw_chart_fill* fill) nothrow @nogc {
81 		chart_plotarea_set_fill(this.handle, fill);
82 	}
83 
84 	void plotareaSetPattern(lxw_chart_pattern* pattern) nothrow @nogc {
85 		chart_plotarea_set_pattern(this.handle, pattern);
86 	}
87 
88 	void setStyle(ubyte style) nothrow @nogc {
89 		chart_set_style(this.handle, style);
90 	}
91 
92 	void setTable() nothrow @nogc {
93 		chart_set_table(this.handle);
94 	}
95 
96 	void setTableGrid(ubyte hori, ubyte vert, ubyte outline, ubyte keys)
97 			nothrow @nogc 
98 	{
99 		chart_set_table_grid(this.handle, hori, vert, outline, keys);
100 	}
101 
102 	void setTableFont(lxw_chart_font* font) nothrow @nogc {
103 		chart_set_table_font(this.handle, font);
104 	}
105 
106 	void setUpDownBars() nothrow @nogc {
107 		chart_set_up_down_bars(this.handle);
108 	}
109 
110 	void setUpDownBarsFormat(lxw_chart_line* upBarLine, 
111 			lxw_chart_fill* upBarFill, lxw_chart_line* downBarLine, 
112 			lxw_chart_fill* downBarFill) nothrow @nogc 
113 	{
114 		chart_set_up_down_bars_format(this.handle, upBarLine, upBarFill,
115 				downBarLine, downBarFill);
116 	}
117 
118 	void setDropLines(lxw_chart_line* line) nothrow @nogc {
119 		chart_set_drop_lines(this.handle, line);
120 	}
121 
122 	void setHighLowLines(lxw_chart_line* line) nothrow @nogc {
123 		chart_set_high_low_lines(this.handle, line);
124 	}
125 
126 	void setSeriesOverlap(byte overlap) nothrow @nogc {
127 		chart_set_series_overlap(this.handle, overlap);
128 	}
129 
130 	void setSeriesGap(ushort gap) nothrow @nogc {
131 		chart_set_series_gap(this.handle, gap);
132 	}
133 
134 	void showBlanksAs(ubyte blanks) nothrow @nogc {
135 		chart_show_blanks_as(this.handle, blanks);
136 	}
137 
138 	void showHiddenData() nothrow @nogc {
139 		chart_show_hidden_data(this.handle);
140 	}
141 
142 	void setRotation(ushort rotation) nothrow @nogc {
143 		chart_set_rotation(this.handle, rotation);
144 	}
145 
146 	void setHoleSize(ubyte size) nothrow @nogc {
147 		chart_set_hole_size(this.handle, size);
148 	}
149 }