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.

645 lines
24KB

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