chart.h 106 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577
  1. /*
  2. * libxlsxwriter
  3. *
  4. * Copyright 2014-2018, John McNamara, [email protected]. See LICENSE.txt.
  5. *
  6. * chart - A libxlsxwriter library for creating Excel XLSX chart files.
  7. *
  8. */
  9. /**
  10. * @page chart_page The Chart object
  11. *
  12. * The Chart object represents an Excel chart. It provides functions for
  13. * adding data series to the chart and for configuring the chart.
  14. *
  15. * See @ref chart.h for full details of the functionality.
  16. *
  17. * @file chart.h
  18. *
  19. * @brief Functions related to adding data to and configuring a chart.
  20. *
  21. * The Chart object represents an Excel chart. It provides functions for
  22. * adding data series to the chart and for configuring the chart.
  23. *
  24. * A Chart object isn't created directly. Instead a chart is created by
  25. * calling the `workbook_add_chart()` function from a Workbook object. For
  26. * example:
  27. *
  28. * @code
  29. *
  30. * #include "xlsxwriter.h"
  31. *
  32. * int main() {
  33. *
  34. * lxw_workbook *workbook = new_workbook("chart.xlsx");
  35. * lxw_worksheet *worksheet = workbook_add_worksheet(workbook, NULL);
  36. *
  37. * // User function to add data to worksheet, not shown here.
  38. * write_worksheet_data(worksheet);
  39. *
  40. * // Create a chart object.
  41. * lxw_chart *chart = workbook_add_chart(workbook, LXW_CHART_COLUMN);
  42. *
  43. * // In the simplest case we just add some value data series.
  44. * // The NULL categories will default to 1 to 5 like in Excel.
  45. * chart_add_series(chart, NULL, "=Sheet1!$A$1:$A$5");
  46. * chart_add_series(chart, NULL, "=Sheet1!$B$1:$B$5");
  47. * chart_add_series(chart, NULL, "=Sheet1!$C$1:$C$5");
  48. *
  49. * // Insert the chart into the worksheet
  50. * worksheet_insert_chart(worksheet, CELL("B7"), chart);
  51. *
  52. * return workbook_close(workbook);
  53. * }
  54. *
  55. * @endcode
  56. *
  57. * The chart in the worksheet will look like this:
  58. * @image html chart_simple.png
  59. *
  60. * The basic procedure for adding a chart to a worksheet is:
  61. *
  62. * 1. Create the chart with `workbook_add_chart()`.
  63. * 2. Add one or more data series to the chart which refers to data in the
  64. * workbook using `chart_add_series()`.
  65. * 3. Configure the chart with the other available functions shown below.
  66. * 4. Insert the chart into a worksheet using `worksheet_insert_chart()`.
  67. *
  68. */
  69. #ifndef __LXW_CHART_H__
  70. #define __LXW_CHART_H__
  71. #include <stdint.h>
  72. #include <string.h>
  73. #include "common.h"
  74. #include "format.h"
  75. STAILQ_HEAD(lxw_chart_series_list, lxw_chart_series);
  76. STAILQ_HEAD(lxw_series_data_points, lxw_series_data_point);
  77. #define LXW_CHART_NUM_FORMAT_LEN 128
  78. #define LXW_CHART_DEFAULT_GAP 501
  79. /**
  80. * @brief Available chart types.
  81. */
  82. typedef enum lxw_chart_type {
  83. /** None. */
  84. LXW_CHART_NONE = 0,
  85. /** Area chart. */
  86. LXW_CHART_AREA,
  87. /** Area chart - stacked. */
  88. LXW_CHART_AREA_STACKED,
  89. /** Area chart - percentage stacked. */
  90. LXW_CHART_AREA_STACKED_PERCENT,
  91. /** Bar chart. */
  92. LXW_CHART_BAR,
  93. /** Bar chart - stacked. */
  94. LXW_CHART_BAR_STACKED,
  95. /** Bar chart - percentage stacked. */
  96. LXW_CHART_BAR_STACKED_PERCENT,
  97. /** Column chart. */
  98. LXW_CHART_COLUMN,
  99. /** Column chart - stacked. */
  100. LXW_CHART_COLUMN_STACKED,
  101. /** Column chart - percentage stacked. */
  102. LXW_CHART_COLUMN_STACKED_PERCENT,
  103. /** Doughnut chart. */
  104. LXW_CHART_DOUGHNUT,
  105. /** Line chart. */
  106. LXW_CHART_LINE,
  107. /** Pie chart. */
  108. LXW_CHART_PIE,
  109. /** Scatter chart. */
  110. LXW_CHART_SCATTER,
  111. /** Scatter chart - straight. */
  112. LXW_CHART_SCATTER_STRAIGHT,
  113. /** Scatter chart - straight with markers. */
  114. LXW_CHART_SCATTER_STRAIGHT_WITH_MARKERS,
  115. /** Scatter chart - smooth. */
  116. LXW_CHART_SCATTER_SMOOTH,
  117. /** Scatter chart - smooth with markers. */
  118. LXW_CHART_SCATTER_SMOOTH_WITH_MARKERS,
  119. /** Radar chart. */
  120. LXW_CHART_RADAR,
  121. /** Radar chart - with markers. */
  122. LXW_CHART_RADAR_WITH_MARKERS,
  123. /** Radar chart - filled. */
  124. LXW_CHART_RADAR_FILLED
  125. } lxw_chart_type;
  126. /**
  127. * @brief Chart legend positions.
  128. */
  129. typedef enum lxw_chart_legend_position {
  130. /** No chart legend. */
  131. LXW_CHART_LEGEND_NONE = 0,
  132. /** Chart legend positioned at right side. */
  133. LXW_CHART_LEGEND_RIGHT,
  134. /** Chart legend positioned at left side. */
  135. LXW_CHART_LEGEND_LEFT,
  136. /** Chart legend positioned at top. */
  137. LXW_CHART_LEGEND_TOP,
  138. /** Chart legend positioned at bottom. */
  139. LXW_CHART_LEGEND_BOTTOM,
  140. /** Chart legend overlaid at right side. */
  141. LXW_CHART_LEGEND_OVERLAY_RIGHT,
  142. /** Chart legend overlaid at left side. */
  143. LXW_CHART_LEGEND_OVERLAY_LEFT
  144. } lxw_chart_legend_position;
  145. /**
  146. * @brief Chart line dash types.
  147. *
  148. * The dash types are shown in the order that they appear in the Excel dialog.
  149. * See @ref chart_lines.
  150. */
  151. typedef enum lxw_chart_line_dash_type {
  152. /** Solid. */
  153. LXW_CHART_LINE_DASH_SOLID = 0,
  154. /** Round Dot. */
  155. LXW_CHART_LINE_DASH_ROUND_DOT,
  156. /** Square Dot. */
  157. LXW_CHART_LINE_DASH_SQUARE_DOT,
  158. /** Dash. */
  159. LXW_CHART_LINE_DASH_DASH,
  160. /** Dash Dot. */
  161. LXW_CHART_LINE_DASH_DASH_DOT,
  162. /** Long Dash. */
  163. LXW_CHART_LINE_DASH_LONG_DASH,
  164. /** Long Dash Dot. */
  165. LXW_CHART_LINE_DASH_LONG_DASH_DOT,
  166. /** Long Dash Dot Dot. */
  167. LXW_CHART_LINE_DASH_LONG_DASH_DOT_DOT,
  168. /* These aren't available in the dialog but are used by Excel. */
  169. LXW_CHART_LINE_DASH_DOT,
  170. LXW_CHART_LINE_DASH_SYSTEM_DASH_DOT,
  171. LXW_CHART_LINE_DASH_SYSTEM_DASH_DOT_DOT
  172. } lxw_chart_line_dash_type;
  173. /**
  174. * @brief Chart marker types.
  175. */
  176. typedef enum lxw_chart_marker_type {
  177. /** Automatic, series default, marker type. */
  178. LXW_CHART_MARKER_AUTOMATIC,
  179. /** No marker type. */
  180. LXW_CHART_MARKER_NONE,
  181. /** Square marker type. */
  182. LXW_CHART_MARKER_SQUARE,
  183. /** Diamond marker type. */
  184. LXW_CHART_MARKER_DIAMOND,
  185. /** Triangle marker type. */
  186. LXW_CHART_MARKER_TRIANGLE,
  187. /** X shape marker type. */
  188. LXW_CHART_MARKER_X,
  189. /** Star marker type. */
  190. LXW_CHART_MARKER_STAR,
  191. /** Short dash marker type. */
  192. LXW_CHART_MARKER_SHORT_DASH,
  193. /** Long dash marker type. */
  194. LXW_CHART_MARKER_LONG_DASH,
  195. /** Circle marker type. */
  196. LXW_CHART_MARKER_CIRCLE,
  197. /** Plus (+) marker type. */
  198. LXW_CHART_MARKER_PLUS
  199. } lxw_chart_marker_type;
  200. /**
  201. * @brief Chart pattern types.
  202. */
  203. typedef enum lxw_chart_pattern_type {
  204. /** None pattern. */
  205. LXW_CHART_PATTERN_NONE,
  206. /** 5 Percent pattern. */
  207. LXW_CHART_PATTERN_PERCENT_5,
  208. /** 10 Percent pattern. */
  209. LXW_CHART_PATTERN_PERCENT_10,
  210. /** 20 Percent pattern. */
  211. LXW_CHART_PATTERN_PERCENT_20,
  212. /** 25 Percent pattern. */
  213. LXW_CHART_PATTERN_PERCENT_25,
  214. /** 30 Percent pattern. */
  215. LXW_CHART_PATTERN_PERCENT_30,
  216. /** 40 Percent pattern. */
  217. LXW_CHART_PATTERN_PERCENT_40,
  218. /** 50 Percent pattern. */
  219. LXW_CHART_PATTERN_PERCENT_50,
  220. /** 60 Percent pattern. */
  221. LXW_CHART_PATTERN_PERCENT_60,
  222. /** 70 Percent pattern. */
  223. LXW_CHART_PATTERN_PERCENT_70,
  224. /** 75 Percent pattern. */
  225. LXW_CHART_PATTERN_PERCENT_75,
  226. /** 80 Percent pattern. */
  227. LXW_CHART_PATTERN_PERCENT_80,
  228. /** 90 Percent pattern. */
  229. LXW_CHART_PATTERN_PERCENT_90,
  230. /** Light downward diagonal pattern. */
  231. LXW_CHART_PATTERN_LIGHT_DOWNWARD_DIAGONAL,
  232. /** Light upward diagonal pattern. */
  233. LXW_CHART_PATTERN_LIGHT_UPWARD_DIAGONAL,
  234. /** Dark downward diagonal pattern. */
  235. LXW_CHART_PATTERN_DARK_DOWNWARD_DIAGONAL,
  236. /** Dark upward diagonal pattern. */
  237. LXW_CHART_PATTERN_DARK_UPWARD_DIAGONAL,
  238. /** Wide downward diagonal pattern. */
  239. LXW_CHART_PATTERN_WIDE_DOWNWARD_DIAGONAL,
  240. /** Wide upward diagonal pattern. */
  241. LXW_CHART_PATTERN_WIDE_UPWARD_DIAGONAL,
  242. /** Light vertical pattern. */
  243. LXW_CHART_PATTERN_LIGHT_VERTICAL,
  244. /** Light horizontal pattern. */
  245. LXW_CHART_PATTERN_LIGHT_HORIZONTAL,
  246. /** Narrow vertical pattern. */
  247. LXW_CHART_PATTERN_NARROW_VERTICAL,
  248. /** Narrow horizontal pattern. */
  249. LXW_CHART_PATTERN_NARROW_HORIZONTAL,
  250. /** Dark vertical pattern. */
  251. LXW_CHART_PATTERN_DARK_VERTICAL,
  252. /** Dark horizontal pattern. */
  253. LXW_CHART_PATTERN_DARK_HORIZONTAL,
  254. /** Dashed downward diagonal pattern. */
  255. LXW_CHART_PATTERN_DASHED_DOWNWARD_DIAGONAL,
  256. /** Dashed upward diagonal pattern. */
  257. LXW_CHART_PATTERN_DASHED_UPWARD_DIAGONAL,
  258. /** Dashed horizontal pattern. */
  259. LXW_CHART_PATTERN_DASHED_HORIZONTAL,
  260. /** Dashed vertical pattern. */
  261. LXW_CHART_PATTERN_DASHED_VERTICAL,
  262. /** Small confetti pattern. */
  263. LXW_CHART_PATTERN_SMALL_CONFETTI,
  264. /** Large confetti pattern. */
  265. LXW_CHART_PATTERN_LARGE_CONFETTI,
  266. /** Zigzag pattern. */
  267. LXW_CHART_PATTERN_ZIGZAG,
  268. /** Wave pattern. */
  269. LXW_CHART_PATTERN_WAVE,
  270. /** Diagonal brick pattern. */
  271. LXW_CHART_PATTERN_DIAGONAL_BRICK,
  272. /** Horizontal brick pattern. */
  273. LXW_CHART_PATTERN_HORIZONTAL_BRICK,
  274. /** Weave pattern. */
  275. LXW_CHART_PATTERN_WEAVE,
  276. /** Plaid pattern. */
  277. LXW_CHART_PATTERN_PLAID,
  278. /** Divot pattern. */
  279. LXW_CHART_PATTERN_DIVOT,
  280. /** Dotted grid pattern. */
  281. LXW_CHART_PATTERN_DOTTED_GRID,
  282. /** Dotted diamond pattern. */
  283. LXW_CHART_PATTERN_DOTTED_DIAMOND,
  284. /** Shingle pattern. */
  285. LXW_CHART_PATTERN_SHINGLE,
  286. /** Trellis pattern. */
  287. LXW_CHART_PATTERN_TRELLIS,
  288. /** Sphere pattern. */
  289. LXW_CHART_PATTERN_SPHERE,
  290. /** Small grid pattern. */
  291. LXW_CHART_PATTERN_SMALL_GRID,
  292. /** Large grid pattern. */
  293. LXW_CHART_PATTERN_LARGE_GRID,
  294. /** Small check pattern. */
  295. LXW_CHART_PATTERN_SMALL_CHECK,
  296. /** Large check pattern. */
  297. LXW_CHART_PATTERN_LARGE_CHECK,
  298. /** Outlined diamond pattern. */
  299. LXW_CHART_PATTERN_OUTLINED_DIAMOND,
  300. /** Solid diamond pattern. */
  301. LXW_CHART_PATTERN_SOLID_DIAMOND
  302. } lxw_chart_pattern_type;
  303. /**
  304. * @brief Chart data label positions.
  305. */
  306. typedef enum lxw_chart_label_position {
  307. /** Series data label position: default position. */
  308. LXW_CHART_LABEL_POSITION_DEFAULT,
  309. /** Series data label position: center. */
  310. LXW_CHART_LABEL_POSITION_CENTER,
  311. /** Series data label position: right. */
  312. LXW_CHART_LABEL_POSITION_RIGHT,
  313. /** Series data label position: left. */
  314. LXW_CHART_LABEL_POSITION_LEFT,
  315. /** Series data label position: above. */
  316. LXW_CHART_LABEL_POSITION_ABOVE,
  317. /** Series data label position: below. */
  318. LXW_CHART_LABEL_POSITION_BELOW,
  319. /** Series data label position: inside base. */
  320. LXW_CHART_LABEL_POSITION_INSIDE_BASE,
  321. /** Series data label position: inside end. */
  322. LXW_CHART_LABEL_POSITION_INSIDE_END,
  323. /** Series data label position: outside end. */
  324. LXW_CHART_LABEL_POSITION_OUTSIDE_END,
  325. /** Series data label position: best fit. */
  326. LXW_CHART_LABEL_POSITION_BEST_FIT
  327. } lxw_chart_label_position;
  328. /**
  329. * @brief Chart data label separator.
  330. */
  331. typedef enum lxw_chart_label_separator {
  332. /** Series data label separator: comma (the default). */
  333. LXW_CHART_LABEL_SEPARATOR_COMMA,
  334. /** Series data label separator: semicolon. */
  335. LXW_CHART_LABEL_SEPARATOR_SEMICOLON,
  336. /** Series data label separator: period. */
  337. LXW_CHART_LABEL_SEPARATOR_PERIOD,
  338. /** Series data label separator: newline. */
  339. LXW_CHART_LABEL_SEPARATOR_NEWLINE,
  340. /** Series data label separator: space. */
  341. LXW_CHART_LABEL_SEPARATOR_SPACE
  342. } lxw_chart_label_separator;
  343. /**
  344. * @brief Chart axis types.
  345. */
  346. typedef enum lxw_chart_axis_type {
  347. /** Chart X axis. */
  348. LXW_CHART_AXIS_TYPE_X,
  349. /** Chart Y axis. */
  350. LXW_CHART_AXIS_TYPE_Y
  351. } lxw_chart_axis_type;
  352. enum lxw_chart_subtype {
  353. LXW_CHART_SUBTYPE_NONE = 0,
  354. LXW_CHART_SUBTYPE_STACKED,
  355. LXW_CHART_SUBTYPE_STACKED_PERCENT
  356. };
  357. enum lxw_chart_grouping {
  358. LXW_GROUPING_CLUSTERED,
  359. LXW_GROUPING_STANDARD,
  360. LXW_GROUPING_PERCENTSTACKED,
  361. LXW_GROUPING_STACKED
  362. };
  363. /**
  364. * @brief Axis positions for category axes.
  365. */
  366. typedef enum lxw_chart_axis_tick_position {
  367. LXW_CHART_AXIS_POSITION_DEFAULT,
  368. /** Position category axis on tick marks. */
  369. LXW_CHART_AXIS_POSITION_ON_TICK,
  370. /** Position category axis between tick marks. */
  371. LXW_CHART_AXIS_POSITION_BETWEEN
  372. } lxw_chart_axis_tick_position;
  373. /**
  374. * @brief Axis label positions.
  375. */
  376. typedef enum lxw_chart_axis_label_position {
  377. /** Position the axis labels next to the axis. The default. */
  378. LXW_CHART_AXIS_LABEL_POSITION_NEXT_TO,
  379. /** Position the axis labels at the top of the chart, for horizontal
  380. * axes, or to the right for vertical axes.*/
  381. LXW_CHART_AXIS_LABEL_POSITION_HIGH,
  382. /** Position the axis labels at the bottom of the chart, for horizontal
  383. * axes, or to the left for vertical axes.*/
  384. LXW_CHART_AXIS_LABEL_POSITION_LOW,
  385. /** Turn off the the axis labels. */
  386. LXW_CHART_AXIS_LABEL_POSITION_NONE
  387. } lxw_chart_axis_label_position;
  388. /**
  389. * @brief Display units for chart value axis.
  390. */
  391. typedef enum lxw_chart_axis_display_unit {
  392. /** Axis display units: None. The default. */
  393. LXW_CHART_AXIS_UNITS_NONE,
  394. /** Axis display units: Hundreds. */
  395. LXW_CHART_AXIS_UNITS_HUNDREDS,
  396. /** Axis display units: Thousands. */
  397. LXW_CHART_AXIS_UNITS_THOUSANDS,
  398. /** Axis display units: Ten thousands. */
  399. LXW_CHART_AXIS_UNITS_TEN_THOUSANDS,
  400. /** Axis display units: Hundred thousands. */
  401. LXW_CHART_AXIS_UNITS_HUNDRED_THOUSANDS,
  402. /** Axis display units: Millions. */
  403. LXW_CHART_AXIS_UNITS_MILLIONS,
  404. /** Axis display units: Ten millions. */
  405. LXW_CHART_AXIS_UNITS_TEN_MILLIONS,
  406. /** Axis display units: Hundred millions. */
  407. LXW_CHART_AXIS_UNITS_HUNDRED_MILLIONS,
  408. /** Axis display units: Billions. */
  409. LXW_CHART_AXIS_UNITS_BILLIONS,
  410. /** Axis display units: Trillions. */
  411. LXW_CHART_AXIS_UNITS_TRILLIONS
  412. } lxw_chart_axis_display_unit;
  413. /**
  414. * @brief Tick mark types for an axis.
  415. */
  416. typedef enum lxw_chart_axis_tick_mark {
  417. /** Default tick mark for the chart axis. Usually outside. */
  418. LXW_CHART_AXIS_TICK_MARK_DEFAULT,
  419. /** No tick mark for the axis. */
  420. LXW_CHART_AXIS_TICK_MARK_NONE,
  421. /** Tick mark inside the axis only. */
  422. LXW_CHART_AXIS_TICK_MARK_INSIDE,
  423. /** Tick mark outside the axis only. */
  424. LXW_CHART_AXIS_TICK_MARK_OUTSIDE,
  425. /** Tick mark inside and outside the axis. */
  426. LXW_CHART_AXIS_TICK_MARK_CROSSING
  427. } lxw_chart_tick_mark;
  428. typedef struct lxw_series_range {
  429. char *formula;
  430. char *sheetname;
  431. lxw_row_t first_row;
  432. lxw_row_t last_row;
  433. lxw_col_t first_col;
  434. lxw_col_t last_col;
  435. uint8_t ignore_cache;
  436. uint8_t has_string_cache;
  437. uint16_t num_data_points;
  438. struct lxw_series_data_points *data_cache;
  439. } lxw_series_range;
  440. typedef struct lxw_series_data_point {
  441. uint8_t is_string;
  442. double number;
  443. char *string;
  444. uint8_t no_data;
  445. STAILQ_ENTRY (lxw_series_data_point) list_pointers;
  446. } lxw_series_data_point;
  447. /**
  448. * @brief Struct to represent a chart line.
  449. *
  450. * See @ref chart_lines.
  451. */
  452. typedef struct lxw_chart_line {
  453. /** The chart font color. See @ref working_with_colors. */
  454. lxw_color_t color;
  455. /** Turn off/hide line. Set to 0 or 1.*/
  456. uint8_t none;
  457. /** Width of the line in increments of 0.25. Default is 2.25. */
  458. float width;
  459. /** The line dash type. See #lxw_chart_line_dash_type. */
  460. uint8_t dash_type;
  461. /** Set the transparency of the line. 0 - 100. Default 0. */
  462. uint8_t transparency;
  463. /* Members for internal use only. */
  464. uint8_t has_color;
  465. } lxw_chart_line;
  466. /**
  467. * @brief Struct to represent a chart fill.
  468. *
  469. * See @ref chart_fills.
  470. */
  471. typedef struct lxw_chart_fill {
  472. /** The chart font color. See @ref working_with_colors. */
  473. lxw_color_t color;
  474. /** Turn off/hide line. Set to 0 or 1.*/
  475. uint8_t none;
  476. /** Set the transparency of the fill. 0 - 100. Default 0. */
  477. uint8_t transparency;
  478. /* Members for internal use only. */
  479. uint8_t has_color;
  480. } lxw_chart_fill;
  481. /**
  482. * @brief Struct to represent a chart pattern.
  483. *
  484. * See @ref chart_patterns.
  485. */
  486. typedef struct lxw_chart_pattern {
  487. /** The pattern foreground color. See @ref working_with_colors. */
  488. lxw_color_t fg_color;
  489. /** The pattern background color. See @ref working_with_colors. */
  490. lxw_color_t bg_color;
  491. /** The pattern type. See #lxw_chart_pattern_type. */
  492. uint8_t type;
  493. /* Members for internal use only. */
  494. uint8_t has_fg_color;
  495. uint8_t has_bg_color;
  496. } lxw_chart_pattern;
  497. /**
  498. * @brief Struct to represent a chart font.
  499. *
  500. * See @ref chart_fonts.
  501. */
  502. typedef struct lxw_chart_font {
  503. /** The chart font name, such as "Arial" or "Calibri". */
  504. char *name;
  505. /** The chart font size. The default is 11. */
  506. double size;
  507. /** The chart font bold property. Set to 0 or 1. */
  508. uint8_t bold;
  509. /** The chart font italic property. Set to 0 or 1. */
  510. uint8_t italic;
  511. /** The chart font underline property. Set to 0 or 1. */
  512. uint8_t underline;
  513. /** The chart font rotation property. Range: -90 to 90. */
  514. int32_t rotation;
  515. /** The chart font color. See @ref working_with_colors. */
  516. lxw_color_t color;
  517. /** The chart font pitch family property. Rarely required. set to 0. */
  518. uint8_t pitch_family;
  519. /** The chart font character set property. Rarely required. set to 0. */
  520. uint8_t charset;
  521. /** The chart font baseline property. Rarely required. set to 0. */
  522. int8_t baseline;
  523. /* Members for internal use only. */
  524. uint8_t has_color;
  525. } lxw_chart_font;
  526. typedef struct lxw_chart_marker {
  527. uint8_t type;
  528. uint8_t size;
  529. lxw_chart_line *line;
  530. lxw_chart_fill *fill;
  531. lxw_chart_pattern *pattern;
  532. } lxw_chart_marker;
  533. typedef struct lxw_chart_legend {
  534. lxw_chart_font *font;
  535. uint8_t position;
  536. } lxw_chart_legend;
  537. typedef struct lxw_chart_title {
  538. char *name;
  539. lxw_row_t row;
  540. lxw_col_t col;
  541. lxw_chart_font *font;
  542. uint8_t off;
  543. uint8_t is_horizontal;
  544. uint8_t ignore_cache;
  545. /* We use a range to hold the title formula properties even though it
  546. * will only have 1 point in order to re-use similar functions.*/
  547. lxw_series_range *range;
  548. struct lxw_series_data_point data_point;
  549. } lxw_chart_title;
  550. /**
  551. * @brief Struct to represent an Excel chart data point.
  552. *
  553. * The lxw_chart_point used to set the line, fill and pattern of one or more
  554. * points in a chart data series. See @ref chart_points.
  555. */
  556. typedef struct lxw_chart_point {
  557. /** The line/border for the chart point. See @ref chart_lines. */
  558. lxw_chart_line *line;
  559. /** The fill for the chart point. See @ref chart_fills. */
  560. lxw_chart_fill *fill;
  561. /** The pattern for the chart point. See @ref chart_patterns.*/
  562. lxw_chart_pattern *pattern;
  563. } lxw_chart_point;
  564. /**
  565. * @brief Define how blank values are displayed in a chart.
  566. */
  567. typedef enum lxw_chart_blank {
  568. /** Show empty chart cells as gaps in the data. The default. */
  569. LXW_CHART_BLANKS_AS_GAP,
  570. /** Show empty chart cells as zeros. */
  571. LXW_CHART_BLANKS_AS_ZERO,
  572. /** Show empty chart cells as connected. Only for charts with lines. */
  573. LXW_CHART_BLANKS_AS_CONNECTED
  574. } lxw_chart_blank;
  575. enum lxw_chart_position {
  576. LXW_CHART_AXIS_RIGHT,
  577. LXW_CHART_AXIS_LEFT,
  578. LXW_CHART_AXIS_TOP,
  579. LXW_CHART_AXIS_BOTTOM
  580. };
  581. /**
  582. * @brief Type/amount of data series error bar.
  583. */
  584. typedef enum lxw_chart_error_bar_type {
  585. /** Error bar type: Standard error. */
  586. LXW_CHART_ERROR_BAR_TYPE_STD_ERROR,
  587. /** Error bar type: Fixed value. */
  588. LXW_CHART_ERROR_BAR_TYPE_FIXED,
  589. /** Error bar type: Percentage. */
  590. LXW_CHART_ERROR_BAR_TYPE_PERCENTAGE,
  591. /** Error bar type: Standard deviation(s). */
  592. LXW_CHART_ERROR_BAR_TYPE_STD_DEV
  593. } lxw_chart_error_bar_type;
  594. /**
  595. * @brief Direction for a data series error bar.
  596. */
  597. typedef enum lxw_chart_error_bar_direction {
  598. /** Error bar extends in both directions. The default. */
  599. LXW_CHART_ERROR_BAR_DIR_BOTH,
  600. /** Error bar extends in positive direction. */
  601. LXW_CHART_ERROR_BAR_DIR_PLUS,
  602. /** Error bar extends in negative direction. */
  603. LXW_CHART_ERROR_BAR_DIR_MINUS
  604. } lxw_chart_error_bar_direction;
  605. /**
  606. * @brief Direction for a data series error bar.
  607. */
  608. typedef enum lxw_chart_error_bar_axis {
  609. /** X axis error bar. */
  610. LXW_CHART_ERROR_BAR_AXIS_X,
  611. /** Y axis error bar. */
  612. LXW_CHART_ERROR_BAR_AXIS_Y
  613. } lxw_chart_error_bar_axis;
  614. /**
  615. * @brief End cap styles for a data series error bar.
  616. */
  617. typedef enum lxw_chart_error_bar_cap {
  618. /** Flat end cap. The default. */
  619. LXW_CHART_ERROR_BAR_END_CAP,
  620. /** No end cap. */
  621. LXW_CHART_ERROR_BAR_NO_CAP
  622. } lxw_chart_error_bar_cap;
  623. typedef struct lxw_series_error_bars {
  624. uint8_t type;
  625. uint8_t direction;
  626. uint8_t endcap;
  627. uint8_t has_value;
  628. uint8_t is_set;
  629. uint8_t is_x;
  630. uint8_t chart_group;
  631. double value;
  632. lxw_chart_line *line;
  633. } lxw_series_error_bars;
  634. /**
  635. * @brief Series trendline/regression types.
  636. */
  637. typedef enum lxw_chart_trendline_type {
  638. /** Trendline type: Linear. */
  639. LXW_CHART_TRENDLINE_TYPE_LINEAR,
  640. /** Trendline type: Logarithm. */
  641. LXW_CHART_TRENDLINE_TYPE_LOG,
  642. /** Trendline type: Polynomial. */
  643. LXW_CHART_TRENDLINE_TYPE_POLY,
  644. /** Trendline type: Power. */
  645. LXW_CHART_TRENDLINE_TYPE_POWER,
  646. /** Trendline type: Exponential. */
  647. LXW_CHART_TRENDLINE_TYPE_EXP,
  648. /** Trendline type: Moving Average. */
  649. LXW_CHART_TRENDLINE_TYPE_AVERAGE
  650. } lxw_chart_trendline_type;
  651. /**
  652. * @brief Struct to represent an Excel chart data series.
  653. *
  654. * The lxw_chart_series is created using the chart_add_series function. It is
  655. * used in functions that modify a chart series but the members of the struct
  656. * aren't modified directly.
  657. */
  658. typedef struct lxw_chart_series {
  659. lxw_series_range *categories;
  660. lxw_series_range *values;
  661. lxw_chart_title title;
  662. lxw_chart_line *line;
  663. lxw_chart_fill *fill;
  664. lxw_chart_pattern *pattern;
  665. lxw_chart_marker *marker;
  666. lxw_chart_point *points;
  667. uint16_t point_count;
  668. uint8_t smooth;
  669. uint8_t invert_if_negative;
  670. /* Data label parameters. */
  671. uint8_t has_labels;
  672. uint8_t show_labels_value;
  673. uint8_t show_labels_category;
  674. uint8_t show_labels_name;
  675. uint8_t show_labels_leader;
  676. uint8_t show_labels_legend;
  677. uint8_t show_labels_percent;
  678. uint8_t label_position;
  679. uint8_t label_separator;
  680. uint8_t default_label_position;
  681. char *label_num_format;
  682. lxw_chart_font *label_font;
  683. lxw_series_error_bars *x_error_bars;
  684. lxw_series_error_bars *y_error_bars;
  685. uint8_t has_trendline;
  686. uint8_t has_trendline_forecast;
  687. uint8_t has_trendline_equation;
  688. uint8_t has_trendline_r_squared;
  689. uint8_t has_trendline_intercept;
  690. uint8_t trendline_type;
  691. uint8_t trendline_value;
  692. double trendline_forward;
  693. double trendline_backward;
  694. uint8_t trendline_value_type;
  695. char *trendline_name;
  696. lxw_chart_line *trendline_line;
  697. double trendline_intercept;
  698. STAILQ_ENTRY (lxw_chart_series) list_pointers;
  699. } lxw_chart_series;
  700. /* Struct for major/minor axis gridlines. */
  701. typedef struct lxw_chart_gridline {
  702. uint8_t visible;
  703. lxw_chart_line *line;
  704. } lxw_chart_gridline;
  705. /**
  706. * @brief Struct to represent an Excel chart axis.
  707. *
  708. * The lxw_chart_axis struct is used in functions that modify a chart axis
  709. * but the members of the struct aren't modified directly.
  710. */
  711. typedef struct lxw_chart_axis {
  712. lxw_chart_title title;
  713. char *num_format;
  714. char *default_num_format;
  715. uint8_t source_linked;
  716. uint8_t major_tick_mark;
  717. uint8_t minor_tick_mark;
  718. uint8_t is_horizontal;
  719. lxw_chart_gridline major_gridlines;
  720. lxw_chart_gridline minor_gridlines;
  721. lxw_chart_font *num_font;
  722. lxw_chart_line *line;
  723. lxw_chart_fill *fill;
  724. lxw_chart_pattern *pattern;
  725. uint8_t is_category;
  726. uint8_t is_date;
  727. uint8_t is_value;
  728. uint8_t axis_position;
  729. uint8_t position_axis;
  730. uint8_t label_position;
  731. uint8_t hidden;
  732. uint8_t reverse;
  733. uint8_t has_min;
  734. double min;
  735. uint8_t has_max;
  736. double max;
  737. uint8_t has_major_unit;
  738. double major_unit;
  739. uint8_t has_minor_unit;
  740. double minor_unit;
  741. uint16_t interval_unit;
  742. uint16_t interval_tick;
  743. uint16_t log_base;
  744. uint8_t display_units;
  745. uint8_t display_units_visible;
  746. uint8_t has_crossing;
  747. uint8_t crossing_max;
  748. double crossing;
  749. } lxw_chart_axis;
  750. /**
  751. * @brief Struct to represent an Excel chart.
  752. *
  753. * The members of the lxw_chart struct aren't modified directly. Instead
  754. * the chart properties are set by calling the functions shown in chart.h.
  755. */
  756. typedef struct lxw_chart {
  757. FILE *file;
  758. uint8_t type;
  759. uint8_t subtype;
  760. uint16_t series_index;
  761. void (*write_chart_type) (struct lxw_chart *);
  762. void (*write_plot_area) (struct lxw_chart *);
  763. /**
  764. * A pointer to the chart x_axis object which can be used in functions
  765. * that configures the X axis.
  766. */
  767. lxw_chart_axis *x_axis;
  768. /**
  769. * A pointer to the chart y_axis object which can be used in functions
  770. * that configures the Y axis.
  771. */
  772. lxw_chart_axis *y_axis;
  773. lxw_chart_title title;
  774. uint32_t id;
  775. uint32_t axis_id_1;
  776. uint32_t axis_id_2;
  777. uint32_t axis_id_3;
  778. uint32_t axis_id_4;
  779. uint8_t in_use;
  780. uint8_t chart_group;
  781. uint8_t cat_has_num_fmt;
  782. uint8_t has_horiz_cat_axis;
  783. uint8_t has_horiz_val_axis;
  784. uint8_t style_id;
  785. uint16_t rotation;
  786. uint16_t hole_size;
  787. uint8_t no_title;
  788. uint8_t has_overlap;
  789. int8_t overlap_y1;
  790. int8_t overlap_y2;
  791. uint16_t gap_y1;
  792. uint16_t gap_y2;
  793. uint8_t grouping;
  794. uint8_t default_cross_between;
  795. lxw_chart_legend legend;
  796. int16_t *delete_series;
  797. uint16_t delete_series_count;
  798. lxw_chart_marker *default_marker;
  799. lxw_chart_line *chartarea_line;
  800. lxw_chart_fill *chartarea_fill;
  801. lxw_chart_pattern *chartarea_pattern;
  802. lxw_chart_line *plotarea_line;
  803. lxw_chart_fill *plotarea_fill;
  804. lxw_chart_pattern *plotarea_pattern;
  805. uint8_t has_drop_lines;
  806. lxw_chart_line *drop_lines_line;
  807. uint8_t has_high_low_lines;
  808. lxw_chart_line *high_low_lines_line;
  809. struct lxw_chart_series_list *series_list;
  810. uint8_t has_table;
  811. uint8_t has_table_vertical;
  812. uint8_t has_table_horizontal;
  813. uint8_t has_table_outline;
  814. uint8_t has_table_legend_keys;
  815. lxw_chart_font *table_font;
  816. uint8_t show_blanks_as;
  817. uint8_t show_hidden_data;
  818. uint8_t has_up_down_bars;
  819. lxw_chart_line *up_bar_line;
  820. lxw_chart_line *down_bar_line;
  821. lxw_chart_fill *up_bar_fill;
  822. lxw_chart_fill *down_bar_fill;
  823. uint8_t default_label_position;
  824. STAILQ_ENTRY (lxw_chart) ordered_list_pointers;
  825. STAILQ_ENTRY (lxw_chart) list_pointers;
  826. } lxw_chart;
  827. /* *INDENT-OFF* */
  828. #ifdef __cplusplus
  829. extern "C" {
  830. #endif
  831. /* *INDENT-ON* */
  832. lxw_chart *lxw_chart_new(uint8_t type);
  833. void lxw_chart_free(lxw_chart *chart);
  834. void lxw_chart_assemble_xml_file(lxw_chart *chart);
  835. /**
  836. * @brief Add a data series to a chart.
  837. *
  838. * @param chart Pointer to a lxw_chart instance to be configured.
  839. * @param categories The range of categories in the data series.
  840. * @param values The range of values in the data series.
  841. *
  842. * @return A lxw_chart_series object pointer.
  843. *
  844. * In Excel a chart **series** is a collection of information that defines
  845. * which data is plotted such as the categories and values. It is also used to
  846. * define the formatting for the data.
  847. *
  848. * For an libxlsxwriter chart object the `%chart_add_series()` function is
  849. * used to set the categories and values of the series:
  850. *
  851. * @code
  852. * chart_add_series(chart, "=Sheet1!$A$2:$A$7", "=Sheet1!$C$2:$C$7");
  853. * @endcode
  854. *
  855. *
  856. * The series parameters are:
  857. *
  858. * - `categories`: This sets the chart category labels. The category is more
  859. * or less the same as the X axis. In most Excel chart types the
  860. * `categories` property is optional and the chart will just assume a
  861. * sequential series from `1..n`:
  862. *
  863. * @code
  864. * // The NULL category will default to 1 to 5 like in Excel.
  865. * chart_add_series(chart, NULL, "Sheet1!$A$1:$A$5");
  866. * @endcode
  867. *
  868. * - `values`: This is the most important property of a series and is the
  869. * only mandatory option for every chart object. This parameter links the
  870. * chart with the worksheet data that it displays.
  871. *
  872. * The `categories` and `values` should be a string formula like
  873. * `"=Sheet1!$A$2:$A$7"` in the same way it is represented in Excel. This is
  874. * convenient when recreating a chart from an example in Excel but it is
  875. * trickier to generate programmatically. For these cases you can set the
  876. * `categories` and `values` to `NULL` and use the
  877. * `chart_series_set_categories()` and `chart_series_set_values()` functions:
  878. *
  879. * @code
  880. * lxw_chart_series *series = chart_add_series(chart, NULL, NULL);
  881. *
  882. * // Configure the series using a syntax that is easier to define programmatically.
  883. * chart_series_set_categories(series, "Sheet1", 1, 0, 6, 0); // "=Sheet1!$A$2:$A$7"
  884. * chart_series_set_values( series, "Sheet1", 1, 2, 6, 2); // "=Sheet1!$C$2:$C$7"
  885. * @endcode
  886. *
  887. * As shown in the previous example the return value from
  888. * `%chart_add_series()` is a lxw_chart_series pointer. This can be used in
  889. * other functions that configure a series.
  890. *
  891. *
  892. * More than one series can be added to a chart. The series numbering and
  893. * order in the Excel chart will be the same as the order in which they are
  894. * added in libxlsxwriter:
  895. *
  896. * @code
  897. * chart_add_series(chart, NULL, "Sheet1!$A$1:$A$5");
  898. * chart_add_series(chart, NULL, "Sheet1!$B$1:$B$5");
  899. * chart_add_series(chart, NULL, "Sheet1!$C$1:$C$5");
  900. * @endcode
  901. *
  902. * It is also possible to specify non-contiguous ranges:
  903. *
  904. * @code
  905. * chart_add_series(
  906. * chart,
  907. * "=(Sheet1!$A$1:$A$9,Sheet1!$A$14:$A$25)",
  908. * "=(Sheet1!$B$1:$B$9,Sheet1!$B$14:$B$25)"
  909. * );
  910. * @endcode
  911. *
  912. */
  913. lxw_chart_series *chart_add_series(lxw_chart *chart,
  914. const char *categories,
  915. const char *values);
  916. /**
  917. * @brief Set a series "categories" range using row and column values.
  918. *
  919. * @param series A series object created via `chart_add_series()`.
  920. * @param sheetname The name of the worksheet that contains the data range.
  921. * @param first_row The first row of the range. (All zero indexed.)
  922. * @param first_col The first column of the range.
  923. * @param last_row The last row of the range.
  924. * @param last_col The last col of the range.
  925. *
  926. * The `categories` and `values` of a chart data series are generally set
  927. * using the `chart_add_series()` function and Excel range formulas like
  928. * `"=Sheet1!$A$2:$A$7"`.
  929. *
  930. * The `%chart_series_set_categories()` function is an alternative method that
  931. * is easier to generate programmatically. It requires that you set the
  932. * `categories` and `values` parameters in `chart_add_series()`to `NULL` and
  933. * then set them using row and column values in
  934. * `chart_series_set_categories()` and `chart_series_set_values()`:
  935. *
  936. * @code
  937. * lxw_chart_series *series = chart_add_series(chart, NULL, NULL);
  938. *
  939. * // Configure the series ranges programmatically.
  940. * chart_series_set_categories(series, "Sheet1", 1, 0, 6, 0); // "=Sheet1!$A$2:$A$7"
  941. * chart_series_set_values( series, "Sheet1", 1, 2, 6, 2); // "=Sheet1!$C$2:$C$7"
  942. * @endcode
  943. *
  944. */
  945. void chart_series_set_categories(lxw_chart_series *series,
  946. const char *sheetname, lxw_row_t first_row,
  947. lxw_col_t first_col, lxw_row_t last_row,
  948. lxw_col_t last_col);
  949. /**
  950. * @brief Set a series "values" range using row and column values.
  951. *
  952. * @param series A series object created via `chart_add_series()`.
  953. * @param sheetname The name of the worksheet that contains the data range.
  954. * @param first_row The first row of the range. (All zero indexed.)
  955. * @param first_col The first column of the range.
  956. * @param last_row The last row of the range.
  957. * @param last_col The last col of the range.
  958. *
  959. * The `categories` and `values` of a chart data series are generally set
  960. * using the `chart_add_series()` function and Excel range formulas like
  961. * `"=Sheet1!$A$2:$A$7"`.
  962. *
  963. * The `%chart_series_set_values()` function is an alternative method that is
  964. * easier to generate programmatically. See the documentation for
  965. * `chart_series_set_categories()` above.
  966. */
  967. void chart_series_set_values(lxw_chart_series *series, const char *sheetname,
  968. lxw_row_t first_row, lxw_col_t first_col,
  969. lxw_row_t last_row, lxw_col_t last_col);
  970. /**
  971. * @brief Set the name of a chart series range.
  972. *
  973. * @param series A series object created via `chart_add_series()`.
  974. * @param name The series name.
  975. *
  976. * The `%chart_series_set_name` function is used to set the name for a chart
  977. * data series. The series name in Excel is displayed in the chart legend and
  978. * in the formula bar. The name property is optional and if it isn't supplied
  979. * it will default to `Series 1..n`.
  980. *
  981. * The function applies to a #lxw_chart_series object created using
  982. * `chart_add_series()`:
  983. *
  984. * @code
  985. * lxw_chart_series *series = chart_add_series(chart, NULL, "=Sheet1!$B$2:$B$7");
  986. *
  987. * chart_series_set_name(series, "Quarterly budget data");
  988. * @endcode
  989. *
  990. * The name parameter can also be a formula such as `=Sheet1!$A$1` to point to
  991. * a cell in the workbook that contains the name:
  992. *
  993. * @code
  994. * lxw_chart_series *series = chart_add_series(chart, NULL, "=Sheet1!$B$2:$B$7");
  995. *
  996. * chart_series_set_name(series, "=Sheet1!$B1$1");
  997. * @endcode
  998. *
  999. * See also the `chart_series_set_name_range()` function to see how to set the
  1000. * name formula programmatically.
  1001. */
  1002. void chart_series_set_name(lxw_chart_series *series, const char *name);
  1003. /**
  1004. * @brief Set a series name formula using row and column values.
  1005. *
  1006. * @param series A series object created via `chart_add_series()`.
  1007. * @param sheetname The name of the worksheet that contains the cell range.
  1008. * @param row The zero indexed row number of the range.
  1009. * @param col The zero indexed column number of the range.
  1010. *
  1011. * The `%chart_series_set_name_range()` function can be used to set a series
  1012. * name range and is an alternative to using `chart_series_set_name()` and a
  1013. * string formula:
  1014. *
  1015. * @code
  1016. * lxw_chart_series *series = chart_add_series(chart, NULL, "=Sheet1!$B$2:$B$7");
  1017. *
  1018. * chart_series_set_name_range(series, "Sheet1", 0, 2); // "=Sheet1!$C$1"
  1019. * @endcode
  1020. */
  1021. void chart_series_set_name_range(lxw_chart_series *series,
  1022. const char *sheetname, lxw_row_t row,
  1023. lxw_col_t col);
  1024. /**
  1025. * @brief Set the line properties for a chart series.
  1026. *
  1027. * @param series A series object created via `chart_add_series()`.
  1028. * @param line A #lxw_chart_line struct.
  1029. *
  1030. * Set the line/border properties of a chart series:
  1031. *
  1032. * @code
  1033. * lxw_chart_line line = {.color = LXW_COLOR_RED};
  1034. *
  1035. * chart_series_set_line(series1, &line);
  1036. * chart_series_set_line(series2, &line);
  1037. * chart_series_set_line(series3, &line);
  1038. * @endcode
  1039. *
  1040. * @image html chart_series_set_line.png
  1041. *
  1042. * For more information see @ref chart_lines.
  1043. */
  1044. void chart_series_set_line(lxw_chart_series *series, lxw_chart_line *line);
  1045. /**
  1046. * @brief Set the fill properties for a chart series.
  1047. *
  1048. * @param series A series object created via `chart_add_series()`.
  1049. * @param fill A #lxw_chart_fill struct.
  1050. *
  1051. * Set the fill properties of a chart series:
  1052. *
  1053. * @code
  1054. * lxw_chart_fill fill1 = {.color = LXW_COLOR_RED};
  1055. * lxw_chart_fill fill2 = {.color = LXW_COLOR_YELLOW};
  1056. * lxw_chart_fill fill3 = {.color = LXW_COLOR_GREEN};
  1057. *
  1058. * chart_series_set_fill(series1, &fill1);
  1059. * chart_series_set_fill(series2, &fill2);
  1060. * chart_series_set_fill(series3, &fill3);
  1061. * @endcode
  1062. *
  1063. * @image html chart_series_set_fill.png
  1064. *
  1065. * For more information see @ref chart_fills.
  1066. */
  1067. void chart_series_set_fill(lxw_chart_series *series, lxw_chart_fill *fill);
  1068. /**
  1069. * @brief Invert the fill color for negative series values.
  1070. *
  1071. * @param series A series object created via `chart_add_series()`.
  1072. *
  1073. * Invert the fill color for negative values. Usually only applicable to
  1074. * column and bar charts.
  1075. *
  1076. * @code
  1077. * chart_series_set_invert_if_negative(series);
  1078. * @endcode
  1079. *
  1080. */
  1081. void chart_series_set_invert_if_negative(lxw_chart_series *series);
  1082. /**
  1083. * @brief Set the pattern properties for a chart series.
  1084. *
  1085. * @param series A series object created via `chart_add_series()`.
  1086. * @param pattern A #lxw_chart_pattern struct.
  1087. *
  1088. * Set the pattern properties of a chart series:
  1089. *
  1090. * @code
  1091. * lxw_chart_pattern pattern1 = {.type = LXW_CHART_PATTERN_SHINGLE,
  1092. * .fg_color = 0x804000,
  1093. * .bg_color = 0XC68C53};
  1094. *
  1095. * lxw_chart_pattern pattern2 = {.type = LXW_CHART_PATTERN_HORIZONTAL_BRICK,
  1096. * .fg_color = 0XB30000,
  1097. * .bg_color = 0XFF6666};
  1098. *
  1099. * chart_series_set_pattern(series1, &pattern1);
  1100. * chart_series_set_pattern(series2, &pattern2);
  1101. *
  1102. * @endcode
  1103. *
  1104. * @image html chart_pattern.png
  1105. *
  1106. * For more information see #lxw_chart_pattern_type and @ref chart_patterns.
  1107. */
  1108. void chart_series_set_pattern(lxw_chart_series *series,
  1109. lxw_chart_pattern *pattern);
  1110. /**
  1111. * @brief Set the data marker type for a series.
  1112. *
  1113. * @param series A series object created via `chart_add_series()`.
  1114. * @param type The marker type, see #lxw_chart_marker_type.
  1115. *
  1116. * In Excel a chart marker is used to distinguish data points in a plotted
  1117. * series. In general only Line and Scatter and Radar chart types use
  1118. * markers. The libxlsxwriter chart types that can have markers are:
  1119. *
  1120. * - #LXW_CHART_LINE
  1121. * - #LXW_CHART_SCATTER
  1122. * - #LXW_CHART_SCATTER_STRAIGHT
  1123. * - #LXW_CHART_SCATTER_STRAIGHT_WITH_MARKERS
  1124. * - #LXW_CHART_SCATTER_SMOOTH
  1125. * - #LXW_CHART_SCATTER_SMOOTH_WITH_MARKERS
  1126. * - #LXW_CHART_RADAR
  1127. * - #LXW_CHART_RADAR_WITH_MARKERS
  1128. *
  1129. * The chart types with `MARKERS` in the name have markers with default colors
  1130. * and shapes turned on by default but it is possible using the various
  1131. * `chart_series_set_marker_xxx()` functions below to change these defaults. It
  1132. * is also possible to turn on an off markers.
  1133. *
  1134. * The `%chart_series_set_marker_type()` function is used to specify the
  1135. * type of the series marker:
  1136. *
  1137. * @code
  1138. * chart_series_set_marker_type(series, LXW_CHART_MARKER_DIAMOND);
  1139. * @endcode
  1140. *
  1141. * @image html chart_marker1.png
  1142. *
  1143. * The available marker types defined by #lxw_chart_marker_type are:
  1144. *
  1145. * - #LXW_CHART_MARKER_AUTOMATIC
  1146. * - #LXW_CHART_MARKER_NONE
  1147. * - #LXW_CHART_MARKER_SQUARE
  1148. * - #LXW_CHART_MARKER_DIAMOND
  1149. * - #LXW_CHART_MARKER_TRIANGLE
  1150. * - #LXW_CHART_MARKER_X
  1151. * - #LXW_CHART_MARKER_STAR
  1152. * - #LXW_CHART_MARKER_SHORT_DASH
  1153. * - #LXW_CHART_MARKER_LONG_DASH
  1154. * - #LXW_CHART_MARKER_CIRCLE
  1155. * - #LXW_CHART_MARKER_PLUS
  1156. *
  1157. * The `#LXW_CHART_MARKER_NONE` type can be used to turn off default markers:
  1158. *
  1159. * @code
  1160. * chart_series_set_marker_type(series, LXW_CHART_MARKER_NONE);
  1161. * @endcode
  1162. *
  1163. * @image html chart_series_set_marker_none.png
  1164. *
  1165. * The `#LXW_CHART_MARKER_AUTOMATIC` type is a special case which turns on a
  1166. * marker using the default marker style for the particular series. If
  1167. * automatic is on then other marker properties such as size, line or fill
  1168. * cannot be set.
  1169. */
  1170. void chart_series_set_marker_type(lxw_chart_series *series, uint8_t type);
  1171. /**
  1172. * @brief Set the size of a data marker for a series.
  1173. *
  1174. * @param series A series object created via `chart_add_series()`.
  1175. * @param size The size of the marker.
  1176. *
  1177. * The `%chart_series_set_marker_size()` function is used to specify the
  1178. * size of the series marker:
  1179. *
  1180. * @code
  1181. * chart_series_set_marker_type(series, LXW_CHART_MARKER_CIRCLE);
  1182. * chart_series_set_marker_size(series, 10);
  1183. * @endcode
  1184. *
  1185. * @image html chart_series_set_marker_size.png
  1186. *
  1187. */
  1188. void chart_series_set_marker_size(lxw_chart_series *series, uint8_t size);
  1189. /**
  1190. * @brief Set the line properties for a chart series marker.
  1191. *
  1192. * @param series A series object created via `chart_add_series()`.
  1193. * @param line A #lxw_chart_line struct.
  1194. *
  1195. * Set the line/border properties of a chart marker:
  1196. *
  1197. * @code
  1198. * lxw_chart_line line = {.color = LXW_COLOR_BLACK};
  1199. * lxw_chart_fill fill = {.color = LXW_COLOR_RED};
  1200. *
  1201. * chart_series_set_marker_type(series, LXW_CHART_MARKER_SQUARE);
  1202. * chart_series_set_marker_size(series, 8);
  1203. *
  1204. * chart_series_set_marker_line(series, &line);
  1205. * chart_series_set_marker_fill(series, &fill);
  1206. * @endcode
  1207. *
  1208. * @image html chart_marker2.png
  1209. *
  1210. * For more information see @ref chart_lines.
  1211. */
  1212. void chart_series_set_marker_line(lxw_chart_series *series,
  1213. lxw_chart_line *line);
  1214. /**
  1215. * @brief Set the fill properties for a chart series marker.
  1216. *
  1217. * @param series A series object created via `chart_add_series()`.
  1218. * @param fill A #lxw_chart_fill struct.
  1219. *
  1220. * Set the fill properties of a chart marker:
  1221. *
  1222. * @code
  1223. * chart_series_set_marker_fill(series, &fill);
  1224. * @endcode
  1225. *
  1226. * See the example and image above and also see @ref chart_fills.
  1227. */
  1228. void chart_series_set_marker_fill(lxw_chart_series *series,
  1229. lxw_chart_fill *fill);
  1230. /**
  1231. * @brief Set the pattern properties for a chart series marker.
  1232. *
  1233. * @param series A series object created via `chart_add_series()`.
  1234. * @param pattern A #lxw_chart_pattern struct.
  1235. *
  1236. * Set the pattern properties of a chart marker:
  1237. *
  1238. * @code
  1239. * chart_series_set_marker_pattern(series, &pattern);
  1240. * @endcode
  1241. *
  1242. * For more information see #lxw_chart_pattern_type and @ref chart_patterns.
  1243. */
  1244. void chart_series_set_marker_pattern(lxw_chart_series *series,
  1245. lxw_chart_pattern *pattern);
  1246. /**
  1247. * @brief Set the formatting for points in the series.
  1248. *
  1249. * @param series A series object created via `chart_add_series()`.
  1250. * @param points An NULL terminated array of #lxw_chart_point pointers.
  1251. *
  1252. * @return A #lxw_error.
  1253. *
  1254. * In general formatting is applied to an entire series in a chart. However,
  1255. * it is occasionally required to format individual points in a series. In
  1256. * particular this is required for Pie/Doughnut charts where each segment is
  1257. * represented by a point.
  1258. *
  1259. * @dontinclude chart_pie_colors.c
  1260. * @skip Add the data series
  1261. * @until chart_series_set_points
  1262. *
  1263. * @image html chart_points1.png
  1264. *
  1265. * @note The array of #lxw_chart_point pointers should be NULL terminated
  1266. * as shown in the example.
  1267. *
  1268. * For more details see @ref chart_points
  1269. */
  1270. lxw_error chart_series_set_points(lxw_chart_series *series,
  1271. lxw_chart_point *points[]);
  1272. /**
  1273. * @brief Smooth a line or scatter chart series.
  1274. *
  1275. * @param series A series object created via `chart_add_series()`.
  1276. * @param smooth Turn off/on the line smoothing. (0/1)
  1277. *
  1278. * The `chart_series_set_smooth()` function is used to set the smooth property
  1279. * of a line series. It is only applicable to the line and scatter chart
  1280. * types:
  1281. *
  1282. * @code
  1283. * chart_series_set_smooth(series2, LXW_TRUE);
  1284. * @endcode
  1285. *
  1286. * @image html chart_smooth.png
  1287. *
  1288. *
  1289. */
  1290. void chart_series_set_smooth(lxw_chart_series *series, uint8_t smooth);
  1291. /**
  1292. * @brief Add data labels to a chart series.
  1293. *
  1294. * @param series A series object created via `chart_add_series()`.
  1295. *
  1296. * The `%chart_series_set_labels()` function is used to turn on data labels
  1297. * for a chart series. Data labels indicate the values of the plotted data
  1298. * points.
  1299. *
  1300. * @code
  1301. * chart_series_set_labels(series);
  1302. * @endcode
  1303. *
  1304. * @image html chart_labels1.png
  1305. *
  1306. * By default data labels are displayed in Excel with only the values shown:
  1307. *
  1308. * @image html chart_labels2.png
  1309. *
  1310. * However, it is possible to configure other display options, as shown
  1311. * in the functions below.
  1312. *
  1313. * For more information see @ref chart_labels.
  1314. */
  1315. void chart_series_set_labels(lxw_chart_series *series);
  1316. /**
  1317. * @brief Set the display options for the labels of a data series.
  1318. *
  1319. * @param series A series object created via `chart_add_series()`.
  1320. * @param show_name Turn on/off the series name in the label caption.
  1321. * @param show_category Turn on/off the category name in the label caption.
  1322. * @param show_value Turn on/off the value in the label caption.
  1323. *
  1324. * The `%chart_series_set_labels_options()` function is used to set the
  1325. * parameters that are displayed in the series data label:
  1326. *
  1327. * @code
  1328. * chart_series_set_labels(series);
  1329. * chart_series_set_labels_options(series, LXW_TRUE, LXW_TRUE, LXW_TRUE);
  1330. * @endcode
  1331. *
  1332. * @image html chart_labels3.png
  1333. *
  1334. * For more information see @ref chart_labels.
  1335. */
  1336. void chart_series_set_labels_options(lxw_chart_series *series,
  1337. uint8_t show_name, uint8_t show_category,
  1338. uint8_t show_value);
  1339. /**
  1340. * @brief Set the separator for the data label captions.
  1341. *
  1342. * @param series A series object created via `chart_add_series()`.
  1343. * @param separator The separator for the data label options:
  1344. * #lxw_chart_label_separator.
  1345. *
  1346. * The `%chart_series_set_labels_separator()` function is used to change the
  1347. * separator between multiple data label items. The default options is a comma
  1348. * separator as shown in the previous example.
  1349. *
  1350. * The available options are:
  1351. *
  1352. * - #LXW_CHART_LABEL_SEPARATOR_SEMICOLON: semicolon separator.
  1353. * - #LXW_CHART_LABEL_SEPARATOR_PERIOD: a period (dot) separator.
  1354. * - #LXW_CHART_LABEL_SEPARATOR_NEWLINE: a newline separator.
  1355. * - #LXW_CHART_LABEL_SEPARATOR_SPACE: a space separator.
  1356. *
  1357. * For example:
  1358. *
  1359. * @code
  1360. * chart_series_set_labels(series);
  1361. * chart_series_set_labels_options(series, LXW_TRUE, LXW_TRUE, LXW_TRUE);
  1362. * chart_series_set_labels_separator(series, LXW_CHART_LABEL_SEPARATOR_NEWLINE);
  1363. * @endcode
  1364. *
  1365. * @image html chart_labels4.png
  1366. *
  1367. * For more information see @ref chart_labels.
  1368. */
  1369. void chart_series_set_labels_separator(lxw_chart_series *series,
  1370. uint8_t separator);
  1371. /**
  1372. * @brief Set the data label position for a series.
  1373. *
  1374. * @param series A series object created via `chart_add_series()`.
  1375. * @param position The data label position: #lxw_chart_label_position.
  1376. *
  1377. * The `%chart_series_set_labels_position()` function sets the position of
  1378. * the labels in the data series:
  1379. *
  1380. * @code
  1381. * chart_series_set_labels(series);
  1382. * chart_series_set_labels_position(series, LXW_CHART_LABEL_POSITION_ABOVE);
  1383. * @endcode
  1384. *
  1385. * @image html chart_labels5.png
  1386. *
  1387. * In Excel the allowable data label positions vary for different chart
  1388. * types. The allowable, and default, positions are:
  1389. *
  1390. * | Position | Line, Scatter | Bar, Column | Pie, Doughnut | Area, Radar |
  1391. * | :------------------------------------ | :------------ | :------------ | :------------ | :------------ |
  1392. * | #LXW_CHART_LABEL_POSITION_CENTER | Yes | Yes | Yes | Yes (default) |
  1393. * | #LXW_CHART_LABEL_POSITION_RIGHT | Yes (default) | | | |
  1394. * | #LXW_CHART_LABEL_POSITION_LEFT | Yes | | | |
  1395. * | #LXW_CHART_LABEL_POSITION_ABOVE | Yes | | | |
  1396. * | #LXW_CHART_LABEL_POSITION_BELOW | Yes | | | |
  1397. * | #LXW_CHART_LABEL_POSITION_INSIDE_BASE | | Yes | | |
  1398. * | #LXW_CHART_LABEL_POSITION_INSIDE_END | | Yes | Yes | |
  1399. * | #LXW_CHART_LABEL_POSITION_OUTSIDE_END | | Yes (default) | Yes | |
  1400. * | #LXW_CHART_LABEL_POSITION_BEST_FIT | | | Yes (default) | |
  1401. *
  1402. *
  1403. * For more information see @ref chart_labels.
  1404. */
  1405. void chart_series_set_labels_position(lxw_chart_series *series,
  1406. uint8_t position);
  1407. /**
  1408. * @brief Set leader lines for Pie and Doughnut charts.
  1409. *
  1410. * @param series A series object created via `chart_add_series()`.
  1411. *
  1412. * The `%chart_series_set_labels_leader_line()` function is used to turn on
  1413. * leader lines for the data label of a series. It is mainly used for pie
  1414. * or doughnut charts:
  1415. *
  1416. * @code
  1417. * chart_series_set_labels(series);
  1418. * chart_series_set_labels_leader_line(series);
  1419. * @endcode
  1420. *
  1421. * @note Even when leader lines are turned on they aren't automatically
  1422. * visible in Excel or XlsxWriter. Due to an Excel limitation
  1423. * (or design) leader lines only appear if the data label is moved
  1424. * manually or if the data labels are very close and need to be
  1425. * adjusted automatically.
  1426. *
  1427. * For more information see @ref chart_labels.
  1428. */
  1429. void chart_series_set_labels_leader_line(lxw_chart_series *series);
  1430. /**
  1431. * @brief Set the legend key for a data label in a chart series.
  1432. *
  1433. * @param series A series object created via `chart_add_series()`.
  1434. *
  1435. * The `%chart_series_set_labels_legend()` function is used to set the
  1436. * legend key for a data series:
  1437. *
  1438. * @code
  1439. * chart_series_set_labels(series);
  1440. * chart_series_set_labels_legend(series);
  1441. * @endcode
  1442. *
  1443. * @image html chart_labels6.png
  1444. *
  1445. * For more information see @ref chart_labels.
  1446. */
  1447. void chart_series_set_labels_legend(lxw_chart_series *series);
  1448. /**
  1449. * @brief Set the percentage for a Pie/Doughnut data point.
  1450. *
  1451. * @param series A series object created via `chart_add_series()`.
  1452. *
  1453. * The `%chart_series_set_labels_percentage()` function is used to turn on
  1454. * the display of data labels as a percentage for a series. It is mainly
  1455. * used for pie charts:
  1456. *
  1457. * @code
  1458. * chart_series_set_labels(series);
  1459. * chart_series_set_labels_options(series, LXW_FALSE, LXW_FALSE, LXW_FALSE);
  1460. * chart_series_set_labels_percentage(series);
  1461. * @endcode
  1462. *
  1463. * @image html chart_labels7.png
  1464. *
  1465. * For more information see @ref chart_labels.
  1466. */
  1467. void chart_series_set_labels_percentage(lxw_chart_series *series);
  1468. /**
  1469. * @brief Set the number format for chart data labels in a series.
  1470. *
  1471. * @param series A series object created via `chart_add_series()`.
  1472. * @param num_format The number format string.
  1473. *
  1474. * The `%chart_series_set_labels_num_format()` function is used to set the
  1475. * number format for data labels:
  1476. *
  1477. * @code
  1478. * chart_series_set_labels(series);
  1479. * chart_series_set_labels_num_format(series, "$0.00");
  1480. * @endcode
  1481. *
  1482. * @image html chart_labels8.png
  1483. *
  1484. * The number format is similar to the Worksheet Cell Format num_format,
  1485. * see `format_set_num_format()`.
  1486. *
  1487. * For more information see @ref chart_labels.
  1488. */
  1489. void chart_series_set_labels_num_format(lxw_chart_series *series,
  1490. const char *num_format);
  1491. /**
  1492. * @brief Set the font properties for chart data labels in a series
  1493. *
  1494. * @param series A series object created via `chart_add_series()`.
  1495. * @param font A pointer to a chart #lxw_chart_font font struct.
  1496. *
  1497. *
  1498. * The `%chart_series_set_labels_font()` function is used to set the font
  1499. * for data labels:
  1500. *
  1501. * @code
  1502. * lxw_chart_font font = {.name = "Consolas", .color = LXW_COLOR_RED};
  1503. *
  1504. * chart_series_set_labels(series);
  1505. * chart_series_set_labels_font(series, &font);
  1506. * @endcode
  1507. *
  1508. * @image html chart_labels9.png
  1509. *
  1510. * For more information see @ref chart_fonts and @ref chart_labels.
  1511. *
  1512. */
  1513. void chart_series_set_labels_font(lxw_chart_series *series,
  1514. lxw_chart_font *font);
  1515. /**
  1516. * @brief Turn on a trendline for a chart data series.
  1517. *
  1518. * @param series A series object created via `chart_add_series()`.
  1519. * @param type The type of trendline: #lxw_chart_trendline_type.
  1520. * @param value The order/period value for polynomial and moving average
  1521. * trendlines.
  1522. *
  1523. * A trendline can be added to a chart series to indicate trends in the data
  1524. * such as a moving average or a polynomial fit. The trendlines types are
  1525. * shown in the following Excel dialog:
  1526. *
  1527. * @image html chart_trendline0.png
  1528. *
  1529. * The `%chart_series_set_trendline()` function turns on these trendlines for
  1530. * a data series:
  1531. *
  1532. * @code
  1533. * chart = workbook_add_chart(workbook, LXW_CHART_LINE);
  1534. * series = chart_add_series(chart, NULL, "Sheet1!$A$1:$A$6");
  1535. *
  1536. * chart_series_set_trendline(series, LXW_CHART_TRENDLINE_TYPE_LINEAR, 0);
  1537. * @endcode
  1538. *
  1539. * @image html chart_trendline2.png
  1540. *
  1541. * The `value` parameter corresponds to *order* for a polynomial trendline
  1542. * and *period* for a Moving Average trendline. It both cases it must be >= 2.
  1543. * The `value` parameter is ignored for all other trendlines:
  1544. *
  1545. * @code
  1546. * chart_series_set_trendline(series, LXW_CHART_TRENDLINE_TYPE_AVERAGE, 2);
  1547. * @endcode
  1548. *
  1549. * @image html chart_trendline3.png
  1550. *
  1551. * The allowable values for the the trendline `type` are:
  1552. *
  1553. * - #LXW_CHART_TRENDLINE_TYPE_LINEAR: Linear trendline.
  1554. * - #LXW_CHART_TRENDLINE_TYPE_LOG: Logarithm trendline.
  1555. * - #LXW_CHART_TRENDLINE_TYPE_POLY: Polynomial trendline. The `value`
  1556. * parameter corresponds to *order*.
  1557. * - #LXW_CHART_TRENDLINE_TYPE_POWER: Power trendline.
  1558. * - #LXW_CHART_TRENDLINE_TYPE_EXP: Exponential trendline.
  1559. * - #LXW_CHART_TRENDLINE_TYPE_AVERAGE: Moving Average trendline. The `value`
  1560. * parameter corresponds to *period*.
  1561. *
  1562. * Other trendline options, such as those shown in the following Excel
  1563. * dialog, can be set using the functions below.
  1564. *
  1565. * @image html chart_trendline1.png
  1566. *
  1567. * For more information see @ref chart_trendlines.
  1568. */
  1569. void chart_series_set_trendline(lxw_chart_series *series, uint8_t type,
  1570. uint8_t value);
  1571. /**
  1572. * @brief Set the trendline forecast for a chart data series.
  1573. *
  1574. * @param series A series object created via `chart_add_series()`.
  1575. * @param forward The forward period.
  1576. * @param backward The backwards period.
  1577. *
  1578. * The `%chart_series_set_trendline_forecast()` function sets the forward
  1579. * and backward forecast periods for the trendline:
  1580. *
  1581. * @code
  1582. * chart_series_set_trendline(series, LXW_CHART_TRENDLINE_TYPE_LINEAR, 0);
  1583. * chart_series_set_trendline_forecast(series, 0.5, 0.5);
  1584. * @endcode
  1585. *
  1586. * @image html chart_trendline4.png
  1587. *
  1588. * @note This feature isn't available for Moving Average in Excel.
  1589. *
  1590. * For more information see @ref chart_trendlines.
  1591. */
  1592. void chart_series_set_trendline_forecast(lxw_chart_series *series,
  1593. double forward, double backward);
  1594. /**
  1595. * @brief Display the equation of a trendline for a chart data series.
  1596. *
  1597. * @param series A series object created via `chart_add_series()`.
  1598. *
  1599. * The `%chart_series_set_trendline_equation()` function displays the
  1600. * equation of the trendline on the chart:
  1601. *
  1602. * @code
  1603. * chart_series_set_trendline(series, LXW_CHART_TRENDLINE_TYPE_LINEAR, 0);
  1604. * chart_series_set_trendline_equation(series);
  1605. * @endcode
  1606. *
  1607. * @image html chart_trendline5.png
  1608. *
  1609. * @note This feature isn't available for Moving Average in Excel.
  1610. *
  1611. * For more information see @ref chart_trendlines.
  1612. */
  1613. void chart_series_set_trendline_equation(lxw_chart_series *series);
  1614. /**
  1615. * @brief Display the R squared value of a trendline for a chart data series.
  1616. *
  1617. * @param series A series object created via `chart_add_series()`.
  1618. *
  1619. * The `%chart_series_set_trendline_r_squared()` function displays the
  1620. * R-squared value for the trendline on the chart:
  1621. *
  1622. * @code
  1623. * chart_series_set_trendline(series, LXW_CHART_TRENDLINE_TYPE_LINEAR, 0);
  1624. * chart_series_set_trendline_r_squared(series);
  1625. * @endcode
  1626. *
  1627. * @image html chart_trendline6.png
  1628. *
  1629. * @note This feature isn't available for Moving Average in Excel.
  1630. *
  1631. * For more information see @ref chart_trendlines.
  1632. */
  1633. void chart_series_set_trendline_r_squared(lxw_chart_series *series);
  1634. /**
  1635. * @brief Set the trendline Y-axis intercept for a chart data series.
  1636. *
  1637. * @param series A series object created via `chart_add_series()`.
  1638. * @param intercept Y-axis intercept value.
  1639. *
  1640. * The `%chart_series_set_trendline_intercept()` function sets the Y-axis
  1641. * intercept for the trendline:
  1642. *
  1643. * @code
  1644. * chart_series_set_trendline(series, LXW_CHART_TRENDLINE_TYPE_LINEAR, 0);
  1645. * chart_series_set_trendline_equation(series);
  1646. * chart_series_set_trendline_intercept(series, 0.8);
  1647. * @endcode
  1648. *
  1649. * @image html chart_trendline7.png
  1650. *
  1651. * As can be seen from the equation on the chart the intercept point
  1652. * (when X=0) is the same as the value set in the equation.
  1653. *
  1654. * @note The intercept feature is only available in Excel for Exponential,
  1655. * Linear and Polynomial trendline types.
  1656. *
  1657. * For more information see @ref chart_trendlines.
  1658. */
  1659. void chart_series_set_trendline_intercept(lxw_chart_series *series,
  1660. double intercept);
  1661. /**
  1662. * @brief Set the trendline name for a chart data series.
  1663. *
  1664. * @param series A series object created via `chart_add_series()`.
  1665. * @param name The name of the trendline to display in the legend.
  1666. *
  1667. * The `%chart_series_set_trendline_name()` function sets the name of the
  1668. * trendline that is displayed in the chart legend. In the examples above
  1669. * the trendlines are displayed with default names like "Linear (Series 1)"
  1670. * and "2 per Mov. Avg. (Series 1)". If these names are too verbose or not
  1671. * descriptive enough you can set your own trendline name:
  1672. *
  1673. * @code
  1674. * chart_series_set_trendline(series, LXW_CHART_TRENDLINE_TYPE_LINEAR, 0);
  1675. * chart_series_set_trendline_name(series, "My trendline");
  1676. * @endcode
  1677. *
  1678. * @image html chart_trendline8.png
  1679. *
  1680. * It is often preferable to turn off the trendline caption in the legend.
  1681. * This is down in Excel by deleting the trendline name from the legend.
  1682. * In libxlsxwriter this is done using the `chart_legend_delete_series()`
  1683. * function to delete the zero based series numbers:
  1684. *
  1685. * @code
  1686. * chart_series_set_trendline(series, LXW_CHART_TRENDLINE_TYPE_LINEAR, 0);
  1687. *
  1688. * // Delete the series name for the second series (=1 in zero base).
  1689. * // The -1 value indicates the end of the array of values.
  1690. * int16_t names[] = {1, -1};
  1691. * chart_legend_delete_series(chart, names);
  1692. * @endcode
  1693. *
  1694. * @image html chart_trendline9.png
  1695. *
  1696. * For more information see @ref chart_trendlines.
  1697. */
  1698. void chart_series_set_trendline_name(lxw_chart_series *series,
  1699. const char *name);
  1700. /**
  1701. * @brief Set the trendline line properties for a chart data series.
  1702. *
  1703. * @param series A series object created via `chart_add_series()`.
  1704. * @param line A #lxw_chart_line struct.
  1705. *
  1706. * The `%chart_series_set_trendline_line()` function is used to set the line
  1707. * properties of a trendline:
  1708. *
  1709. * @code
  1710. * lxw_chart_line line = {.color = LXW_COLOR_RED,
  1711. * .dash_type = LXW_CHART_LINE_DASH_LONG_DASH};
  1712. *
  1713. * chart_series_set_trendline(series, LXW_CHART_TRENDLINE_TYPE_LINEAR, 0);
  1714. * chart_series_set_trendline_line(series, &line);
  1715. * @endcode
  1716. *
  1717. * @image html chart_trendline10.png
  1718. *
  1719. * For more information see @ref chart_trendlines and @ref chart_lines.
  1720. */
  1721. void chart_series_set_trendline_line(lxw_chart_series *series,
  1722. lxw_chart_line *line);
  1723. /**
  1724. * @brief Get a pointer to X or Y error bars from a chart series.
  1725. *
  1726. * @param series A series object created via `chart_add_series()`.
  1727. * @param axis_type The axis type (X or Y): #lxw_chart_error_bar_axis.
  1728. *
  1729. * The `%chart_series_get_error_bars()` function returns a pointer to the
  1730. * error bars of a series based on the type of #lxw_chart_error_bar_axis:
  1731. *
  1732. * @code
  1733. * lxw_series_error_bars *x_error_bars;
  1734. * lxw_series_error_bars *y_error_bars;
  1735. *
  1736. * x_error_bars = chart_series_get_error_bars(series, LXW_CHART_ERROR_BAR_AXIS_X);
  1737. * y_error_bars = chart_series_get_error_bars(series, LXW_CHART_ERROR_BAR_AXIS_Y);
  1738. *
  1739. * // Use the error bar pointers.
  1740. * chart_series_set_error_bars(x_error_bars,
  1741. * LXW_CHART_ERROR_BAR_TYPE_STD_DEV, 1);
  1742. *
  1743. * chart_series_set_error_bars(y_error_bars,
  1744. * LXW_CHART_ERROR_BAR_TYPE_STD_ERROR, 0);
  1745. * @endcode
  1746. *
  1747. * Note, the series error bars can also be accessed directly:
  1748. *
  1749. * @code
  1750. * // Equivalent to the above example, without function calls.
  1751. * chart_series_set_error_bars(series->x_error_bars,
  1752. * LXW_CHART_ERROR_BAR_TYPE_STD_DEV, 1);
  1753. *
  1754. * chart_series_set_error_bars(series->y_error_bars,
  1755. * LXW_CHART_ERROR_BAR_TYPE_STD_ERROR, 0);
  1756. * @endcode
  1757. *
  1758. * @return Pointer to the series error bars, or NULL if not found.
  1759. */
  1760. lxw_series_error_bars *chart_series_get_error_bars(lxw_chart_series *series, lxw_chart_error_bar_axis
  1761. axis_type);
  1762. /**
  1763. * Set the X or Y error bars for a chart series.
  1764. *
  1765. * @param error_bars A pointer to the series X or Y error bars.
  1766. * @param type The type of error bar: #lxw_chart_error_bar_type.
  1767. * @param value The error value.
  1768. *
  1769. * Error bars can be added to a chart series to indicate error bounds in the
  1770. * data. The error bars can be vertical `y_error_bars` (the most common type)
  1771. * or horizontal `x_error_bars` (for Bar and Scatter charts only).
  1772. *
  1773. * @image html chart_error_bars0.png
  1774. *
  1775. * The `%chart_series_set_error_bars()` function sets the error bar type
  1776. * and value associated with the type:
  1777. *
  1778. * @code
  1779. * lxw_chart_series *series = chart_add_series(chart,
  1780. * "=Sheet1!$A$1:$A$5",
  1781. * "=Sheet1!$B$1:$B$5");
  1782. *
  1783. * chart_series_set_error_bars(series->y_error_bars,
  1784. * LXW_CHART_ERROR_BAR_TYPE_STD_ERROR, 0);
  1785. * @endcode
  1786. *
  1787. * @image html chart_error_bars1.png
  1788. *
  1789. * The error bar types that be used are:
  1790. *
  1791. * - #LXW_CHART_ERROR_BAR_TYPE_STD_ERROR: Standard error.
  1792. * - #LXW_CHART_ERROR_BAR_TYPE_FIXED: Fixed value.
  1793. * - #LXW_CHART_ERROR_BAR_TYPE_PERCENTAGE: Percentage.
  1794. * - #LXW_CHART_ERROR_BAR_TYPE_STD_DEV: Standard deviation(s).
  1795. *
  1796. * @note Custom error bars are not currently supported.
  1797. *
  1798. * All error bar types, apart from Standard error, should have a valid
  1799. * value to set the error range:
  1800. *
  1801. * @code
  1802. * chart_series_set_error_bars(series1->y_error_bars,
  1803. * LXW_CHART_ERROR_BAR_TYPE_FIXED, 2);
  1804. *
  1805. * chart_series_set_error_bars(series2->y_error_bars,
  1806. * LXW_CHART_ERROR_BAR_TYPE_PERCENTAGE, 5);
  1807. *
  1808. * chart_series_set_error_bars(series3->y_error_bars,
  1809. * LXW_CHART_ERROR_BAR_TYPE_STD_DEV, 1);
  1810. * @endcode
  1811. *
  1812. * For the Standard error type the value is ignored.
  1813. *
  1814. * For more information see @ref chart_error_bars.
  1815. */
  1816. void chart_series_set_error_bars(lxw_series_error_bars *error_bars,
  1817. uint8_t type, double value);
  1818. /**
  1819. * @brief Set the direction (up, down or both) of the error bars for a chart
  1820. * series.
  1821. *
  1822. * @param error_bars A pointer to the series X or Y error bars.
  1823. * @param direction The bar direction: #lxw_chart_error_bar_direction.
  1824. *
  1825. * The `%chart_series_set_error_bars_direction()` function sets the
  1826. * direction of the error bars:
  1827. *
  1828. * @code
  1829. * chart_series_set_error_bars(series->y_error_bars,
  1830. * LXW_CHART_ERROR_BAR_TYPE_STD_ERROR, 0);
  1831. *
  1832. * chart_series_set_error_bars_direction(series->y_error_bars,
  1833. * LXW_CHART_ERROR_BAR_DIR_PLUS);
  1834. * @endcode
  1835. *
  1836. * @image html chart_error_bars2.png
  1837. *
  1838. * The valid directions are:
  1839. *
  1840. * - #LXW_CHART_ERROR_BAR_DIR_BOTH: Error bar extends in both directions.
  1841. * The default.
  1842. * - #LXW_CHART_ERROR_BAR_DIR_PLUS: Error bar extends in positive direction.
  1843. * - #LXW_CHART_ERROR_BAR_DIR_MINUS: Error bar extends in negative direction.
  1844. *
  1845. * For more information see @ref chart_error_bars.
  1846. */
  1847. void chart_series_set_error_bars_direction(lxw_series_error_bars *error_bars,
  1848. uint8_t direction);
  1849. /**
  1850. * @brief Set the end cap type for the error bars of a chart series.
  1851. *
  1852. * @param error_bars A pointer to the series X or Y error bars.
  1853. * @param endcap The error bar end cap type: #lxw_chart_error_bar_cap .
  1854. *
  1855. * The `%chart_series_set_error_bars_endcap()` function sets the end cap
  1856. * type for the error bars:
  1857. *
  1858. * @code
  1859. * chart_series_set_error_bars(series->y_error_bars,
  1860. * LXW_CHART_ERROR_BAR_TYPE_STD_ERROR, 0);
  1861. *
  1862. * chart_series_set_error_bars_endcap(series->y_error_bars,
  1863. LXW_CHART_ERROR_BAR_NO_CAP);
  1864. * @endcode
  1865. *
  1866. * @image html chart_error_bars3.png
  1867. *
  1868. * The valid values are:
  1869. *
  1870. * - #LXW_CHART_ERROR_BAR_END_CAP: Flat end cap. The default.
  1871. * - #LXW_CHART_ERROR_BAR_NO_CAP: No end cap.
  1872. *
  1873. * For more information see @ref chart_error_bars.
  1874. */
  1875. void chart_series_set_error_bars_endcap(lxw_series_error_bars *error_bars,
  1876. uint8_t endcap);
  1877. /**
  1878. * @brief Set the line properties for a chart series error bars.
  1879. *
  1880. * @param error_bars A pointer to the series X or Y error bars.
  1881. * @param line A #lxw_chart_line struct.
  1882. *
  1883. * The `%chart_series_set_error_bars_line()` function sets the line
  1884. * properties for the error bars:
  1885. *
  1886. * @code
  1887. * lxw_chart_line line = {.color = LXW_COLOR_RED,
  1888. * .dash_type = LXW_CHART_LINE_DASH_ROUND_DOT};
  1889. *
  1890. * chart_series_set_error_bars(series->y_error_bars,
  1891. * LXW_CHART_ERROR_BAR_TYPE_STD_ERROR, 0);
  1892. *
  1893. * chart_series_set_error_bars_line(series->y_error_bars, &line);
  1894. * @endcode
  1895. *
  1896. * @image html chart_error_bars4.png
  1897. *
  1898. * For more information see @ref chart_lines and @ref chart_error_bars.
  1899. */
  1900. void chart_series_set_error_bars_line(lxw_series_error_bars *error_bars,
  1901. lxw_chart_line *line);
  1902. /**
  1903. * @brief Get an axis pointer from a chart.
  1904. *
  1905. * @param chart Pointer to a lxw_chart instance to be configured.
  1906. * @param axis_type The axis type (X or Y): #lxw_chart_axis_type.
  1907. *
  1908. * The `%chart_axis_get()` function returns a pointer to a chart axis based
  1909. * on the #lxw_chart_axis_type:
  1910. *
  1911. * @code
  1912. * lxw_chart_axis *x_axis = chart_axis_get(chart, LXW_CHART_AXIS_TYPE_X);
  1913. * lxw_chart_axis *y_axis = chart_axis_get(chart, LXW_CHART_AXIS_TYPE_Y);
  1914. *
  1915. * // Use the axis pointer in other functions.
  1916. * chart_axis_major_gridlines_set_visible(x_axis, LXW_TRUE);
  1917. * chart_axis_major_gridlines_set_visible(y_axis, LXW_TRUE);
  1918. * @endcode
  1919. *
  1920. * Note, the axis pointer can also be accessed directly:
  1921. *
  1922. * @code
  1923. * // Equivalent to the above example, without function calls.
  1924. * chart_axis_major_gridlines_set_visible(chart->x_axis, LXW_TRUE);
  1925. * chart_axis_major_gridlines_set_visible(chart->y_axis, LXW_TRUE);
  1926. * @endcode
  1927. *
  1928. * @return Pointer to the chart axis, or NULL if not found.
  1929. */
  1930. lxw_chart_axis *chart_axis_get(lxw_chart *chart,
  1931. lxw_chart_axis_type axis_type);
  1932. /**
  1933. * @brief Set the name caption of the an axis.
  1934. *
  1935. * @param axis A pointer to a chart #lxw_chart_axis object.
  1936. * @param name The name caption of the axis.
  1937. *
  1938. * The `%chart_axis_set_name()` function sets the name (also known as title or
  1939. * caption) for an axis. It can be used for the X or Y axes. The name is
  1940. * displayed below an X axis and to the side of a Y axis.
  1941. *
  1942. * @code
  1943. * chart_axis_set_name(chart->x_axis, "Earnings per Quarter");
  1944. * chart_axis_set_name(chart->y_axis, "US Dollars (Millions)");
  1945. * @endcode
  1946. *
  1947. * @image html chart_axis_set_name.png
  1948. *
  1949. * The name parameter can also be a formula such as `=Sheet1!$A$1` to point to
  1950. * a cell in the workbook that contains the name:
  1951. *
  1952. * @code
  1953. * chart_axis_set_name(chart->x_axis, "=Sheet1!$B1$1");
  1954. * @endcode
  1955. *
  1956. * See also the `chart_axis_set_name_range()` function to see how to set the
  1957. * name formula programmatically.
  1958. *
  1959. * **Axis types**: This function is applicable to to all axes types.
  1960. * See @ref ww_charts_axes.
  1961. */
  1962. void chart_axis_set_name(lxw_chart_axis *axis, const char *name);
  1963. /**
  1964. * @brief Set a chart axis name formula using row and column values.
  1965. *
  1966. * @param axis A pointer to a chart #lxw_chart_axis object.
  1967. * @param sheetname The name of the worksheet that contains the cell range.
  1968. * @param row The zero indexed row number of the range.
  1969. * @param col The zero indexed column number of the range.
  1970. *
  1971. * The `%chart_axis_set_name_range()` function can be used to set an axis name
  1972. * range and is an alternative to using `chart_axis_set_name()` and a string
  1973. * formula:
  1974. *
  1975. * @code
  1976. * chart_axis_set_name_range(chart->x_axis, "Sheet1", 1, 0);
  1977. * chart_axis_set_name_range(chart->y_axis, "Sheet1", 2, 0);
  1978. * @endcode
  1979. *
  1980. * **Axis types**: This function is applicable to to all axes types.
  1981. * See @ref ww_charts_axes.
  1982. */
  1983. void chart_axis_set_name_range(lxw_chart_axis *axis, const char *sheetname,
  1984. lxw_row_t row, lxw_col_t col);
  1985. /**
  1986. * @brief Set the font properties for a chart axis name.
  1987. *
  1988. * @param axis A pointer to a chart #lxw_chart_axis object.
  1989. * @param font A pointer to a chart #lxw_chart_font font struct.
  1990. *
  1991. * The `%chart_axis_set_name_font()` function is used to set the font of an
  1992. * axis name:
  1993. *
  1994. * @code
  1995. * lxw_chart_font font = {.bold = LXW_TRUE, .color = LXW_COLOR_BLUE};
  1996. *
  1997. * chart_axis_set_name(chart->x_axis, "Yearly data");
  1998. * chart_axis_set_name_font(chart->x_axis, &font);
  1999. * @endcode
  2000. *
  2001. * @image html chart_axis_set_name_font.png
  2002. *
  2003. * For more information see @ref chart_fonts.
  2004. *
  2005. * **Axis types**: This function is applicable to to all axes types.
  2006. * See @ref ww_charts_axes.
  2007. */
  2008. void chart_axis_set_name_font(lxw_chart_axis *axis, lxw_chart_font *font);
  2009. /**
  2010. * @brief Set the font properties for the numbers of a chart axis.
  2011. *
  2012. * @param axis A pointer to a chart #lxw_chart_axis object.
  2013. * @param font A pointer to a chart #lxw_chart_font font struct.
  2014. *
  2015. * The `%chart_axis_set_num_font()` function is used to set the font of the
  2016. * numbers on an axis:
  2017. *
  2018. * @code
  2019. * lxw_chart_font font = {.bold = LXW_TRUE, .color = LXW_COLOR_BLUE};
  2020. *
  2021. * chart_axis_set_num_font(chart->x_axis, &font1);
  2022. * @endcode
  2023. *
  2024. * @image html chart_axis_set_num_font.png
  2025. *
  2026. * For more information see @ref chart_fonts.
  2027. *
  2028. * **Axis types**: This function is applicable to to all axes types.
  2029. * See @ref ww_charts_axes.
  2030. */
  2031. void chart_axis_set_num_font(lxw_chart_axis *axis, lxw_chart_font *font);
  2032. /**
  2033. * @brief Set the number format for a chart axis.
  2034. *
  2035. * @param axis A pointer to a chart #lxw_chart_axis object.
  2036. * @param num_format The number format string.
  2037. *
  2038. * The `%chart_axis_set_num_format()` function is used to set the format of
  2039. * the numbers on an axis:
  2040. *
  2041. * @code
  2042. * chart_axis_set_num_format(chart->x_axis, "0.00%");
  2043. * chart_axis_set_num_format(chart->y_axis, "$#,##0.00");
  2044. * @endcode
  2045. *
  2046. * The number format is similar to the Worksheet Cell Format num_format,
  2047. * see `format_set_num_format()`.
  2048. *
  2049. * @image html chart_axis_num_format.png
  2050. *
  2051. * **Axis types**: This function is applicable to to all axes types.
  2052. * See @ref ww_charts_axes.
  2053. */
  2054. void chart_axis_set_num_format(lxw_chart_axis *axis, const char *num_format);
  2055. /**
  2056. * @brief Set the line properties for a chart axis.
  2057. *
  2058. * @param axis A pointer to a chart #lxw_chart_axis object.
  2059. * @param line A #lxw_chart_line struct.
  2060. *
  2061. * Set the line properties of a chart axis:
  2062. *
  2063. * @code
  2064. * // Hide the Y axis.
  2065. * lxw_chart_line line = {.none = LXW_TRUE};
  2066. *
  2067. * chart_axis_set_line(chart->y_axis, &line);
  2068. * @endcode
  2069. *
  2070. * @image html chart_axis_set_line.png
  2071. *
  2072. * For more information see @ref chart_lines.
  2073. *
  2074. * **Axis types**: This function is applicable to to all axes types.
  2075. * See @ref ww_charts_axes.
  2076. */
  2077. void chart_axis_set_line(lxw_chart_axis *axis, lxw_chart_line *line);
  2078. /**
  2079. * @brief Set the fill properties for a chart axis.
  2080. *
  2081. * @param axis A pointer to a chart #lxw_chart_axis object.
  2082. * @param fill A #lxw_chart_fill struct.
  2083. *
  2084. * Set the fill properties of a chart axis:
  2085. *
  2086. * @code
  2087. * lxw_chart_fill fill = {.color = LXW_COLOR_YELLOW};
  2088. *
  2089. * chart_axis_set_fill(chart->y_axis, &fill);
  2090. * @endcode
  2091. *
  2092. * @image html chart_axis_set_fill.png
  2093. *
  2094. * For more information see @ref chart_fills.
  2095. *
  2096. * **Axis types**: This function is applicable to to all axes types.
  2097. * See @ref ww_charts_axes.
  2098. */
  2099. void chart_axis_set_fill(lxw_chart_axis *axis, lxw_chart_fill *fill);
  2100. /**
  2101. * @brief Set the pattern properties for a chart axis.
  2102. *
  2103. * @param axis A pointer to a chart #lxw_chart_axis object.
  2104. * @param pattern A #lxw_chart_pattern struct.
  2105. *
  2106. * Set the pattern properties of a chart axis:
  2107. *
  2108. * @code
  2109. * chart_axis_set_pattern(chart->y_axis, &pattern);
  2110. * @endcode
  2111. *
  2112. * For more information see #lxw_chart_pattern_type and @ref chart_patterns.
  2113. *
  2114. * **Axis types**: This function is applicable to to all axes types.
  2115. * See @ref ww_charts_axes.
  2116. */
  2117. void chart_axis_set_pattern(lxw_chart_axis *axis, lxw_chart_pattern *pattern);
  2118. /**
  2119. * @brief Reverse the order of the axis categories or values.
  2120. *
  2121. * @param axis A pointer to a chart #lxw_chart_axis object.
  2122. *
  2123. * Reverse the order of the axis categories or values:
  2124. *
  2125. * @code
  2126. * chart_axis_set_reverse(chart->x_axis);
  2127. * @endcode
  2128. *
  2129. * @image html chart_reverse.png
  2130. *
  2131. * **Axis types**: This function is applicable to to all axes types.
  2132. * See @ref ww_charts_axes.
  2133. */
  2134. void chart_axis_set_reverse(lxw_chart_axis *axis);
  2135. /**
  2136. * @brief Set the position that the axis will cross the opposite axis.
  2137. *
  2138. * @param axis A pointer to a chart #lxw_chart_axis object.
  2139. * @param value The category or value that the axis crosses at.
  2140. *
  2141. * Set the position that the axis will cross the opposite axis:
  2142. *
  2143. * @code
  2144. * chart_axis_set_crossing(chart->x_axis, 3);
  2145. * chart_axis_set_crossing(chart->y_axis, 8);
  2146. * @endcode
  2147. *
  2148. * @image html chart_crossing1.png
  2149. *
  2150. * If crossing is omitted (the default) the crossing will be set automatically
  2151. * by Excel based on the chart data.
  2152. *
  2153. * **Axis types**: This function is applicable to to all axes types.
  2154. * See @ref ww_charts_axes.
  2155. */
  2156. void chart_axis_set_crossing(lxw_chart_axis *axis, double value);
  2157. /**
  2158. * @brief Set the opposite axis crossing position as the axis maximum.
  2159. *
  2160. * @param axis A pointer to a chart #lxw_chart_axis object.
  2161. *
  2162. * Set the position that the opposite axis will cross as the axis maximum.
  2163. * The default axis crossing position is generally the axis minimum so this
  2164. * function can be used to reverse the location of the axes without reversing
  2165. * the number sequence:
  2166. *
  2167. * @code
  2168. * chart_axis_set_crossing_max(chart->x_axis);
  2169. * chart_axis_set_crossing_max(chart->y_axis);
  2170. * @endcode
  2171. *
  2172. * @image html chart_crossing2.png
  2173. *
  2174. * **Axis types**: This function is applicable to to all axes types.
  2175. * See @ref ww_charts_axes.
  2176. */
  2177. void chart_axis_set_crossing_max(lxw_chart_axis *axis);
  2178. /**
  2179. * @brief Turn off/hide an axis.
  2180. *
  2181. * @param axis A pointer to a chart #lxw_chart_axis object.
  2182. *
  2183. * Turn off, hide, a chart axis:
  2184. *
  2185. * @code
  2186. * chart_axis_off(chart->x_axis);
  2187. * @endcode
  2188. *
  2189. * @image html chart_axis_off.png
  2190. *
  2191. * **Axis types**: This function is applicable to to all axes types.
  2192. * See @ref ww_charts_axes.
  2193. */
  2194. void chart_axis_off(lxw_chart_axis *axis);
  2195. /**
  2196. * @brief Position a category axis on or between the axis tick marks.
  2197. *
  2198. * @param axis A pointer to a chart #lxw_chart_axis object.
  2199. * @param position A #lxw_chart_axis_tick_position value.
  2200. *
  2201. * Position a category axis horizontally on, or between, the axis tick marks.
  2202. *
  2203. * There are two allowable values:
  2204. *
  2205. * - #LXW_CHART_AXIS_POSITION_ON_TICK
  2206. * - #LXW_CHART_AXIS_POSITION_BETWEEN
  2207. *
  2208. * @code
  2209. * chart_axis_set_position(chart->x_axis, LXW_CHART_AXIS_POSITION_BETWEEN);
  2210. * @endcode
  2211. *
  2212. * @image html chart_axis_set_position.png
  2213. *
  2214. * **Axis types**: This function is applicable to category axes only.
  2215. * See @ref ww_charts_axes.
  2216. */
  2217. void chart_axis_set_position(lxw_chart_axis *axis, uint8_t position);
  2218. /**
  2219. * @brief Position the axis labels.
  2220. *
  2221. * @param axis A pointer to a chart #lxw_chart_axis object.
  2222. * @param position A #lxw_chart_axis_label_position value.
  2223. *
  2224. * Position the axis labels for the chart. The labels are the numbers, or
  2225. * strings or dates, on the axis that indicate the categories or values of
  2226. * the axis.
  2227. *
  2228. * For example:
  2229. *
  2230. * @code
  2231. * chart_axis_set_label_position(chart->x_axis, LXW_CHART_AXIS_LABEL_POSITION_HIGH);
  2232. chart_axis_set_label_position(chart->y_axis, LXW_CHART_AXIS_LABEL_POSITION_HIGH);
  2233. * @endcode
  2234. *
  2235. * @image html chart_label_position2.png
  2236. *
  2237. * The allowable values:
  2238. *
  2239. * - #LXW_CHART_AXIS_LABEL_POSITION_NEXT_TO - The default.
  2240. * - #LXW_CHART_AXIS_LABEL_POSITION_HIGH - Also right for vertical axes.
  2241. * - #LXW_CHART_AXIS_LABEL_POSITION_LOW - Also left for vertical axes.
  2242. * - #LXW_CHART_AXIS_LABEL_POSITION_NONE
  2243. *
  2244. * @image html chart_label_position1.png
  2245. *
  2246. * The #LXW_CHART_AXIS_LABEL_POSITION_NONE turns off the axis labels. This
  2247. * is slightly different from `chart_axis_off()` which also turns off the
  2248. * labels but also turns off tick marks.
  2249. *
  2250. * **Axis types**: This function is applicable to to all axes types.
  2251. * See @ref ww_charts_axes.
  2252. */
  2253. void chart_axis_set_label_position(lxw_chart_axis *axis, uint8_t position);
  2254. /**
  2255. * @brief Set the minimum value for a chart axis.
  2256. *
  2257. * @param axis A pointer to a chart #lxw_chart_axis object.
  2258. * @param min Minimum value for chart axis. Value axes only.
  2259. *
  2260. * Set the minimum value for the axis range.
  2261. *
  2262. * @code
  2263. * chart_axis_set_min(chart->y_axis, -4);
  2264. * chart_axis_set_max(chart->y_axis, 21);
  2265. * @endcode
  2266. *
  2267. * @image html chart_max_min.png
  2268. *
  2269. * **Axis types**: This function is applicable to value and date axes only.
  2270. * See @ref ww_charts_axes.
  2271. */
  2272. void chart_axis_set_min(lxw_chart_axis *axis, double min);
  2273. /**
  2274. * @brief Set the maximum value for a chart axis.
  2275. *
  2276. * @param axis A pointer to a chart #lxw_chart_axis object.
  2277. * @param max Maximum value for chart axis. Value axes only.
  2278. *
  2279. * Set the maximum value for the axis range.
  2280. *
  2281. * @code
  2282. * chart_axis_set_min(chart->y_axis, -4);
  2283. * chart_axis_set_max(chart->y_axis, 21);
  2284. * @endcode
  2285. *
  2286. * See the above image.
  2287. *
  2288. * **Axis types**: This function is applicable to value and date axes only.
  2289. * See @ref ww_charts_axes.
  2290. */
  2291. void chart_axis_set_max(lxw_chart_axis *axis, double max);
  2292. /**
  2293. * @brief Set the log base of the axis range.
  2294. *
  2295. * @param axis A pointer to a chart #lxw_chart_axis object.
  2296. * @param log_base The log base for value axis. Value axes only.
  2297. *
  2298. * Set the log base for the axis:
  2299. *
  2300. * @code
  2301. * chart_axis_set_log_base(chart->y_axis, 10);
  2302. * @endcode
  2303. *
  2304. * @image html chart_log_base.png
  2305. *
  2306. * The allowable range of values for the log base in Excel is between 2 and
  2307. * 1000.
  2308. *
  2309. * **Axis types**: This function is applicable to value axes only.
  2310. * See @ref ww_charts_axes.
  2311. */
  2312. void chart_axis_set_log_base(lxw_chart_axis *axis, uint16_t log_base);
  2313. /**
  2314. * @brief Set the major axis tick mark type.
  2315. *
  2316. * @param axis A pointer to a chart #lxw_chart_axis object.
  2317. * @param type The tick mark type, defined by #lxw_chart_tick_mark.
  2318. *
  2319. * Set the type of the major axis tick mark:
  2320. *
  2321. * @code
  2322. * chart_axis_set_major_tick_mark(chart->x_axis, LXW_CHART_AXIS_TICK_MARK_CROSSING);
  2323. * chart_axis_set_minor_tick_mark(chart->x_axis, LXW_CHART_AXIS_TICK_MARK_INSIDE);
  2324. *
  2325. * chart_axis_set_major_tick_mark(chart->x_axis, LXW_CHART_AXIS_TICK_MARK_OUTSIDE);
  2326. * chart_axis_set_minor_tick_mark(chart->y_axis, LXW_CHART_AXIS_TICK_MARK_INSIDE);
  2327. *
  2328. * // Hide the default gridlines so the tick marks are visible.
  2329. * chart_axis_major_gridlines_set_visible(chart->y_axis, LXW_FALSE);
  2330. * @endcode
  2331. *
  2332. * @image html chart_tick_marks.png
  2333. *
  2334. * The tick mark types are:
  2335. *
  2336. * - #LXW_CHART_AXIS_TICK_MARK_NONE
  2337. * - #LXW_CHART_AXIS_TICK_MARK_INSIDE
  2338. * - #LXW_CHART_AXIS_TICK_MARK_OUTSIDE
  2339. * - #LXW_CHART_AXIS_TICK_MARK_CROSSING
  2340. *
  2341. * **Axis types**: This function is applicable to to all axes types.
  2342. * See @ref ww_charts_axes.
  2343. */
  2344. void chart_axis_set_major_tick_mark(lxw_chart_axis *axis, uint8_t type);
  2345. /**
  2346. * @brief Set the minor axis tick mark type.
  2347. *
  2348. * @param axis A pointer to a chart #lxw_chart_axis object.
  2349. * @param type The tick mark type, defined by #lxw_chart_tick_mark.
  2350. *
  2351. * Set the type of the minor axis tick mark:
  2352. *
  2353. * @code
  2354. * chart_axis_set_minor_tick_mark(chart->x_axis, LXW_CHART_AXIS_TICK_MARK_INSIDE);
  2355. * @endcode
  2356. *
  2357. * See the image and example above.
  2358. *
  2359. * **Axis types**: This function is applicable to to all axes types.
  2360. * See @ref ww_charts_axes.
  2361. */
  2362. void chart_axis_set_minor_tick_mark(lxw_chart_axis *axis, uint8_t type);
  2363. /**
  2364. * @brief Set the interval between category values.
  2365. *
  2366. * @param axis A pointer to a chart #lxw_chart_axis object.
  2367. * @param unit The interval between the categories.
  2368. *
  2369. * Set the interval between the category values. The default interval is 1
  2370. * which gives the intervals shown in the charts above:
  2371. *
  2372. * 1, 2, 3, 4, 5, etc.
  2373. *
  2374. * Setting it to 2 gives:
  2375. *
  2376. * 1, 3, 5, 7, etc.
  2377. *
  2378. * For example:
  2379. *
  2380. * @code
  2381. * chart_axis_set_interval_unit(chart->x_axis, 2);
  2382. * @endcode
  2383. *
  2384. * @image html chart_set_interval1.png
  2385. *
  2386. * **Axis types**: This function is applicable to category and date axes only.
  2387. * See @ref ww_charts_axes.
  2388. */
  2389. void chart_axis_set_interval_unit(lxw_chart_axis *axis, uint16_t unit);
  2390. /**
  2391. * @brief Set the interval between category tick marks.
  2392. *
  2393. * @param axis A pointer to a chart #lxw_chart_axis object.
  2394. * @param unit The interval between the category ticks.
  2395. *
  2396. * Set the interval between the category tick marks. The default interval is 1
  2397. * between each category but it can be set to other integer values:
  2398. *
  2399. * @code
  2400. * chart_axis_set_interval_tick(chart->x_axis, 2);
  2401. * @endcode
  2402. *
  2403. * @image html chart_set_interval2.png
  2404. *
  2405. * **Axis types**: This function is applicable to category and date axes only.
  2406. * See @ref ww_charts_axes.
  2407. */
  2408. void chart_axis_set_interval_tick(lxw_chart_axis *axis, uint16_t unit);
  2409. /**
  2410. * @brief Set the increment of the major units in the axis.
  2411. *
  2412. * @param axis A pointer to a chart #lxw_chart_axis object.
  2413. * @param unit The increment of the major units.
  2414. *
  2415. * Set the increment of the major units in the axis range.
  2416. *
  2417. * @code
  2418. * // Turn on the minor gridline (it is off by default).
  2419. * chart_axis_minor_gridlines_set_visible(chart->y_axis, LXW_TRUE);
  2420. *
  2421. * chart_axis_set_major_unit(chart->y_axis, 4);
  2422. * chart_axis_set_minor_unit(chart->y_axis, 2);
  2423. * @endcode
  2424. *
  2425. * @image html chart_set_major_units.png
  2426. *
  2427. * **Axis types**: This function is applicable to value and date axes only.
  2428. * See @ref ww_charts_axes.
  2429. */
  2430. void chart_axis_set_major_unit(lxw_chart_axis *axis, double unit);
  2431. /**
  2432. * @brief Set the increment of the minor units in the axis.
  2433. *
  2434. * @param axis A pointer to a chart #lxw_chart_axis object.
  2435. * @param unit The increment of the minor units.
  2436. *
  2437. * Set the increment of the minor units in the axis range.
  2438. *
  2439. * @code
  2440. * chart_axis_set_minor_unit(chart->y_axis, 2);
  2441. * @endcode
  2442. *
  2443. * See the image above
  2444. *
  2445. * **Axis types**: This function is applicable to value and date axes only.
  2446. * See @ref ww_charts_axes.
  2447. */
  2448. void chart_axis_set_minor_unit(lxw_chart_axis *axis, double unit);
  2449. /**
  2450. * @brief Set the display units for a value axis.
  2451. *
  2452. * @param axis A pointer to a chart #lxw_chart_axis object.
  2453. * @param units The display units: #lxw_chart_axis_display_unit.
  2454. *
  2455. * Set the display units for the axis. This can be useful if the axis numbers
  2456. * are very large but you don't want to represent them in scientific notation:
  2457. *
  2458. * @code
  2459. * chart_axis_set_display_units(chart->x_axis, LXW_CHART_AXIS_UNITS_THOUSANDS);
  2460. * chart_axis_set_display_units(chart->y_axis, LXW_CHART_AXIS_UNITS_MILLIONS);
  2461. * @endcode
  2462. *
  2463. * @image html chart_display_units.png
  2464. *
  2465. * **Axis types**: This function is applicable to value axes only.
  2466. * See @ref ww_charts_axes.
  2467. */
  2468. void chart_axis_set_display_units(lxw_chart_axis *axis, uint8_t units);
  2469. /**
  2470. * @brief Turn on/off the display units for a value axis.
  2471. * @param axis A pointer to a chart #lxw_chart_axis object.
  2472. * @param visible Turn off/on the display units. (0/1)
  2473. *
  2474. * Turn on or off the display units for the axis. This option is set on
  2475. * automatically by `chart_axis_set_display_units()`.
  2476. *
  2477. * @code
  2478. * chart_axis_set_display_units_visible(chart->y_axis, LXW_TRUE);
  2479. * @endcode
  2480. *
  2481. * **Axis types**: This function is applicable to value axes only.
  2482. * See @ref ww_charts_axes.
  2483. */
  2484. void chart_axis_set_display_units_visible(lxw_chart_axis *axis,
  2485. uint8_t visible);
  2486. /**
  2487. * @brief Turn on/off the major gridlines for an axis.
  2488. *
  2489. * @param axis A pointer to a chart #lxw_chart_axis object.
  2490. * @param visible Turn off/on the major gridline. (0/1)
  2491. *
  2492. * Turn on or off the major gridlines for an X or Y axis. In most Excel charts
  2493. * the Y axis major gridlines are on by default and the X axis major
  2494. * gridlines are off by default.
  2495. *
  2496. * Example:
  2497. *
  2498. * @code
  2499. * // Reverse the normal visible/hidden gridlines for a column chart.
  2500. * chart_axis_major_gridlines_set_visible(chart->x_axis, LXW_TRUE);
  2501. * chart_axis_major_gridlines_set_visible(chart->y_axis, LXW_FALSE);
  2502. * @endcode
  2503. *
  2504. * @image html chart_gridline1.png
  2505. *
  2506. * **Axis types**: This function is applicable to to all axes types.
  2507. * See @ref ww_charts_axes.
  2508. */
  2509. void chart_axis_major_gridlines_set_visible(lxw_chart_axis *axis,
  2510. uint8_t visible);
  2511. /**
  2512. * @brief Turn on/off the minor gridlines for an axis.
  2513. *
  2514. * @param axis A pointer to a chart #lxw_chart_axis object.
  2515. * @param visible Turn off/on the minor gridline. (0/1)
  2516. *
  2517. * Turn on or off the minor gridlines for an X or Y axis. In most Excel charts
  2518. * the X and Y axis minor gridlines are off by default.
  2519. *
  2520. * Example, turn on all major and minor gridlines:
  2521. *
  2522. * @code
  2523. * chart_axis_major_gridlines_set_visible(chart->x_axis, LXW_TRUE);
  2524. * chart_axis_minor_gridlines_set_visible(chart->x_axis, LXW_TRUE);
  2525. * chart_axis_major_gridlines_set_visible(chart->y_axis, LXW_TRUE);
  2526. * chart_axis_minor_gridlines_set_visible(chart->y_axis, LXW_TRUE);
  2527. * @endcode
  2528. *
  2529. * @image html chart_gridline2.png
  2530. *
  2531. * **Axis types**: This function is applicable to to all axes types.
  2532. * See @ref ww_charts_axes.
  2533. */
  2534. void chart_axis_minor_gridlines_set_visible(lxw_chart_axis *axis,
  2535. uint8_t visible);
  2536. /**
  2537. * @brief Set the line properties for the chart axis major gridlines.
  2538. *
  2539. * @param axis A pointer to a chart #lxw_chart_axis object.
  2540. * @param line A #lxw_chart_line struct.
  2541. *
  2542. * Format the line properties of the major gridlines of a chart:
  2543. *
  2544. * @code
  2545. * lxw_chart_line line1 = {.color = LXW_COLOR_RED,
  2546. * .width = 0.5,
  2547. * .dash_type = LXW_CHART_LINE_DASH_SQUARE_DOT};
  2548. *
  2549. * lxw_chart_line line2 = {.color = LXW_COLOR_YELLOW};
  2550. *
  2551. * lxw_chart_line line3 = {.width = 1.25,
  2552. * .dash_type = LXW_CHART_LINE_DASH_DASH};
  2553. *
  2554. * lxw_chart_line line4 = {.color = 0x00B050};
  2555. *
  2556. * chart_axis_major_gridlines_set_line(chart->x_axis, &line1);
  2557. * chart_axis_minor_gridlines_set_line(chart->x_axis, &line2);
  2558. * chart_axis_major_gridlines_set_line(chart->y_axis, &line3);
  2559. * chart_axis_minor_gridlines_set_line(chart->y_axis, &line4);
  2560. * @endcode
  2561. *
  2562. * @image html chart_gridline3.png
  2563. *
  2564. * For more information see @ref chart_lines.
  2565. *
  2566. * **Axis types**: This function is applicable to to all axes types.
  2567. * See @ref ww_charts_axes.
  2568. */
  2569. void chart_axis_major_gridlines_set_line(lxw_chart_axis *axis,
  2570. lxw_chart_line *line);
  2571. /**
  2572. * @brief Set the line properties for the chart axis minor gridlines.
  2573. *
  2574. * @param axis A pointer to a chart #lxw_chart_axis object.
  2575. * @param line A #lxw_chart_line struct.
  2576. *
  2577. * Format the line properties of the minor gridlines of a chart, see the
  2578. * example above.
  2579. *
  2580. * For more information see @ref chart_lines.
  2581. *
  2582. * **Axis types**: This function is applicable to to all axes types.
  2583. * See @ref ww_charts_axes.
  2584. */
  2585. void chart_axis_minor_gridlines_set_line(lxw_chart_axis *axis,
  2586. lxw_chart_line *line);
  2587. /**
  2588. * @brief Set the title of the chart.
  2589. *
  2590. * @param chart Pointer to a lxw_chart instance to be configured.
  2591. * @param name The chart title name.
  2592. *
  2593. * The `%chart_title_set_name()` function sets the name (title) for the
  2594. * chart. The name is displayed above the chart.
  2595. *
  2596. * @code
  2597. * chart_title_set_name(chart, "Year End Results");
  2598. * @endcode
  2599. *
  2600. * @image html chart_title_set_name.png
  2601. *
  2602. * The name parameter can also be a formula such as `=Sheet1!$A$1` to point to
  2603. * a cell in the workbook that contains the name:
  2604. *
  2605. * @code
  2606. * chart_title_set_name(chart, "=Sheet1!$B1$1");
  2607. * @endcode
  2608. *
  2609. * See also the `chart_title_set_name_range()` function to see how to set the
  2610. * name formula programmatically.
  2611. *
  2612. * The Excel default is to have no chart title.
  2613. */
  2614. void chart_title_set_name(lxw_chart *chart, const char *name);
  2615. /**
  2616. * @brief Set a chart title formula using row and column values.
  2617. *
  2618. * @param chart Pointer to a lxw_chart instance to be configured.
  2619. * @param sheetname The name of the worksheet that contains the cell range.
  2620. * @param row The zero indexed row number of the range.
  2621. * @param col The zero indexed column number of the range.
  2622. *
  2623. * The `%chart_title_set_name_range()` function can be used to set a chart
  2624. * title range and is an alternative to using `chart_title_set_name()` and a
  2625. * string formula:
  2626. *
  2627. * @code
  2628. * chart_title_set_name_range(chart, "Sheet1", 1, 0);
  2629. * @endcode
  2630. */
  2631. void chart_title_set_name_range(lxw_chart *chart, const char *sheetname,
  2632. lxw_row_t row, lxw_col_t col);
  2633. /**
  2634. * @brief Set the font properties for a chart title.
  2635. *
  2636. * @param chart Pointer to a lxw_chart instance to be configured.
  2637. * @param font A pointer to a chart #lxw_chart_font font struct.
  2638. *
  2639. * The `%chart_title_set_name_font()` function is used to set the font of a
  2640. * chart title:
  2641. *
  2642. * @code
  2643. * lxw_chart_font font = {.bold = LXW_TRUE, .color = LXW_COLOR_BLUE};
  2644. *
  2645. * chart_title_set_name(chart, "Year End Results");
  2646. * chart_title_set_name_font(chart, &font);
  2647. * @endcode
  2648. *
  2649. * @image html chart_title_set_name_font.png
  2650. *
  2651. * For more information see @ref chart_fonts.
  2652. */
  2653. void chart_title_set_name_font(lxw_chart *chart, lxw_chart_font *font);
  2654. /**
  2655. * @brief Turn off an automatic chart title.
  2656. *
  2657. * @param chart Pointer to a lxw_chart instance to be configured.
  2658. *
  2659. * In general in Excel a chart title isn't displayed unless the user
  2660. * explicitly adds one. However, Excel adds an automatic chart title to charts
  2661. * with a single series and a user defined series name. The
  2662. * `chart_title_off()` function allows you to turn off this automatic chart
  2663. * title:
  2664. *
  2665. * @code
  2666. * chart_title_off(chart);
  2667. * @endcode
  2668. */
  2669. void chart_title_off(lxw_chart *chart);
  2670. /**
  2671. * @brief Set the position of the chart legend.
  2672. *
  2673. * @param chart Pointer to a lxw_chart instance to be configured.
  2674. * @param position The #lxw_chart_legend_position value for the legend.
  2675. *
  2676. * The `%chart_legend_set_position()` function is used to set the chart
  2677. * legend to one of the #lxw_chart_legend_position values:
  2678. *
  2679. * LXW_CHART_LEGEND_NONE
  2680. * LXW_CHART_LEGEND_RIGHT
  2681. * LXW_CHART_LEGEND_LEFT
  2682. * LXW_CHART_LEGEND_TOP
  2683. * LXW_CHART_LEGEND_BOTTOM
  2684. * LXW_CHART_LEGEND_OVERLAY_RIGHT
  2685. * LXW_CHART_LEGEND_OVERLAY_LEFT
  2686. *
  2687. * For example:
  2688. *
  2689. * @code
  2690. * chart_legend_set_position(chart, LXW_CHART_LEGEND_BOTTOM);
  2691. * @endcode
  2692. *
  2693. * @image html chart_legend_bottom.png
  2694. *
  2695. * This function can also be used to turn off a chart legend:
  2696. *
  2697. * @code
  2698. * chart_legend_set_position(chart, LXW_CHART_LEGEND_NONE);
  2699. * @endcode
  2700. *
  2701. * @image html chart_legend_none.png
  2702. *
  2703. */
  2704. void chart_legend_set_position(lxw_chart *chart, uint8_t position);
  2705. /**
  2706. * @brief Set the font properties for a chart legend.
  2707. *
  2708. * @param chart Pointer to a lxw_chart instance to be configured.
  2709. * @param font A pointer to a chart #lxw_chart_font font struct.
  2710. *
  2711. * The `%chart_legend_set_font()` function is used to set the font of a
  2712. * chart legend:
  2713. *
  2714. * @code
  2715. * lxw_chart_font font = {.bold = LXW_TRUE, .color = LXW_COLOR_BLUE};
  2716. *
  2717. * chart_legend_set_font(chart, &font);
  2718. * @endcode
  2719. *
  2720. * @image html chart_legend_set_font.png
  2721. *
  2722. * For more information see @ref chart_fonts.
  2723. */
  2724. void chart_legend_set_font(lxw_chart *chart, lxw_chart_font *font);
  2725. /**
  2726. * @brief Remove one or more series from the the legend.
  2727. *
  2728. * @param chart Pointer to a lxw_chart instance to be configured.
  2729. * @param delete_series An array of zero-indexed values to delete from series.
  2730. *
  2731. * @return A #lxw_error.
  2732. *
  2733. * The `%chart_legend_delete_series()` function allows you to remove/hide one
  2734. * or more series in a chart legend (the series will still display on the chart).
  2735. *
  2736. * This function takes an array of one or more zero indexed series
  2737. * numbers. The array should be terminated with -1.
  2738. *
  2739. * For example to remove the first and third zero-indexed series from the
  2740. * legend of a chart with 3 series:
  2741. *
  2742. * @code
  2743. * int16_t series[] = {0, 2, -1};
  2744. *
  2745. * chart_legend_delete_series(chart, series);
  2746. * @endcode
  2747. *
  2748. * @image html chart_legend_delete.png
  2749. */
  2750. lxw_error chart_legend_delete_series(lxw_chart *chart,
  2751. int16_t delete_series[]);
  2752. /**
  2753. * @brief Set the line properties for a chartarea.
  2754. *
  2755. * @param chart Pointer to a lxw_chart instance to be configured.
  2756. * @param line A #lxw_chart_line struct.
  2757. *
  2758. * Set the line/border properties of a chartarea. In Excel the chartarea
  2759. * is the background area behind the chart:
  2760. *
  2761. * @code
  2762. * lxw_chart_line line = {.none = LXW_TRUE};
  2763. * lxw_chart_fill fill = {.color = LXW_COLOR_RED};
  2764. *
  2765. * chart_chartarea_set_line(chart, &line);
  2766. * chart_chartarea_set_fill(chart, &fill);
  2767. * @endcode
  2768. *
  2769. * @image html chart_chartarea.png
  2770. *
  2771. * For more information see @ref chart_lines.
  2772. */
  2773. void chart_chartarea_set_line(lxw_chart *chart, lxw_chart_line *line);
  2774. /**
  2775. * @brief Set the fill properties for a chartarea.
  2776. *
  2777. * @param chart Pointer to a lxw_chart instance to be configured.
  2778. * @param fill A #lxw_chart_fill struct.
  2779. *
  2780. * Set the fill properties of a chartarea:
  2781. *
  2782. * @code
  2783. * chart_chartarea_set_fill(chart, &fill);
  2784. * @endcode
  2785. *
  2786. * See the example and image above.
  2787. *
  2788. * For more information see @ref chart_fills.
  2789. */
  2790. void chart_chartarea_set_fill(lxw_chart *chart, lxw_chart_fill *fill);
  2791. /**
  2792. * @brief Set the pattern properties for a chartarea.
  2793. *
  2794. * @param chart Pointer to a lxw_chart instance to be configured.
  2795. * @param pattern A #lxw_chart_pattern struct.
  2796. *
  2797. * Set the pattern properties of a chartarea:
  2798. *
  2799. * @code
  2800. * chart_chartarea_set_pattern(series1, &pattern);
  2801. * @endcode
  2802. *
  2803. * For more information see #lxw_chart_pattern_type and @ref chart_patterns.
  2804. */
  2805. void chart_chartarea_set_pattern(lxw_chart *chart,
  2806. lxw_chart_pattern *pattern);
  2807. /**
  2808. * @brief Set the line properties for a plotarea.
  2809. *
  2810. * @param chart Pointer to a lxw_chart instance to be configured.
  2811. * @param line A #lxw_chart_line struct.
  2812. *
  2813. * Set the line/border properties of a plotarea. In Excel the plotarea is
  2814. * the area between the axes on which the chart series are plotted:
  2815. *
  2816. * @code
  2817. * lxw_chart_line line = {.color = LXW_COLOR_RED,
  2818. * .width = 2,
  2819. * .dash_type = LXW_CHART_LINE_DASH_DASH};
  2820. * lxw_chart_fill fill = {.color = 0xFFFFC2};
  2821. *
  2822. * chart_plotarea_set_line(chart, &line);
  2823. * chart_plotarea_set_fill(chart, &fill);
  2824. *
  2825. * @endcode
  2826. *
  2827. * @image html chart_plotarea.png
  2828. *
  2829. * For more information see @ref chart_lines.
  2830. */
  2831. void chart_plotarea_set_line(lxw_chart *chart, lxw_chart_line *line);
  2832. /**
  2833. * @brief Set the fill properties for a plotarea.
  2834. *
  2835. * @param chart Pointer to a lxw_chart instance to be configured.
  2836. * @param fill A #lxw_chart_fill struct.
  2837. *
  2838. * Set the fill properties of a plotarea:
  2839. *
  2840. * @code
  2841. * chart_plotarea_set_fill(chart, &fill);
  2842. * @endcode
  2843. *
  2844. * See the example and image above.
  2845. *
  2846. * For more information see @ref chart_fills.
  2847. */
  2848. void chart_plotarea_set_fill(lxw_chart *chart, lxw_chart_fill *fill);
  2849. /**
  2850. * @brief Set the pattern properties for a plotarea.
  2851. *
  2852. * @param chart Pointer to a lxw_chart instance to be configured.
  2853. * @param pattern A #lxw_chart_pattern struct.
  2854. *
  2855. * Set the pattern properties of a plotarea:
  2856. *
  2857. * @code
  2858. * chart_plotarea_set_pattern(series1, &pattern);
  2859. * @endcode
  2860. *
  2861. * For more information see #lxw_chart_pattern_type and @ref chart_patterns.
  2862. */
  2863. void chart_plotarea_set_pattern(lxw_chart *chart, lxw_chart_pattern *pattern);
  2864. /**
  2865. * @brief Set the chart style type.
  2866. *
  2867. * @param chart Pointer to a lxw_chart instance to be configured.
  2868. * @param style_id An index representing the chart style, 1 - 48.
  2869. *
  2870. * The `%chart_set_style()` function is used to set the style of the chart to
  2871. * one of the 48 built-in styles available on the "Design" tab in Excel 2007:
  2872. *
  2873. * @code
  2874. * chart_set_style(chart, 37)
  2875. * @endcode
  2876. *
  2877. * @image html chart_style.png
  2878. *
  2879. * The style index number is counted from 1 on the top left in the Excel
  2880. * dialog. The default style is 2.
  2881. *
  2882. * **Note:**
  2883. *
  2884. * In Excel 2013 the Styles section of the "Design" tab in Excel shows what
  2885. * were referred to as "Layouts" in previous versions of Excel. These layouts
  2886. * are not defined in the file format. They are a collection of modifications
  2887. * to the base chart type. They can not be defined by the `chart_set_style()``
  2888. * function.
  2889. *
  2890. */
  2891. void chart_set_style(lxw_chart *chart, uint8_t style_id);
  2892. /**
  2893. * @brief Turn on a data table below the horizontal axis.
  2894. *
  2895. * @param chart Pointer to a lxw_chart instance to be configured.
  2896. *
  2897. * The `%chart_set_table()` function adds a data table below the horizontal
  2898. * axis with the data used to plot the chart:
  2899. *
  2900. * @code
  2901. * // Turn on the data table with default options.
  2902. * chart_set_table(chart);
  2903. * @endcode
  2904. *
  2905. * @image html chart_data_table1.png
  2906. *
  2907. * The data table can only be shown with Bar, Column, Line and Area charts.
  2908. *
  2909. */
  2910. void chart_set_table(lxw_chart *chart);
  2911. /**
  2912. * @brief Turn on/off grid options for a chart data table.
  2913. *
  2914. * @param chart Pointer to a lxw_chart instance to be configured.
  2915. * @param horizontal Turn on/off the horizontal grid lines in the table.
  2916. * @param vertical Turn on/off the vertical grid lines in the table.
  2917. * @param outline Turn on/off the outline lines in the table.
  2918. * @param legend_keys Turn on/off the legend keys in the table.
  2919. *
  2920. * The `%chart_set_table_grid()` function turns on/off grid options for a
  2921. * chart data table. The data table grid options in Excel are shown in the
  2922. * dialog below:
  2923. *
  2924. * @image html chart_data_table3.png
  2925. *
  2926. * These options can be passed to the `%chart_set_table_grid()` function.
  2927. * The values for a default chart are:
  2928. *
  2929. * - `horizontal`: On.
  2930. * - `vertical`: On.
  2931. * - `outline`: On.
  2932. * - `legend_keys`: Off.
  2933. *
  2934. * Example:
  2935. *
  2936. * @code
  2937. * // Turn on the data table with default options.
  2938. * chart_set_table(chart);
  2939. *
  2940. * // Turn on all grid lines and the grid legend.
  2941. * chart_set_table_grid(chart, LXW_TRUE, LXW_TRUE, LXW_TRUE, LXW_TRUE);
  2942. *
  2943. * // Turn off the legend since it is show in the table.
  2944. * chart_legend_set_position(chart, LXW_CHART_LEGEND_NONE);
  2945. *
  2946. * @endcode
  2947. *
  2948. * @image html chart_data_table2.png
  2949. *
  2950. * The data table can only be shown with Bar, Column, Line and Area charts.
  2951. *
  2952. */
  2953. void chart_set_table_grid(lxw_chart *chart, uint8_t horizontal,
  2954. uint8_t vertical, uint8_t outline,
  2955. uint8_t legend_keys);
  2956. void chart_set_table_font(lxw_chart *chart, lxw_chart_font *font);
  2957. /**
  2958. * @brief Turn on up-down bars for the chart.
  2959. *
  2960. * @param chart Pointer to a lxw_chart instance to be configured.
  2961. *
  2962. * The `%chart_set_up_down_bars()` function adds Up-Down bars to Line charts
  2963. * to indicate the difference between the first and last data series:
  2964. *
  2965. * @code
  2966. * chart_set_up_down_bars(chart);
  2967. * @endcode
  2968. *
  2969. * @image html chart_data_tools4.png
  2970. *
  2971. * Up-Down bars are only available in Line charts. By default Up-Down bars are
  2972. * black and white like in the above example. To format the border or fill
  2973. * of the bars see the `chart_set_up_down_bars_format()` function below.
  2974. */
  2975. void chart_set_up_down_bars(lxw_chart *chart);
  2976. /**
  2977. * @brief Turn on up-down bars for the chart, with formatting.
  2978. *
  2979. * @param chart Pointer to a lxw_chart instance to be configured.
  2980. * @param up_bar_line A #lxw_chart_line struct for the up-bar border.
  2981. * @param up_bar_fill A #lxw_chart_fill struct for the up-bar fill.
  2982. * @param down_bar_line A #lxw_chart_line struct for the down-bar border.
  2983. * @param down_bar_fill A #lxw_chart_fill struct for the down-bar fill.
  2984. *
  2985. * The `%chart_set_up_down_bars_format()` function adds Up-Down bars to Line
  2986. * charts to indicate the difference between the first and last data series.
  2987. * It also allows the up and down bars to be formatted:
  2988. *
  2989. * @code
  2990. * lxw_chart_line line = {.color = LXW_COLOR_BLACK};
  2991. * lxw_chart_fill up_fill = {.color = 0x00B050};
  2992. * lxw_chart_fill down_fill = {.color = LXW_COLOR_RED};
  2993. *
  2994. * chart_set_up_down_bars_format(chart, &line, &up_fill, &line, &down_fill);
  2995. * @endcode
  2996. *
  2997. * @image html chart_up_down_bars.png
  2998. *
  2999. * Up-Down bars are only available in Line charts.
  3000. * For more format information see @ref chart_lines and @ref chart_fills.
  3001. */
  3002. void chart_set_up_down_bars_format(lxw_chart *chart,
  3003. lxw_chart_line *up_bar_line,
  3004. lxw_chart_fill *up_bar_fill,
  3005. lxw_chart_line *down_bar_line,
  3006. lxw_chart_fill *down_bar_fill);
  3007. /**
  3008. * @brief Turn on and format Drop Lines for a chart.
  3009. *
  3010. * @param chart Pointer to a lxw_chart instance to be configured.
  3011. * @param line A #lxw_chart_line struct.
  3012. *
  3013. * The `%chart_set_drop_lines()` function adds Drop Lines to charts to
  3014. * show the Category value of points in the data:
  3015. *
  3016. * @code
  3017. * chart_set_drop_lines(chart, NULL);
  3018. * @endcode
  3019. *
  3020. * @image html chart_data_tools6.png
  3021. *
  3022. * It is possible to format the Drop Line line properties if required:
  3023. *
  3024. * @code
  3025. * lxw_chart_line line = {.color = LXW_COLOR_RED,
  3026. * .dash_type = LXW_CHART_LINE_DASH_SQUARE_DOT};
  3027. *
  3028. * chart_set_drop_lines(chart, &line);
  3029. * @endcode
  3030. *
  3031. * Drop Lines are only available in Line and Area charts.
  3032. * For more format information see @ref chart_lines.
  3033. */
  3034. void chart_set_drop_lines(lxw_chart *chart, lxw_chart_line *line);
  3035. /**
  3036. * @brief Turn on and format high-low Lines for a chart.
  3037. *
  3038. * @param chart Pointer to a lxw_chart instance to be configured.
  3039. * @param line A #lxw_chart_line struct.
  3040. *
  3041. * The `%chart_set_high_low_lines()` function adds High-Low Lines to charts
  3042. * to show the Category value of points in the data:
  3043. *
  3044. * @code
  3045. * chart_set_high_low_lines(chart, NULL);
  3046. * @endcode
  3047. *
  3048. * @image html chart_data_tools5.png
  3049. *
  3050. * It is possible to format the High-Low Line line properties if required:
  3051. *
  3052. * @code
  3053. * lxw_chart_line line = {.color = LXW_COLOR_RED,
  3054. * .dash_type = LXW_CHART_LINE_DASH_SQUARE_DOT};
  3055. *
  3056. * chart_set_high_low_lines(chart, &line);
  3057. * @endcode
  3058. *
  3059. * High-Low Lines are only available in Line charts.
  3060. * For more format information see @ref chart_lines.
  3061. */
  3062. void chart_set_high_low_lines(lxw_chart *chart, lxw_chart_line *line);
  3063. /**
  3064. * @brief Set the overlap between series in a Bar/Column chart.
  3065. *
  3066. * @param chart Pointer to a lxw_chart instance to be configured.
  3067. * @param overlap The overlap between the series. -100 to 100.
  3068. *
  3069. * The `%chart_set_series_overlap()` function sets the overlap between series
  3070. * in Bar and Column charts.
  3071. *
  3072. * @code
  3073. * chart_set_series_overlap(chart, -50);
  3074. * @endcode
  3075. *
  3076. * @image html chart_overlap.png
  3077. *
  3078. * The overlap value must be in the range `0 <= overlap <= 500`.
  3079. * The default value is 0.
  3080. *
  3081. * This option is only available for Bar/Column charts.
  3082. */
  3083. void chart_set_series_overlap(lxw_chart *chart, int8_t overlap);
  3084. /**
  3085. * @brief Set the gap between series in a Bar/Column chart.
  3086. *
  3087. * @param chart Pointer to a lxw_chart instance to be configured.
  3088. * @param gap The gap between the series. 0 to 500.
  3089. *
  3090. * The `%chart_set_series_gap()` function sets the gap between series in
  3091. * Bar and Column charts.
  3092. *
  3093. * @code
  3094. * chart_set_series_gap(chart, 400);
  3095. * @endcode
  3096. *
  3097. * @image html chart_gap.png
  3098. *
  3099. * The gap value must be in the range `0 <= gap <= 500`. The default value
  3100. * is 150.
  3101. *
  3102. * This option is only available for Bar/Column charts.
  3103. */
  3104. void chart_set_series_gap(lxw_chart *chart, uint16_t gap);
  3105. /**
  3106. * @brief Set the option for displaying blank data in a chart.
  3107. *
  3108. * @param chart Pointer to a lxw_chart instance to be configured.
  3109. * @param option The display option. A #lxw_chart_blank option.
  3110. *
  3111. * The `%chart_show_blanks_as()` function controls how blank data is displayed
  3112. * in a chart:
  3113. *
  3114. * @code
  3115. * chart_show_blanks_as(chart, LXW_CHART_BLANKS_AS_CONNECTED);
  3116. * @endcode
  3117. *
  3118. * The `option` parameter can have one of the following values:
  3119. *
  3120. * - #LXW_CHART_BLANKS_AS_GAP: Show empty chart cells as gaps in the data.
  3121. * This is the default option for Excel charts.
  3122. * - #LXW_CHART_BLANKS_AS_ZERO: Show empty chart cells as zeros.
  3123. * - #LXW_CHART_BLANKS_AS_CONNECTED: Show empty chart cells as connected.
  3124. * Only for charts with lines.
  3125. */
  3126. void chart_show_blanks_as(lxw_chart *chart, uint8_t option);
  3127. /**
  3128. * @brief Display data on charts from hidden rows or columns.
  3129. *
  3130. * @param chart Pointer to a lxw_chart instance to be configured.
  3131. *
  3132. * Display data that is in hidden rows or columns on the chart:
  3133. *
  3134. * @code
  3135. * chart_show_hidden_data(chart);
  3136. * @endcode
  3137. */
  3138. void chart_show_hidden_data(lxw_chart *chart);
  3139. /**
  3140. * @brief Set the Pie/Doughnut chart rotation.
  3141. *
  3142. * @param chart Pointer to a lxw_chart instance to be configured.
  3143. * @param rotation The angle of rotation.
  3144. *
  3145. * The `chart_set_rotation()` function is used to set the rotation of the
  3146. * first segment of a Pie/Doughnut chart. This has the effect of rotating
  3147. * the entire chart:
  3148. *
  3149. * @code
  3150. * chart_set_rotation(chart, 28);
  3151. * @endcode
  3152. *
  3153. * The angle of rotation must be in the range `0 <= rotation <= 360`.
  3154. *
  3155. * This option is only available for Pie/Doughnut charts.
  3156. *
  3157. */
  3158. void chart_set_rotation(lxw_chart *chart, uint16_t rotation);
  3159. /**
  3160. * @brief Set the Doughnut chart hole size.
  3161. *
  3162. * @param chart Pointer to a lxw_chart instance to be configured.
  3163. * @param size The hole size as a percentage.
  3164. *
  3165. * The `chart_set_hole_size()` function is used to set the hole size of a
  3166. * Doughnut chart:
  3167. *
  3168. * @code
  3169. * chart_set_hole_size(chart, 33);
  3170. * @endcode
  3171. *
  3172. * The hole size must be in the range `10 <= size <= 90`.
  3173. *
  3174. * This option is only available for Doughnut charts.
  3175. *
  3176. */
  3177. void chart_set_hole_size(lxw_chart *chart, uint8_t size);
  3178. lxw_error lxw_chart_add_data_cache(lxw_series_range *range, uint8_t *data,
  3179. uint16_t rows, uint8_t cols, uint8_t col);
  3180. /* Declarations required for unit testing. */
  3181. #ifdef TESTING
  3182. STATIC void _chart_xml_declaration(lxw_chart *chart);
  3183. STATIC void _chart_write_legend(lxw_chart *chart);
  3184. #endif /* TESTING */
  3185. /* *INDENT-OFF* */
  3186. #ifdef __cplusplus
  3187. }
  3188. #endif
  3189. /* *INDENT-ON* */
  3190. #endif /* __LXW_CHART_H__ */