You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

654 lines
24 KiB

  1. // Copyright 2016 - 2020 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.10 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"`
  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. RAngAx *attrValInt `xml:"rAngAx"`
  267. DepthPercent *attrValInt `xml:"depthPercent"`
  268. Perspective *attrValInt `xml:"perspective"`
  269. ExtLst *xlsxExtLst `xml:"extLst"`
  270. }
  271. // cPlotArea directly maps the plotArea element. This element specifies the
  272. // plot area of the chart.
  273. type cPlotArea struct {
  274. Layout *string `xml:"layout"`
  275. AreaChart *cCharts `xml:"areaChart"`
  276. Area3DChart *cCharts `xml:"area3DChart"`
  277. BarChart *cCharts `xml:"barChart"`
  278. Bar3DChart *cCharts `xml:"bar3DChart"`
  279. BubbleChart *cCharts `xml:"bubbleChart"`
  280. DoughnutChart *cCharts `xml:"doughnutChart"`
  281. LineChart *cCharts `xml:"lineChart"`
  282. PieChart *cCharts `xml:"pieChart"`
  283. Pie3DChart *cCharts `xml:"pie3DChart"`
  284. OfPieChart *cCharts `xml:"ofPieChart"`
  285. RadarChart *cCharts `xml:"radarChart"`
  286. ScatterChart *cCharts `xml:"scatterChart"`
  287. Surface3DChart *cCharts `xml:"surface3DChart"`
  288. SurfaceChart *cCharts `xml:"surfaceChart"`
  289. CatAx []*cAxs `xml:"catAx"`
  290. ValAx []*cAxs `xml:"valAx"`
  291. SerAx []*cAxs `xml:"serAx"`
  292. SpPr *cSpPr `xml:"spPr"`
  293. }
  294. // cCharts specifies the common element of the chart.
  295. type cCharts struct {
  296. BarDir *attrValString `xml:"barDir"`
  297. BubbleScale *attrValFloat `xml:"bubbleScale"`
  298. Grouping *attrValString `xml:"grouping"`
  299. RadarStyle *attrValString `xml:"radarStyle"`
  300. ScatterStyle *attrValString `xml:"scatterStyle"`
  301. OfPieType *attrValString `xml:"ofPieType"`
  302. VaryColors *attrValBool `xml:"varyColors"`
  303. Wireframe *attrValBool `xml:"wireframe"`
  304. Ser *[]cSer `xml:"ser"`
  305. SerLines *attrValString `xml:"serLines"`
  306. DLbls *cDLbls `xml:"dLbls"`
  307. Shape *attrValString `xml:"shape"`
  308. HoleSize *attrValInt `xml:"holeSize"`
  309. Smooth *attrValBool `xml:"smooth"`
  310. Overlap *attrValInt `xml:"overlap"`
  311. AxID []*attrValInt `xml:"axId"`
  312. }
  313. // cAxs directly maps the catAx and valAx element.
  314. type cAxs struct {
  315. AxID *attrValInt `xml:"axId"`
  316. Scaling *cScaling `xml:"scaling"`
  317. Delete *attrValBool `xml:"delete"`
  318. AxPos *attrValString `xml:"axPos"`
  319. MajorGridlines *cChartLines `xml:"majorGridlines"`
  320. MinorGridlines *cChartLines `xml:"minorGridlines"`
  321. NumFmt *cNumFmt `xml:"numFmt"`
  322. MajorTickMark *attrValString `xml:"majorTickMark"`
  323. MinorTickMark *attrValString `xml:"minorTickMark"`
  324. TickLblPos *attrValString `xml:"tickLblPos"`
  325. SpPr *cSpPr `xml:"spPr"`
  326. TxPr *cTxPr `xml:"txPr"`
  327. CrossAx *attrValInt `xml:"crossAx"`
  328. Crosses *attrValString `xml:"crosses"`
  329. CrossBetween *attrValString `xml:"crossBetween"`
  330. MajorUnit *attrValFloat `xml:"majorUnit"`
  331. MinorUnit *attrValFloat `xml:"minorUnit"`
  332. Auto *attrValBool `xml:"auto"`
  333. LblAlgn *attrValString `xml:"lblAlgn"`
  334. LblOffset *attrValInt `xml:"lblOffset"`
  335. TickLblSkip *attrValInt `xml:"tickLblSkip"`
  336. TickMarkSkip *attrValInt `xml:"tickMarkSkip"`
  337. NoMultiLvlLbl *attrValBool `xml:"noMultiLvlLbl"`
  338. }
  339. // cChartLines directly maps the chart lines content model.
  340. type cChartLines struct {
  341. SpPr *cSpPr `xml:"spPr"`
  342. }
  343. // cScaling directly maps the scaling element. This element contains
  344. // additional axis settings.
  345. type cScaling struct {
  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. NameLayout formatLayout `json:"name_layout"`
  495. }
  496. type formatChartDimension struct {
  497. Width int `json:"width"`
  498. Height int `json:"height"`
  499. }
  500. // formatChart directly maps the format settings of the chart.
  501. type formatChart struct {
  502. Type string `json:"type"`
  503. Series []formatChartSeries `json:"series"`
  504. Format formatPicture `json:"format"`
  505. Dimension formatChartDimension `json:"dimension"`
  506. Legend formatChartLegend `json:"legend"`
  507. Title formatChartTitle `json:"title"`
  508. XAxis formatChartAxis `json:"x_axis"`
  509. YAxis formatChartAxis `json:"y_axis"`
  510. Chartarea struct {
  511. Border struct {
  512. None bool `json:"none"`
  513. } `json:"border"`
  514. Fill struct {
  515. Color string `json:"color"`
  516. } `json:"fill"`
  517. Pattern struct {
  518. Pattern string `json:"pattern"`
  519. FgColor string `json:"fg_color"`
  520. BgColor string `json:"bg_color"`
  521. } `json:"pattern"`
  522. } `json:"chartarea"`
  523. Plotarea struct {
  524. ShowBubbleSize bool `json:"show_bubble_size"`
  525. ShowCatName bool `json:"show_cat_name"`
  526. ShowLeaderLines bool `json:"show_leader_lines"`
  527. ShowPercent bool `json:"show_percent"`
  528. ShowSerName bool `json:"show_series_name"`
  529. ShowVal bool `json:"show_val"`
  530. Gradient struct {
  531. Colors []string `json:"colors"`
  532. } `json:"gradient"`
  533. Border struct {
  534. Color string `json:"color"`
  535. Width int `json:"width"`
  536. DashType string `json:"dash_type"`
  537. } `json:"border"`
  538. Fill struct {
  539. Color string `json:"color"`
  540. } `json:"fill"`
  541. Layout formatLayout `json:"layout"`
  542. } `json:"plotarea"`
  543. ShowBlanksAs string `json:"show_blanks_as"`
  544. ShowHiddenData bool `json:"show_hidden_data"`
  545. SetRotation int `json:"set_rotation"`
  546. SetHoleSize int `json:"set_hole_size"`
  547. order int
  548. }
  549. // formatChartLegend directly maps the format settings of the chart legend.
  550. type formatChartLegend struct {
  551. None bool `json:"none"`
  552. DeleteSeries []int `json:"delete_series"`
  553. Font Font `json:"font"`
  554. Layout formatLayout `json:"layout"`
  555. Position string `json:"position"`
  556. ShowLegendEntry bool `json:"show_legend_entry"`
  557. ShowLegendKey bool `json:"show_legend_key"`
  558. }
  559. // formatChartSeries directly maps the format settings of the chart series.
  560. type formatChartSeries struct {
  561. Name string `json:"name"`
  562. Categories string `json:"categories"`
  563. Values string `json:"values"`
  564. Line struct {
  565. None bool `json:"none"`
  566. Color string `json:"color"`
  567. Width float64 `json:"width"`
  568. } `json:"line"`
  569. Marker struct {
  570. Type string `json:"type"`
  571. Size int `json:"size"`
  572. Width float64 `json:"width"`
  573. Border struct {
  574. Color string `json:"color"`
  575. None bool `json:"none"`
  576. } `json:"border"`
  577. Fill struct {
  578. Color string `json:"color"`
  579. None bool `json:"none"`
  580. } `json:"fill"`
  581. } `json:"marker"`
  582. }
  583. // formatChartTitle directly maps the format settings of the chart title.
  584. type formatChartTitle struct {
  585. None bool `json:"none"`
  586. Name string `json:"name"`
  587. Overlay bool `json:"overlay"`
  588. Layout formatLayout `json:"layout"`
  589. }
  590. // formatLayout directly maps the format settings of the element layout.
  591. type formatLayout struct {
  592. X float64 `json:"x"`
  593. Y float64 `json:"y"`
  594. Width float64 `json:"width"`
  595. Height float64 `json:"height"`
  596. }