@@ -194,6 +194,10 @@ var (
194
194
// chart with default value.
195
195
func parseFormatChartSet (formatSet string ) * formatChart {
196
196
format := formatChart {
197
+ Dimension : formatChartDimension {
198
+ Width : 480 ,
199
+ Height : 290 ,
200
+ },
197
201
Format : formatPicture {
198
202
FPrintsWithSheet : true ,
199
203
FLocksWithSheet : false ,
@@ -351,13 +355,7 @@ func parseFormatChartSet(formatSet string) *formatChart {
351
355
// maximum: Specifies that the fixed maximum, 0 is auto. The maximum property is optional. The default value is auto.
352
356
// minimum: Specifies that the fixed minimum, 0 is auto. The minimum property is optional. The default value is auto.
353
357
//
354
- func (f * File ) AddChart (sheet , cell , format string , opts ... chartOpts ) {
355
-
356
- var defOpts = defaultChartOptions
357
- for _ , optF := range opts {
358
- optF (& defOpts )
359
- }
360
-
358
+ func (f * File ) AddChart (sheet , cell , format string ) {
361
359
formatSet := parseFormatChartSet (format )
362
360
// Read sheet data.
363
361
xlsx := f .workSheetReader (sheet )
@@ -367,40 +365,12 @@ func (f *File) AddChart(sheet, cell, format string, opts ...chartOpts) {
367
365
drawingXML := "xl/drawings/drawing" + strconv .Itoa (drawingID ) + ".xml"
368
366
drawingID , drawingXML = f .prepareDrawing (xlsx , drawingID , sheet , drawingXML )
369
367
drawingRID := f .addDrawingRelationships (drawingID , SourceRelationshipChart , "../charts/chart" + strconv .Itoa (chartID )+ ".xml" , "" )
370
- f .addDrawingChart (sheet , drawingXML , cell , defOpts . width , defOpts . height , drawingRID , & formatSet .Format )
368
+ f .addDrawingChart (sheet , drawingXML , cell , formatSet . Dimension . Width , formatSet . Dimension . Height , drawingRID , & formatSet .Format )
371
369
f .addChart (formatSet )
372
370
f .addContentTypePart (chartID , "chart" )
373
371
f .addContentTypePart (drawingID , "drawings" )
374
372
}
375
373
376
- type chartOptions struct {
377
- width int
378
- height int
379
- }
380
-
381
- var defaultChartOptions = chartOptions {
382
- width : 480 ,
383
- height : 290 ,
384
- }
385
-
386
- type chartOpts func (opts * chartOptions )
387
-
388
- // ChartWidth sets the chart width.
389
- func ChartWidth (width int ) chartOpts {
390
- return func (opts * chartOptions ) {
391
- opts .width = width
392
- return
393
- }
394
- }
395
-
396
- // ChartHeight sets the chart height.
397
- func ChartHeight (height int ) chartOpts {
398
- return func (opts * chartOptions ) {
399
- opts .height = height
400
- return
401
- }
402
- }
403
-
404
374
// countCharts provides function to get chart files count storage in the
405
375
// folder xl/charts.
406
376
func (f * File ) countCharts () int {
0 commit comments