[]
Returns a single IAxis object from this IAxes collection.
Use this method to retrieve an axis by type from the primary axis group, or by both type and axis group when you need a secondary axis.
IAxis Item(AxisType Type, AxisGroup AxisGroup = AxisGroup.Primary)
Function Item(Type As AxisType, Optional AxisGroup As AxisGroup = AxisGroup.Primary) As IAxis
| Type | Name | Description |
|---|---|---|
| AxisType | Type | The AxisType of the axis to retrieve. |
| AxisGroup | AxisGroup | The AxisGroup of the axis to retrieve. |
| Type | Description |
|---|---|
| IAxis | The IAxis object. |
worksheet.Range["A1:C4"].Value = new object[,] {
{"Month", "Sales", "Profit"},
{"Jan", 100, 30},
{"Feb", 120, 40},
{"Mar", 140, 50}
};
IChart chart = worksheet.Shapes.AddChart(ChartType.ColumnClustered, 20, 20, 360, 220).Chart;
chart.SeriesCollection.Add(worksheet.Range["A1:C4"], RowCol.Columns, true, true);
IAxis valueAxis = chart.Axes.Item(AxisType.Value);
chart.SeriesCollection[1].AxisGroup = AxisGroup.Secondary;
IAxis secondaryValueAxis = chart.Axes.Item(AxisType.Value, AxisGroup.Secondary);
secondaryValueAxis.HasTitle = true;
secondaryValueAxis.AxisTitle.Text = "Profit";