xmlChart.go 23 KB

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