I'm using Microsoft.office.interop.excel and generated an excel with data
I am currently showing this data in the same excel as chart also like this:
But I need this data to be grouped like this:
How can I modify my code to achieve this?
Current code
Dim chartDeliveryDetailDateRd As Excel.Chart
Dim xlChartsDd As Excel.ChartObjects
Dim myChartDdRd As Excel.ChartObject
Dim chartRangeDdRd As Excel.Range
xlChartsDd = xlWorkSheet3.ChartObjects
myChartDdRd = xlChartsDd.Add(50, 100, 500, 250)
chartDeliveryDetailDateRd = myChartDdRd.Chart
chartRangeDdRd = xlWorkSheet3.Range("a1", "i4")
chartDeliveryDetailDateRd.SetSourceData(Source:=chartRangeDdRd)
chartDeliveryDetailDateRd.ChartType = Excel.XlChartType.xlColumnClustered
I find the solution, it was actually one line of code.
Added
chartDeliveryDetailDateRd.PlotBy = Excel.XlRowCol.xlColumns
This will plot the chart by columns and in my case the data gets grouped