Problem while creating datalabels on chart


#1

Hi,

I want to show some %value on column chart,below is my code it is giving error.

Pls find the excel as attachment, which i want to implement.

Dim chartIndex As Integer = sheet2.Charts.Add(ChartType.Column, 5, 5, 20, 15)

Dim chart As chart = sheet2.Charts(chartIndex)

chart.Title.Text = "Distribution of Relationship by Industry"

'Set series

Dim series As String = "Summary!B2:B" & (ds.Tables(0).Rows.Count - 1)

chart.NSeries.Add(series, True)

chart.NSeries(0).Name = "Relation Ships"

chart.NSeries(1).DataLabels.IsValueShown = True

Thanks,

Arun


#2

Please replace this piece of code:

chart.NSeries(1).DataLabels.IsValueShown = True

to:

chart.NSeries(1).DataLabels.IsPercentageShown = True