xmlChart.go 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655
  1. // Copyright 2016 - 2021 The excelize Authors. All rights reserved. Use of
  2. // this source code is governed by a BSD-style license that can be found in
  3. // the LICENSE file.
  4. //
  5. // Package excelize providing a set of functions that allow you to write to
  6. // and read from XLSX / XLSM / XLTM files. Supports reading and writing
  7. // spreadsheet documents generated by Microsoft Excel™ 2007 and later. Supports
  8. // complex components by high compatibility, and provided streaming API for
  9. // generating or reading data from a worksheet with huge amounts of data. This
  10. // library needs Go version 1.15 or later.
  11. package excelize
  12. import "encoding/xml"
  13. // xlsxChartSpace directly maps the chartSpace element. The chart namespace in
  14. // DrawingML is for representing visualizations of numeric data with column
  15. // charts, pie charts, scatter charts, or other types of charts.
  16. type xlsxChartSpace struct {
  17. XMLName xml.Name `xml:"http://schemas.openxmlformats.org/drawingml/2006/chart chartSpace"`
  18. XMLNSa string `xml:"xmlns:a,attr"`
  19. Date1904 *attrValBool `xml:"date1904"`
  20. Lang *attrValString `xml:"lang"`
  21. RoundedCorners *attrValBool `xml:"roundedCorners"`
  22. Chart cChart `xml:"chart"`
  23. SpPr *cSpPr `xml:"spPr"`
  24. TxPr *cTxPr `xml:"txPr"`
  25. PrintSettings *cPrintSettings `xml:"printSettings"`
  26. }
  27. // cThicknessSpPr directly maps the element that specifies the thickness of
  28. // the walls or floor as a percentage of the largest dimension of the plot
  29. // volume and SpPr element.
  30. type cThicknessSpPr struct {
  31. Thickness *attrValInt `xml:"thickness"`
  32. SpPr *cSpPr `xml:"spPr"`
  33. }
  34. // cChart (Chart) directly maps the chart element. This element specifies a
  35. // title.
  36. type cChart struct {
  37. Title *cTitle `xml:"title"`
  38. AutoTitleDeleted *cAutoTitleDeleted `xml:"autoTitleDeleted"`
  39. View3D *cView3D `xml:"view3D"`
  40. Floor *cThicknessSpPr `xml:"floor"`
  41. SideWall *cThicknessSpPr `xml:"sideWall"`
  42. BackWall *cThicknessSpPr `xml:"backWall"`
  43. PlotArea *cPlotArea `xml:"plotArea"`
  44. Legend *cLegend `xml:"legend"`
  45. PlotVisOnly *attrValBool `xml:"plotVisOnly"`
  46. DispBlanksAs *attrValString `xml:"dispBlanksAs"`
  47. ShowDLblsOverMax *attrValBool `xml:"showDLblsOverMax"`
  48. }
  49. // cTitle (Title) directly maps the title element. This element specifies a
  50. // title.
  51. type cTitle struct {
  52. Tx cTx `xml:"tx,omitempty"`
  53. Layout string `xml:"layout,omitempty"`
  54. Overlay *attrValBool `xml:"overlay"`
  55. SpPr cSpPr `xml:"spPr,omitempty"`
  56. TxPr cTxPr `xml:"txPr,omitempty"`
  57. }
  58. // cTx (Chart Text) directly maps the tx element. This element specifies text
  59. // to use on a chart, including rich text formatting.
  60. type cTx struct {
  61. StrRef *cStrRef `xml:"strRef"`
  62. Rich *cRich `xml:"rich,omitempty"`
  63. }
  64. // cRich (Rich Text) directly maps the rich element. This element contains a
  65. // string with rich text formatting.
  66. type cRich struct {
  67. BodyPr aBodyPr `xml:"a:bodyPr,omitempty"`
  68. LstStyle string `xml:"a:lstStyle,omitempty"`
  69. P aP `xml:"a:p"`
  70. }
  71. // aBodyPr (Body Properties) directly maps the a:bodyPr element. This element
  72. // defines the body properties for the text body within a shape.
  73. type aBodyPr struct {
  74. Anchor string `xml:"anchor,attr,omitempty"`
  75. AnchorCtr bool `xml:"anchorCtr,attr"`
  76. Rot int `xml:"rot,attr"`
  77. BIns float64 `xml:"bIns,attr,omitempty"`
  78. CompatLnSpc bool `xml:"compatLnSpc,attr,omitempty"`
  79. ForceAA bool `xml:"forceAA,attr,omitempty"`
  80. FromWordArt bool `xml:"fromWordArt,attr,omitempty"`
  81. HorzOverflow string `xml:"horzOverflow,attr,omitempty"`
  82. LIns float64 `xml:"lIns,attr,omitempty"`
  83. NumCol int `xml:"numCol,attr,omitempty"`
  84. RIns float64 `xml:"rIns,attr,omitempty"`
  85. RtlCol bool `xml:"rtlCol,attr,omitempty"`
  86. SpcCol int `xml:"spcCol,attr,omitempty"`
  87. SpcFirstLastPara bool `xml:"spcFirstLastPara,attr"`
  88. TIns float64 `xml:"tIns,attr,omitempty"`
  89. Upright bool `xml:"upright,attr,omitempty"`
  90. Vert string `xml:"vert,attr,omitempty"`
  91. VertOverflow string `xml:"vertOverflow,attr,omitempty"`
  92. Wrap string `xml:"wrap,attr,omitempty"`
  93. }
  94. // aP (Paragraph) directly maps the a:p element. This element specifies a
  95. // paragraph of content in the document.
  96. type aP struct {
  97. PPr *aPPr `xml:"a:pPr"`
  98. R *aR `xml:"a:r"`
  99. EndParaRPr *aEndParaRPr `xml:"a:endParaRPr"`
  100. }
  101. // aPPr (Paragraph Properties) directly maps the a:pPr element. This element
  102. // specifies a set of paragraph properties which shall be applied to the
  103. // contents of the parent paragraph after all style/numbering/table properties
  104. // have been applied to the text. These properties are defined as direct
  105. // formatting, since they are directly applied to the paragraph and supersede
  106. // any formatting from styles.
  107. type aPPr struct {
  108. DefRPr aRPr `xml:"a:defRPr"`
  109. }
  110. // aSolidFill (Solid Fill) directly maps the solidFill element. This element
  111. // specifies a solid color fill. The shape is filled entirely with the specified
  112. // color.
  113. type aSolidFill struct {
  114. SchemeClr *aSchemeClr `xml:"a:schemeClr"`
  115. SrgbClr *attrValString `xml:"a:srgbClr"`
  116. }
  117. // aSchemeClr (Scheme Color) directly maps the a:schemeClr element. This
  118. // element specifies a color bound to a user's theme. As with all elements which
  119. // define a color, it is possible to apply a list of color transforms to the
  120. // base color defined.
  121. type aSchemeClr struct {
  122. Val string `xml:"val,attr,omitempty"`
  123. LumMod *attrValInt `xml:"a:lumMod"`
  124. LumOff *attrValInt `xml:"a:lumOff"`
  125. }
  126. // attrValInt directly maps the val element with integer data type as an
  127. // attribute.
  128. type attrValInt struct {
  129. Val *int `xml:"val,attr"`
  130. }
  131. // attrValFloat directly maps the val element with float64 data type as an
  132. // attribute.
  133. type attrValFloat struct {
  134. Val *float64 `xml:"val,attr"`
  135. }
  136. // attrValBool directly maps the val element with boolean data type as an
  137. // attribute.
  138. type attrValBool struct {
  139. Val *bool `xml:"val,attr"`
  140. }
  141. // attrValString directly maps the val element with string data type as an
  142. // attribute.
  143. type attrValString struct {
  144. Val *string `xml:"val,attr"`
  145. }
  146. // aCs directly maps the a:cs element.
  147. type aCs struct {
  148. Typeface string `xml:"typeface,attr"`
  149. }
  150. // aEa directly maps the a:ea element.
  151. type aEa struct {
  152. Typeface string `xml:"typeface,attr"`
  153. }
  154. // aLatin (Latin Font) directly maps the a:latin element. This element
  155. // specifies that a Latin font be used for a specific run of text. This font is
  156. // specified with a typeface attribute much like the others but is specifically
  157. // classified as a Latin font.
  158. type aLatin struct {
  159. Typeface string `xml:"typeface,attr"`
  160. }
  161. // aR directly maps the a:r element.
  162. type aR struct {
  163. RPr aRPr `xml:"a:rPr,omitempty"`
  164. T string `xml:"a:t,omitempty"`
  165. }
  166. // aRPr (Run Properties) directly maps the rPr element. This element
  167. // specifies a set of run properties which shall be applied to the contents of
  168. // the parent run after all style formatting has been applied to the text. These
  169. // properties are defined as direct formatting, since they are directly applied
  170. // to the run and supersede any formatting from styles.
  171. type aRPr struct {
  172. AltLang string `xml:"altLang,attr,omitempty"`
  173. B bool `xml:"b,attr"`
  174. Baseline int `xml:"baseline,attr"`
  175. Bmk string `xml:"bmk,attr,omitempty"`
  176. Cap string `xml:"cap,attr,omitempty"`
  177. Dirty bool `xml:"dirty,attr,omitempty"`
  178. Err bool `xml:"err,attr,omitempty"`
  179. I bool `xml:"i,attr"`
  180. Kern int `xml:"kern,attr"`
  181. Kumimoji bool `xml:"kumimoji,attr,omitempty"`
  182. Lang string `xml:"lang,attr,omitempty"`
  183. NoProof bool `xml:"noProof,attr,omitempty"`
  184. NormalizeH bool `xml:"normalizeH,attr,omitempty"`
  185. SmtClean bool `xml:"smtClean,attr,omitempty"`
  186. SmtID uint64 `xml:"smtId,attr,omitempty"`
  187. Spc int `xml:"spc,attr"`
  188. Strike string `xml:"strike,attr,omitempty"`
  189. Sz float64 `xml:"sz,attr,omitempty"`
  190. U string `xml:"u,attr,omitempty"`
  191. SolidFill *aSolidFill `xml:"a:solidFill"`
  192. Latin *aLatin `xml:"a:latin"`
  193. Ea *aEa `xml:"a:ea"`
  194. Cs *aCs `xml:"a:cs"`
  195. }
  196. // cSpPr (Shape Properties) directly maps the spPr element. This element
  197. // specifies the visual shape properties that can be applied to a shape. These
  198. // properties include the shape fill, outline, geometry, effects, and 3D
  199. // orientation.
  200. type cSpPr struct {
  201. NoFill *string `xml:"a:noFill"`
  202. SolidFill *aSolidFill `xml:"a:solidFill"`
  203. Ln *aLn `xml:"a:ln"`
  204. Sp3D *aSp3D `xml:"a:sp3d"`
  205. EffectLst *string `xml:"a:effectLst"`
  206. }
  207. // aSp3D (3-D Shape Properties) directly maps the a:sp3d element. This element
  208. // defines the 3D properties associated with a particular shape in DrawingML.
  209. // The 3D properties which can be applied to a shape are top and bottom bevels,
  210. // a contour and an extrusion.
  211. type aSp3D struct {
  212. ContourW int `xml:"contourW,attr"`
  213. ContourClr *aContourClr `xml:"a:contourClr"`
  214. }
  215. // aContourClr (Contour Color) directly maps the a:contourClr element. This
  216. // element defines the color for the contour on a shape. The contour of a shape
  217. // is a solid filled line which surrounds the outer edges of the shape.
  218. type aContourClr struct {
  219. SchemeClr *aSchemeClr `xml:"a:schemeClr"`
  220. }
  221. // aLn (Outline) directly maps the a:ln element. This element specifies an
  222. // outline style that can be applied to a number of different objects such as
  223. // shapes and text. The line allows for the specifying of many different types
  224. // of outlines including even line dashes and bevels.
  225. type aLn struct {
  226. Algn string `xml:"algn,attr,omitempty"`
  227. Cap string `xml:"cap,attr,omitempty"`
  228. Cmpd string `xml:"cmpd,attr,omitempty"`
  229. W int `xml:"w,attr,omitempty"`
  230. NoFill string `xml:"a:noFill,omitempty"`
  231. Round string `xml:"a:round,omitempty"`
  232. SolidFill *aSolidFill `xml:"a:solidFill"`
  233. }
  234. // cTxPr (Text Properties) directly maps the txPr element. This element
  235. // specifies text formatting. The lstStyle element is not supported.
  236. type cTxPr struct {
  237. BodyPr aBodyPr `xml:"a:bodyPr,omitempty"`
  238. LstStyle string `xml:"a:lstStyle,omitempty"`
  239. P aP `xml:"a:p,omitempty"`
  240. }
  241. // aEndParaRPr (End Paragraph Run Properties) directly maps the a:endParaRPr
  242. // element. This element specifies the text run properties that are to be used
  243. // if another run is inserted after the last run specified. This effectively
  244. // saves the run property state so that it can be applied when the user enters
  245. // additional text. If this element is omitted, then the application can
  246. // determine which default properties to apply. It is recommended that this
  247. // element be specified at the end of the list of text runs within the paragraph
  248. // so that an orderly list is maintained.
  249. type aEndParaRPr struct {
  250. Lang string `xml:"lang,attr"`
  251. AltLang string `xml:"altLang,attr,omitempty"`
  252. Sz int `xml:"sz,attr,omitempty"`
  253. }
  254. // cAutoTitleDeleted (Auto Title Is Deleted) directly maps the
  255. // autoTitleDeleted element. This element specifies the title shall not be
  256. // shown for this chart.
  257. type cAutoTitleDeleted struct {
  258. Val bool `xml:"val,attr"`
  259. }
  260. // cView3D (View In 3D) directly maps the view3D element. This element
  261. // specifies the 3-D view of the chart.
  262. type cView3D struct {
  263. RotX *attrValInt `xml:"rotX"`
  264. RotY *attrValInt `xml:"rotY"`
  265. RAngAx *attrValInt `xml:"rAngAx"`
  266. DepthPercent *attrValInt `xml:"depthPercent"`
  267. Perspective *attrValInt `xml:"perspective"`
  268. ExtLst *xlsxExtLst `xml:"extLst"`
  269. }
  270. // cPlotArea directly maps the plotArea element. This element specifies the
  271. // plot area of the chart.
  272. type cPlotArea struct {
  273. Layout *string `xml:"layout"`
  274. AreaChart *cCharts `xml:"areaChart"`
  275. Area3DChart *cCharts `xml:"area3DChart"`
  276. BarChart *cCharts `xml:"barChart"`
  277. Bar3DChart *cCharts `xml:"bar3DChart"`
  278. BubbleChart *cCharts `xml:"bubbleChart"`
  279. DoughnutChart *cCharts `xml:"doughnutChart"`
  280. LineChart *cCharts `xml:"lineChart"`
  281. PieChart *cCharts `xml:"pieChart"`
  282. Pie3DChart *cCharts `xml:"pie3DChart"`
  283. OfPieChart *cCharts `xml:"ofPieChart"`
  284. RadarChart *cCharts `xml:"radarChart"`
  285. ScatterChart *cCharts `xml:"scatterChart"`
  286. Surface3DChart *cCharts `xml:"surface3DChart"`
  287. SurfaceChart *cCharts `xml:"surfaceChart"`
  288. CatAx []*cAxs `xml:"catAx"`
  289. ValAx []*cAxs `xml:"valAx"`
  290. SerAx []*cAxs `xml:"serAx"`
  291. SpPr *cSpPr `xml:"spPr"`
  292. }
  293. // cCharts specifies the common element of the chart.
  294. type cCharts struct {
  295. BarDir *attrValString `xml:"barDir"`
  296. BubbleScale *attrValFloat `xml:"bubbleScale"`
  297. Grouping *attrValString `xml:"grouping"`
  298. RadarStyle *attrValString `xml:"radarStyle"`
  299. ScatterStyle *attrValString `xml:"scatterStyle"`
  300. OfPieType *attrValString `xml:"ofPieType"`
  301. VaryColors *attrValBool `xml:"varyColors"`
  302. Wireframe *attrValBool `xml:"wireframe"`
  303. Ser *[]cSer `xml:"ser"`
  304. SerLines *attrValString `xml:"serLines"`
  305. DLbls *cDLbls `xml:"dLbls"`
  306. Shape *attrValString `xml:"shape"`
  307. HoleSize *attrValInt `xml:"holeSize"`
  308. Smooth *attrValBool `xml:"smooth"`
  309. Overlap *attrValInt `xml:"overlap"`
  310. AxID []*attrValInt `xml:"axId"`
  311. }
  312. // cAxs directly maps the catAx and valAx element.
  313. type cAxs struct {
  314. AxID *attrValInt `xml:"axId"`
  315. Scaling *cScaling `xml:"scaling"`
  316. Delete *attrValBool `xml:"delete"`
  317. AxPos *attrValString `xml:"axPos"`
  318. MajorGridlines *cChartLines `xml:"majorGridlines"`
  319. MinorGridlines *cChartLines `xml:"minorGridlines"`
  320. NumFmt *cNumFmt `xml:"numFmt"`
  321. MajorTickMark *attrValString `xml:"majorTickMark"`
  322. MinorTickMark *attrValString `xml:"minorTickMark"`
  323. TickLblPos *attrValString `xml:"tickLblPos"`
  324. SpPr *cSpPr `xml:"spPr"`
  325. TxPr *cTxPr `xml:"txPr"`
  326. CrossAx *attrValInt `xml:"crossAx"`
  327. Crosses *attrValString `xml:"crosses"`
  328. CrossBetween *attrValString `xml:"crossBetween"`
  329. MajorUnit *attrValFloat `xml:"majorUnit"`
  330. MinorUnit *attrValFloat `xml:"minorUnit"`
  331. Auto *attrValBool `xml:"auto"`
  332. LblAlgn *attrValString `xml:"lblAlgn"`
  333. LblOffset *attrValInt `xml:"lblOffset"`
  334. TickLblSkip *attrValInt `xml:"tickLblSkip"`
  335. TickMarkSkip *attrValInt `xml:"tickMarkSkip"`
  336. NoMultiLvlLbl *attrValBool `xml:"noMultiLvlLbl"`
  337. }
  338. // cChartLines directly maps the chart lines content model.
  339. type cChartLines struct {
  340. SpPr *cSpPr `xml:"spPr"`
  341. }
  342. // cScaling directly maps the scaling element. This element contains
  343. // additional axis settings.
  344. type cScaling struct {
  345. LogBase *attrValFloat `xml:"logBase"`
  346. Orientation *attrValString `xml:"orientation"`
  347. Max *attrValFloat `xml:"max"`
  348. Min *attrValFloat `xml:"min"`
  349. }
  350. // cNumFmt (Numbering Format) directly maps the numFmt element. This element
  351. // specifies number formatting for the parent element.
  352. type cNumFmt struct {
  353. FormatCode string `xml:"formatCode,attr"`
  354. SourceLinked bool `xml:"sourceLinked,attr"`
  355. }
  356. // cSer directly maps the ser element. This element specifies a series on a
  357. // chart.
  358. type cSer struct {
  359. IDx *attrValInt `xml:"idx"`
  360. Order *attrValInt `xml:"order"`
  361. Tx *cTx `xml:"tx"`
  362. SpPr *cSpPr `xml:"spPr"`
  363. DPt []*cDPt `xml:"dPt"`
  364. DLbls *cDLbls `xml:"dLbls"`
  365. Marker *cMarker `xml:"marker"`
  366. InvertIfNegative *attrValBool `xml:"invertIfNegative"`
  367. Cat *cCat `xml:"cat"`
  368. Val *cVal `xml:"val"`
  369. XVal *cCat `xml:"xVal"`
  370. YVal *cVal `xml:"yVal"`
  371. Smooth *attrValBool `xml:"smooth"`
  372. BubbleSize *cVal `xml:"bubbleSize"`
  373. Bubble3D *attrValBool `xml:"bubble3D"`
  374. }
  375. // cMarker (Marker) directly maps the marker element. This element specifies a
  376. // data marker.
  377. type cMarker struct {
  378. Symbol *attrValString `xml:"symbol"`
  379. Size *attrValInt `xml:"size"`
  380. SpPr *cSpPr `xml:"spPr"`
  381. }
  382. // cDPt (Data Point) directly maps the dPt element. This element specifies a
  383. // single data point.
  384. type cDPt struct {
  385. IDx *attrValInt `xml:"idx"`
  386. Bubble3D *attrValBool `xml:"bubble3D"`
  387. SpPr *cSpPr `xml:"spPr"`
  388. }
  389. // cCat (Category Axis Data) directly maps the cat element. This element
  390. // specifies the data used for the category axis.
  391. type cCat struct {
  392. StrRef *cStrRef `xml:"strRef"`
  393. }
  394. // cStrRef (String Reference) directly maps the strRef element. This element
  395. // specifies a reference to data for a single data label or title with a cache
  396. // of the last values used.
  397. type cStrRef struct {
  398. F string `xml:"f"`
  399. StrCache *cStrCache `xml:"strCache"`
  400. }
  401. // cStrCache (String Cache) directly maps the strCache element. This element
  402. // specifies the last string data used for a chart.
  403. type cStrCache struct {
  404. Pt []*cPt `xml:"pt"`
  405. PtCount *attrValInt `xml:"ptCount"`
  406. }
  407. // cPt directly maps the pt element. This element specifies data for a
  408. // particular data point.
  409. type cPt struct {
  410. IDx int `xml:"idx,attr"`
  411. V *string `xml:"v"`
  412. }
  413. // cVal directly maps the val element. This element specifies the data values
  414. // which shall be used to define the location of data markers on a chart.
  415. type cVal struct {
  416. NumRef *cNumRef `xml:"numRef"`
  417. }
  418. // cNumRef directly maps the numRef element. This element specifies a
  419. // reference to numeric data with a cache of the last values used.
  420. type cNumRef struct {
  421. F string `xml:"f"`
  422. NumCache *cNumCache `xml:"numCache"`
  423. }
  424. // cNumCache directly maps the numCache element. This element specifies the
  425. // last data shown on the chart for a series.
  426. type cNumCache struct {
  427. FormatCode string `xml:"formatCode"`
  428. Pt []*cPt `xml:"pt"`
  429. PtCount *attrValInt `xml:"ptCount"`
  430. }
  431. // cDLbls (Data Lables) directly maps the dLbls element. This element serves
  432. // as a root element that specifies the settings for the data labels for an
  433. // entire series or the entire chart. It contains child elements that specify
  434. // the specific formatting and positioning settings.
  435. type cDLbls struct {
  436. ShowLegendKey *attrValBool `xml:"showLegendKey"`
  437. ShowVal *attrValBool `xml:"showVal"`
  438. ShowCatName *attrValBool `xml:"showCatName"`
  439. ShowSerName *attrValBool `xml:"showSerName"`
  440. ShowPercent *attrValBool `xml:"showPercent"`
  441. ShowBubbleSize *attrValBool `xml:"showBubbleSize"`
  442. ShowLeaderLines *attrValBool `xml:"showLeaderLines"`
  443. }
  444. // cLegend (Legend) directly maps the legend element. This element specifies
  445. // the legend.
  446. type cLegend struct {
  447. Layout *string `xml:"layout"`
  448. LegendPos *attrValString `xml:"legendPos"`
  449. Overlay *attrValBool `xml:"overlay"`
  450. SpPr *cSpPr `xml:"spPr"`
  451. TxPr *cTxPr `xml:"txPr"`
  452. }
  453. // cPrintSettings directly maps the printSettings element. This element
  454. // specifies the print settings for the chart.
  455. type cPrintSettings struct {
  456. HeaderFooter *string `xml:"headerFooter"`
  457. PageMargins *cPageMargins `xml:"pageMargins"`
  458. PageSetup *string `xml:"pageSetup"`
  459. }
  460. // cPageMargins directly maps the pageMargins element. This element specifies
  461. // the page margins for a chart.
  462. type cPageMargins struct {
  463. B float64 `xml:"b,attr"`
  464. Footer float64 `xml:"footer,attr"`
  465. Header float64 `xml:"header,attr"`
  466. L float64 `xml:"l,attr"`
  467. R float64 `xml:"r,attr"`
  468. T float64 `xml:"t,attr"`
  469. }
  470. // formatChartAxis directly maps the format settings of the chart axis.
  471. type formatChartAxis struct {
  472. Crossing string `json:"crossing"`
  473. MajorGridlines bool `json:"major_grid_lines"`
  474. MinorGridlines bool `json:"minor_grid_lines"`
  475. MajorTickMark string `json:"major_tick_mark"`
  476. MinorTickMark string `json:"minor_tick_mark"`
  477. MinorUnitType string `json:"minor_unit_type"`
  478. MajorUnit float64 `json:"major_unit"`
  479. MajorUnitType string `json:"major_unit_type"`
  480. TickLabelSkip int `json:"tick_label_skip"`
  481. DisplayUnits string `json:"display_units"`
  482. DisplayUnitsVisible bool `json:"display_units_visible"`
  483. DateAxis bool `json:"date_axis"`
  484. ReverseOrder bool `json:"reverse_order"`
  485. Maximum float64 `json:"maximum"`
  486. Minimum float64 `json:"minimum"`
  487. NumFormat string `json:"num_format"`
  488. NumFont struct {
  489. Color string `json:"color"`
  490. Bold bool `json:"bold"`
  491. Italic bool `json:"italic"`
  492. Underline bool `json:"underline"`
  493. } `json:"num_font"`
  494. LogBase float64 `json:"logbase"`
  495. NameLayout formatLayout `json:"name_layout"`
  496. }
  497. type formatChartDimension struct {
  498. Width int `json:"width"`
  499. Height int `json:"height"`
  500. }
  501. // formatChart directly maps the format settings of the chart.
  502. type formatChart struct {
  503. Type string `json:"type"`
  504. Series []formatChartSeries `json:"series"`
  505. Format formatPicture `json:"format"`
  506. Dimension formatChartDimension `json:"dimension"`
  507. Legend formatChartLegend `json:"legend"`
  508. Title formatChartTitle `json:"title"`
  509. VaryColors bool `json:"vary_colors"`
  510. XAxis formatChartAxis `json:"x_axis"`
  511. YAxis formatChartAxis `json:"y_axis"`
  512. Chartarea struct {
  513. Border struct {
  514. None bool `json:"none"`
  515. } `json:"border"`
  516. Fill struct {
  517. Color string `json:"color"`
  518. } `json:"fill"`
  519. Pattern struct {
  520. Pattern string `json:"pattern"`
  521. FgColor string `json:"fg_color"`
  522. BgColor string `json:"bg_color"`
  523. } `json:"pattern"`
  524. } `json:"chartarea"`
  525. Plotarea struct {
  526. ShowBubbleSize bool `json:"show_bubble_size"`
  527. ShowCatName bool `json:"show_cat_name"`
  528. ShowLeaderLines bool `json:"show_leader_lines"`
  529. ShowPercent bool `json:"show_percent"`
  530. ShowSerName bool `json:"show_series_name"`
  531. ShowVal bool `json:"show_val"`
  532. Gradient struct {
  533. Colors []string `json:"colors"`
  534. } `json:"gradient"`
  535. Border struct {
  536. Color string `json:"color"`
  537. Width int `json:"width"`
  538. DashType string `json:"dash_type"`
  539. } `json:"border"`
  540. Fill struct {
  541. Color string `json:"color"`
  542. } `json:"fill"`
  543. Layout formatLayout `json:"layout"`
  544. } `json:"plotarea"`
  545. ShowBlanksAs string `json:"show_blanks_as"`
  546. ShowHiddenData bool `json:"show_hidden_data"`
  547. SetRotation int `json:"set_rotation"`
  548. SetHoleSize int `json:"set_hole_size"`
  549. order int
  550. }
  551. // formatChartLegend directly maps the format settings of the chart legend.
  552. type formatChartLegend struct {
  553. None bool `json:"none"`
  554. DeleteSeries []int `json:"delete_series"`
  555. Font Font `json:"font"`
  556. Layout formatLayout `json:"layout"`
  557. Position string `json:"position"`
  558. ShowLegendEntry bool `json:"show_legend_entry"`
  559. ShowLegendKey bool `json:"show_legend_key"`
  560. }
  561. // formatChartSeries directly maps the format settings of the chart series.
  562. type formatChartSeries struct {
  563. Name string `json:"name"`
  564. Categories string `json:"categories"`
  565. Values string `json:"values"`
  566. Line struct {
  567. None bool `json:"none"`
  568. Color string `json:"color"`
  569. Width float64 `json:"width"`
  570. } `json:"line"`
  571. Marker struct {
  572. Symbol string `json:"symbol"`
  573. Size int `json:"size"`
  574. Width float64 `json:"width"`
  575. Border struct {
  576. Color string `json:"color"`
  577. None bool `json:"none"`
  578. } `json:"border"`
  579. Fill struct {
  580. Color string `json:"color"`
  581. None bool `json:"none"`
  582. } `json:"fill"`
  583. } `json:"marker"`
  584. }
  585. // formatChartTitle directly maps the format settings of the chart title.
  586. type formatChartTitle struct {
  587. None bool `json:"none"`
  588. Name string `json:"name"`
  589. Overlay bool `json:"overlay"`
  590. Layout formatLayout `json:"layout"`
  591. }
  592. // formatLayout directly maps the format settings of the element layout.
  593. type formatLayout struct {
  594. X float64 `json:"x"`
  595. Y float64 `json:"y"`
  596. Width float64 `json:"width"`
  597. Height float64 `json:"height"`
  598. }