xmlChart.go 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623
  1. // Copyright 2016 - 2018 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 c: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:"c: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:"c:date1904"`
  21. Lang *attrValString `xml:"c:lang"`
  22. RoundedCorners *attrValBool `xml:"c:roundedCorners"`
  23. Chart cChart `xml:"c:chart"`
  24. SpPr *cSpPr `xml:"c:spPr"`
  25. TxPr *cTxPr `xml:"c:txPr"`
  26. PrintSettings *cPrintSettings `xml:"c:printSettings"`
  27. }
  28. // cThicknessSpPr directly maps the element that specifies the thickness of the
  29. // walls or floor as a percentage of the largest dimension of the plot volume
  30. // and SpPr element.
  31. type cThicknessSpPr struct {
  32. Thickness *attrValInt `xml:"c:thickness"`
  33. SpPr *cSpPr `xml:"c:spPr"`
  34. }
  35. // cChart (Chart) directly maps the c:chart element. This element specifies a
  36. // title.
  37. type cChart struct {
  38. Title *cTitle `xml:"c:title"`
  39. AutoTitleDeleted *cAutoTitleDeleted `xml:"c:autoTitleDeleted"`
  40. View3D *cView3D `xml:"c:view3D"`
  41. Floor *cThicknessSpPr `xml:"c:floor"`
  42. SideWall *cThicknessSpPr `xml:"c:sideWall"`
  43. BackWall *cThicknessSpPr `xml:"c:backWall"`
  44. PlotArea *cPlotArea `xml:"c:plotArea"`
  45. Legend *cLegend `xml:"c:legend"`
  46. PlotVisOnly *attrValBool `xml:"c:plotVisOnly"`
  47. DispBlanksAs *attrValString `xml:"c:dispBlanksAs"`
  48. ShowDLblsOverMax *attrValBool `xml:"c:showDLblsOverMax"`
  49. }
  50. // cTitle (Title) directly maps the c:title element. This element specifies a
  51. // title.
  52. type cTitle struct {
  53. Tx cTx `xml:"c:tx,omitempty"`
  54. Layout string `xml:"c:layout,omitempty"`
  55. Overlay attrValBool `xml:"c:overlay,omitempty"`
  56. SpPr cSpPr `xml:"c:spPr,omitempty"`
  57. TxPr cTxPr `xml:"c:txPr,omitempty"`
  58. }
  59. // cTx (Chart Text) directly maps the c:tx element. This element specifies text
  60. // to use on a chart, including rich text formatting.
  61. type cTx struct {
  62. StrRef *cStrRef `xml:"c:strRef"`
  63. Rich *cRich `xml:"c:rich,omitempty"`
  64. }
  65. // cRich (Rich Text) directly maps the c: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 c: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 int `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 c: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 c: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. // c: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 c:view3D element. This element
  262. // specifies the 3-D view of the chart.
  263. type cView3D struct {
  264. RotX *attrValInt `xml:"c:rotX"`
  265. RotY *attrValInt `xml:"c:rotY"`
  266. DepthPercent *attrValInt `xml:"c:depthPercent"`
  267. RAngAx *attrValInt `xml:"c:rAngAx"`
  268. }
  269. // cPlotArea directly maps the c:plotArea element. This element specifies the
  270. // plot area of the chart.
  271. type cPlotArea struct {
  272. Layout *string `xml:"c:layout"`
  273. AreaChart *cCharts `xml:"c:areaChart"`
  274. Area3DChart *cCharts `xml:"c:area3DChart"`
  275. BarChart *cCharts `xml:"c:barChart"`
  276. Bar3DChart *cCharts `xml:"c:bar3DChart"`
  277. DoughnutChart *cCharts `xml:"c:doughnutChart"`
  278. LineChart *cCharts `xml:"c:lineChart"`
  279. PieChart *cCharts `xml:"c:pieChart"`
  280. Pie3DChart *cCharts `xml:"c:pie3DChart"`
  281. RadarChart *cCharts `xml:"c:radarChart"`
  282. ScatterChart *cCharts `xml:"c:scatterChart"`
  283. CatAx []*cAxs `xml:"c:catAx"`
  284. ValAx []*cAxs `xml:"c:valAx"`
  285. SpPr *cSpPr `xml:"c:spPr"`
  286. }
  287. // cCharts specifies the common element of the chart.
  288. type cCharts struct {
  289. BarDir *attrValString `xml:"c:barDir"`
  290. Grouping *attrValString `xml:"c:grouping"`
  291. RadarStyle *attrValString `xml:"c:radarStyle"`
  292. ScatterStyle *attrValString `xml:"c:scatterStyle"`
  293. VaryColors *attrValBool `xml:"c:varyColors"`
  294. Ser *[]cSer `xml:"c:ser"`
  295. DLbls *cDLbls `xml:"c:dLbls"`
  296. HoleSize *attrValInt `xml:"c:holeSize"`
  297. Smooth *attrValBool `xml:"c:smooth"`
  298. Overlap *attrValInt `xml:"c:overlap"`
  299. AxID []*attrValInt `xml:"c:axId"`
  300. }
  301. // cAxs directly maps the c:catAx and c:valAx element.
  302. type cAxs struct {
  303. AxID *attrValInt `xml:"c:axId"`
  304. Scaling *cScaling `xml:"c:scaling"`
  305. Delete *attrValBool `xml:"c:delete"`
  306. AxPos *attrValString `xml:"c:axPos"`
  307. NumFmt *cNumFmt `xml:"c:numFmt"`
  308. MajorTickMark *attrValString `xml:"c:majorTickMark"`
  309. MinorTickMark *attrValString `xml:"c:minorTickMark"`
  310. TickLblPos *attrValString `xml:"c:tickLblPos"`
  311. SpPr *cSpPr `xml:"c:spPr"`
  312. TxPr *cTxPr `xml:"c:txPr"`
  313. CrossAx *attrValInt `xml:"c:crossAx"`
  314. Crosses *attrValString `xml:"c:crosses"`
  315. CrossBetween *attrValString `xml:"c:crossBetween"`
  316. Auto *attrValBool `xml:"c:auto"`
  317. LblAlgn *attrValString `xml:"c:lblAlgn"`
  318. LblOffset *attrValInt `xml:"c:lblOffset"`
  319. NoMultiLvlLbl *attrValBool `xml:"c:noMultiLvlLbl"`
  320. }
  321. // cScaling directly maps the c:scaling element. This element contains
  322. // additional axis settings.
  323. type cScaling struct {
  324. Orientation *attrValString `xml:"c:orientation"`
  325. Max *attrValFloat `xml:"c:max"`
  326. Min *attrValFloat `xml:"c:min"`
  327. }
  328. // cNumFmt (Numbering Format) directly maps the c:numFmt element. This element
  329. // specifies number formatting for the parent element.
  330. type cNumFmt struct {
  331. FormatCode string `xml:"formatCode,attr"`
  332. SourceLinked bool `xml:"sourceLinked,attr"`
  333. }
  334. // cSer directly maps the c:ser element. This element specifies a series on a
  335. // chart.
  336. type cSer struct {
  337. IDx *attrValInt `xml:"c:idx"`
  338. Order *attrValInt `xml:"c:order"`
  339. Tx *cTx `xml:"c:tx"`
  340. SpPr *cSpPr `xml:"c:spPr"`
  341. DPt []*cDPt `xml:"c:dPt"`
  342. DLbls *cDLbls `xml:"c:dLbls"`
  343. Marker *cMarker `xml:"c:marker"`
  344. InvertIfNegative *attrValBool `xml:"c:invertIfNegative"`
  345. Cat *cCat `xml:"c:cat"`
  346. Val *cVal `xml:"c:val"`
  347. XVal *cCat `xml:"c:xVal"`
  348. YVal *cVal `xml:"c:yVal"`
  349. Smooth *attrValBool `xml:"c:smooth"`
  350. }
  351. // cMarker (Marker) directly maps the c:marker element. This element specifies a
  352. // data marker.
  353. type cMarker struct {
  354. Symbol *attrValString `xml:"c:symbol"`
  355. Size *attrValInt `xml:"c:size"`
  356. SpPr *cSpPr `xml:"c:spPr"`
  357. }
  358. // cDPt (Data Point) directly maps the c:dPt element. This element specifies a
  359. // single data point.
  360. type cDPt struct {
  361. IDx *attrValInt `xml:"c:idx"`
  362. Bubble3D *attrValBool `xml:"c:bubble3D"`
  363. SpPr *cSpPr `xml:"c:spPr"`
  364. }
  365. // cCat (Category Axis Data) directly maps the c:cat element. This element
  366. // specifies the data used for the category axis.
  367. type cCat struct {
  368. StrRef *cStrRef `xml:"c:strRef"`
  369. }
  370. // cStrRef (String Reference) directly maps the c:strRef element. This element
  371. // specifies a reference to data for a single data label or title with a cache
  372. // of the last values used.
  373. type cStrRef struct {
  374. F string `xml:"c:f"`
  375. StrCache *cStrCache `xml:"c:strCache"`
  376. }
  377. // cStrCache (String Cache) directly maps the c:strCache element. This element
  378. // specifies the last string data used for a chart.
  379. type cStrCache struct {
  380. Pt []*cPt `xml:"c:pt"`
  381. PtCount *attrValInt `xml:"c:ptCount"`
  382. }
  383. // cPt directly maps the c:pt element. This element specifies data for a
  384. // particular data point.
  385. type cPt struct {
  386. IDx int `xml:"idx,attr"`
  387. V *string `xml:"c:v"`
  388. }
  389. // cVal directly maps the c:val element. This element specifies the data values
  390. // which shall be used to define the location of data markers on a chart.
  391. type cVal struct {
  392. NumRef *cNumRef `xml:"c:numRef"`
  393. }
  394. // cNumRef directly maps the c:numRef element. This element specifies a
  395. // reference to numeric data with a cache of the last values used.
  396. type cNumRef struct {
  397. F string `xml:"c:f"`
  398. NumCache *cNumCache `xml:"c:numCache"`
  399. }
  400. // cNumCache directly maps the c:numCache element. This element specifies the
  401. // last data shown on the chart for a series.
  402. type cNumCache struct {
  403. FormatCode string `xml:"c:formatCode"`
  404. Pt []*cPt `xml:"c:pt"`
  405. PtCount *attrValInt `xml:"c:ptCount"`
  406. }
  407. // cDLbls (Data Lables) directly maps the c:dLbls element. This element serves
  408. // as a root element that specifies the settings for the data labels for an
  409. // entire series or the entire chart. It contains child elements that specify
  410. // the specific formatting and positioning settings.
  411. type cDLbls struct {
  412. ShowLegendKey *attrValBool `xml:"c:showLegendKey"`
  413. ShowVal *attrValBool `xml:"c:showVal"`
  414. ShowCatName *attrValBool `xml:"c:showCatName"`
  415. ShowSerName *attrValBool `xml:"c:showSerName"`
  416. ShowPercent *attrValBool `xml:"c:showPercent"`
  417. ShowBubbleSize *attrValBool `xml:"c:showBubbleSize"`
  418. ShowLeaderLines *attrValBool `xml:"c:showLeaderLines"`
  419. }
  420. // cLegend (Legend) directly maps the c:legend element. This element specifies
  421. // the legend.
  422. type cLegend struct {
  423. Layout *string `xml:"c:layout"`
  424. LegendPos *attrValString `xml:"c:legendPos"`
  425. Overlay *attrValBool `xml:"c:overlay"`
  426. SpPr *cSpPr `xml:"c:spPr"`
  427. TxPr *cTxPr `xml:"c:txPr"`
  428. }
  429. // cPrintSettings directly maps the c:printSettings element. This element
  430. // specifies the print settings for the chart.
  431. type cPrintSettings struct {
  432. HeaderFooter *string `xml:"c:headerFooter"`
  433. PageMargins *cPageMargins `xml:"c:pageMargins"`
  434. PageSetup *string `xml:"c:pageSetup"`
  435. }
  436. // cPageMargins directly maps the c:pageMargins element. This element specifies
  437. // the page margins for a chart.
  438. type cPageMargins struct {
  439. B float64 `xml:"b,attr"`
  440. Footer float64 `xml:"footer,attr"`
  441. Header float64 `xml:"header,attr"`
  442. L float64 `xml:"l,attr"`
  443. R float64 `xml:"r,attr"`
  444. T float64 `xml:"t,attr"`
  445. }
  446. // formatChartAxis directly maps the format settings of the chart axis.
  447. type formatChartAxis struct {
  448. Crossing string `json:"crossing"`
  449. MajorTickMark string `json:"major_tick_mark"`
  450. MinorTickMark string `json:"minor_tick_mark"`
  451. MinorUnitType string `json:"minor_unit_type"`
  452. MajorUnit int `json:"major_unit"`
  453. MajorUnitType string `json:"major_unit_type"`
  454. DisplayUnits string `json:"display_units"`
  455. DisplayUnitsVisible bool `json:"display_units_visible"`
  456. DateAxis bool `json:"date_axis"`
  457. ReverseOrder bool `json:"reverse_order"`
  458. Maximum float64 `json:"maximum"`
  459. Minimum float64 `json:"minimum"`
  460. NumFormat string `json:"num_format"`
  461. NumFont struct {
  462. Color string `json:"color"`
  463. Bold bool `json:"bold"`
  464. Italic bool `json:"italic"`
  465. Underline bool `json:"underline"`
  466. } `json:"num_font"`
  467. NameLayout formatLayout `json:"name_layout"`
  468. }
  469. type formatChartDimension struct {
  470. Width int `json:"width"`
  471. Height int `json:"height"`
  472. }
  473. // formatChart directly maps the format settings of the chart.
  474. type formatChart struct {
  475. Type string `json:"type"`
  476. Series []formatChartSeries `json:"series"`
  477. Format formatPicture `json:"format"`
  478. Dimension formatChartDimension `json:"dimension"`
  479. Legend formatChartLegend `json:"legend"`
  480. Title formatChartTitle `json:"title"`
  481. XAxis formatChartAxis `json:"x_axis"`
  482. YAxis formatChartAxis `json:"y_axis"`
  483. Chartarea struct {
  484. Border struct {
  485. None bool `json:"none"`
  486. } `json:"border"`
  487. Fill struct {
  488. Color string `json:"color"`
  489. } `json:"fill"`
  490. Pattern struct {
  491. Pattern string `json:"pattern"`
  492. FgColor string `json:"fg_color"`
  493. BgColor string `json:"bg_color"`
  494. } `json:"pattern"`
  495. } `json:"chartarea"`
  496. Plotarea struct {
  497. ShowBubbleSize bool `json:"show_bubble_size"`
  498. ShowCatName bool `json:"show_cat_name"`
  499. ShowLeaderLines bool `json:"show_leader_lines"`
  500. ShowPercent bool `json:"show_percent"`
  501. ShowSerName bool `json:"show_series_name"`
  502. ShowVal bool `json:"show_val"`
  503. Gradient struct {
  504. Colors []string `json:"colors"`
  505. } `json:"gradient"`
  506. Border struct {
  507. Color string `json:"color"`
  508. Width int `json:"width"`
  509. DashType string `json:"dash_type"`
  510. } `json:"border"`
  511. Fill struct {
  512. Color string `json:"color"`
  513. } `json:"fill"`
  514. Layout formatLayout `json:"layout"`
  515. } `json:"plotarea"`
  516. ShowBlanksAs string `json:"show_blanks_as"`
  517. ShowHiddenData bool `json:"show_hidden_data"`
  518. SetRotation int `json:"set_rotation"`
  519. SetHoleSize int `json:"set_hole_size"`
  520. }
  521. // formatChartLegend directly maps the format settings of the chart legend.
  522. type formatChartLegend struct {
  523. None bool `json:"none"`
  524. DeleteSeries []int `json:"delete_series"`
  525. Font formatFont `json:"font"`
  526. Layout formatLayout `json:"layout"`
  527. Position string `json:"position"`
  528. ShowLegendEntry bool `json:"show_legend_entry"`
  529. ShowLegendKey bool `json:"show_legend_key"`
  530. }
  531. // formatChartSeries directly maps the format settings of the chart series.
  532. type formatChartSeries struct {
  533. Name string `json:"name"`
  534. Categories string `json:"categories"`
  535. Values string `json:"values"`
  536. Line struct {
  537. None bool `json:"none"`
  538. Color string `json:"color"`
  539. } `json:"line"`
  540. Marker struct {
  541. Type string `json:"type"`
  542. Size int `json:"size"`
  543. Width float64 `json:"width"`
  544. Border struct {
  545. Color string `json:"color"`
  546. None bool `json:"none"`
  547. } `json:"border"`
  548. Fill struct {
  549. Color string `json:"color"`
  550. None bool `json:"none"`
  551. } `json:"fill"`
  552. } `json:"marker"`
  553. }
  554. // formatChartTitle directly maps the format settings of the chart title.
  555. type formatChartTitle struct {
  556. None bool `json:"none"`
  557. Name string `json:"name"`
  558. Overlay bool `json:"overlay"`
  559. Layout formatLayout `json:"layout"`
  560. }
  561. // formatLayout directly maps the format settings of the element layout.
  562. type formatLayout struct {
  563. X float64 `json:"x"`
  564. Y float64 `json:"y"`
  565. Width float64 `json:"width"`
  566. Height float64 `json:"height"`
  567. }