# GrapeCity.Spreadsheet.Drawing.ITextRange.InsertChartField

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="GrapeCity_Spreadsheet_Drawing_ITextRange_InsertChartField_" data-uid="GrapeCity.Spreadsheet.Drawing.ITextRange.InsertChartField*">InsertChartField Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="GrapeCity_Spreadsheet_Drawing_ITextRange_InsertChartField_" data-uid="GrapeCity.Spreadsheet.Drawing.ITextRange.InsertChartField*"></a>
<h4 id="GrapeCity_Spreadsheet_Drawing_ITextRange_InsertChartField_GrapeCity_Spreadsheet_Charts_ChartFieldType_System_String_System_Int32_" data-uid="GrapeCity.Spreadsheet.Drawing.ITextRange.InsertChartField(GrapeCity.Spreadsheet.Charts.ChartFieldType,System.String,System.Int32)">InsertChartField(ChartFieldType, string, int)</h4>
<div class="markdown level1 summary"><p>Inserts a field into the body of a data label in a chart.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">void InsertChartField(ChartFieldType fieldType, string formula = null, int position = -1)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Sub InsertChartField(fieldType As ChartFieldType, Optional formula As String = Nothing, Optional position As Integer = -1)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><span class="xref">ChartFieldType</span></td>
      <td><span class="parametername">fieldType</span></td>
      <td><p>Specifies the type of chart field to insert into a data label.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></td>
      <td><span class="parametername">formula</span></td>
      <td><p>Specifies a cell (or range) if the <span class="xref">GrapeCity.Spreadsheet.Charts.ChartFieldType.Formula</span> constant is passed in for the ChartFieldType parameter.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">position</span></td>
      <td><p>Specifies the character position where the chart field is inserted. The default is to append the field to the end of the text. If the position value is out of range, the default is used.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 id="GrapeCity_Spreadsheet_Drawing_ITextRange_InsertChartField_GrapeCity_Spreadsheet_Charts_ChartFieldType_System_String_System_Int32__remarks">Remarks</h5>
<div class="markdown level1 remarks"><p>This method applies only to data labels in a chart.</p>
</div>
</div>
