xmlChart.go 23 KB

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