Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

 

 

Excerpt

When you include a chart in a template spreadsheet, you can use a data marker column as a data source for the chart. Excel will automatically adjust charts to include the number of rows that ExcelWriter assigns to the data marker column.

Code Sample: Using Charts with ExcelTemplate

[C#][VB.NET]

How to Link a Chart to a Template Data Marker

  1. In Microsoft Excel, create an ExcelWriter template. For instructions on creating a template, see How to Use Templates.
    Image Added

  2. Use Excel's Chart Wizard to create a chart in your spreadsheet. Open the Insert menu and select Chart..., or click the toolbar's Chart Wizard icon. Select the type of chart you would like to create and click Next.
    Image Added

  3.  In the Data Range field, enter the cell that contains the data marker that you want to use as a data source for your chart. Excel requires both a starting point and an ending point in the Data Range Field. So, if your data marker is at cell C13, enter =Sheet1\!$C$13:$C$13

...

  1. .

...

  1. The

...

  1. number

...

  1. of

...

  1. rows

...

  1. ExcelWriter

...

  1. will

...

  1. insert

...

  1. at

...

  1. the

...

  1. data

...

  1. marker

...

  1. will

...

  1. vary,

...

  1. and

...

  1. Excel

...

  1. will

...

  1. automatically

...

  1. adjust

...

  1. the

...

  1. chart

...

  1. to

...

  1. include

...

  1. all

...

  1. data

...

  1. in

...

  1. the

...

  1. data

...

  1. marker

...

  1. column.
    Image Added 

  2.  Select the Series tab, and in the Category Label field, enter the range of cells containing the label data marker. Include starting and end points in the category label range. For example, if the label data marker is at cell A13, enter =Sheet1\!$A$13:$A$13

...

  1. and

...

  1. Excel

...

  1. will

...

  1. automatically

...

  1. adjust

...

  1. the

...

  1. chart

...

  1. for

...

  1. the

...

  1. amount

...

  1. of

...

  1. data

...

  1. that

...

  1. fills

...

  1. the

...

  1. spreadsheet.
    Image Added 

  2.  Enter a chart title and click Next.
    Image Added 

  3. Select a chart location and click Finish to insert the chart into your spreadsheet.
    Image Added

     

  4.  The unpopulated chart is now in your spreadsheet.
    Image Added 

  5.  Format the chart and data marker cells as you would like them to appear when the final spreadsheet is created. Data marker formatting is carried down to each inserted cell when data is dynamically entered into the spreadsheet by ExcelWriter.
    Image Added 

  6.  Run your ExcelWriter application to populate the spreadsheet.
    Image Added