Method
There are three methods for binding data to a chart:
– Use the `Select` method on a cell range to select data.
– Use the `SetSourceData` method of the `Chart` object to bind data.
– Use the `ChartWizard` method in the API approach to bind data.
The `SetSourceData` method of the `Chart` object allows you to set the source data range for the specified chart. The syntax is as follows:
cht.SetSourceData(Source, PlotBy)
Here, `cht` is the generated `Chart` object, and the parameters are as follows:
– `Source` – A `Range` object that specifies the source data range for the chart.
– `PlotBy` – Specifies how the data is plotted. A value of 1 means the data is plotted by columns, and a value of 2 means it is plotted by rows.
Leave a Reply