Problem with DataLabels on chart

Hi,

Datalabels are displayed 0% every time,value are there in column L,but always displays 0 only.What may be the reason.Can you please check the code once.

I have written below code.

chart.Title.Text = "TM Product Usage"

chart.Title.TextFont.Name = "Arial"

chart.Title.TextFont.Size = 12

chart.Title.TextFont.IsBold = True

chart.Title.TextFont.Color = Color.Black

'Set series

chart.NSeries.Add("By Acct Type!B2:B" & intMaxRows, True)

chart.NSeries.Add("By Acct Type!L2:L" & intMaxRows, True)

chart.NSeries(0).Name = "Number of Relationships"

chart.NSeries.CategoryData = "By Acct Type!A2:A" & intMaxRows

chart.NSeries(1).PlotOnSecondAxis = True

chart.ValueAxis.Title.Rotation = 90

chart.ValueAxis.Title.TextFont.Size = 12

chart.ValueAxis.Title.TextFont.Name = "Arial"

chart.ValueAxis.Title.TextFont.IsBold = True

chart.ValueAxis.Title.Text = "Number of Relationships"

chart.ValueAxis.Title.TextFont.Color = Color.Black

chart.ValueAxis.IsVisible = True

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

chart.NSeries(1).DataLabels.Postion = LabelPositionType.InsideBase

chart.NSeries(1).Line.IsVisible = False

chart.NSeries(1).Area.Formatting = FormattingType.None

chart.NSeries(1).MarkerStyle = ChartMarkerType.None

chart.IsLegendShown = False

chart.MajorGridLines.IsVisible = False

chart.ChartArea.Border.IsVisible = False

Dim pointsCount As Integer

pointsCount = chart.NSeries(0).Points.Count

Dim i As Integer

For i = 0 To pointsCount

If (i >= 0 And i <= 10) Then

excel.ChangePalette(Color.SeaGreen, 40)

chart.NSeries(0).Points(i).Area.ForegroundColor = Color.SeaGreen

ElseIf (i >= 11 And i <= 19) Then

excel.ChangePalette(Color.DarkRed, 41)

chart.NSeries(0).Points(i).Area.ForegroundColor = Color.DarkRed

Else

excel.ChangePalette(Color.Orange, 42)

chart.NSeries(0).Points(i).Area.ForegroundColor = Color.Orange

End If

Next

Thanks,

Arun

Column L is saved as string instead of numeric data. Please convert them to numbers.

Hi,

Those values are stored as percentages not as strings,if i modify value it is displaying correctly.

Thanks,

Arun

I found the issue. It was an issue with my code and has been fixed. Sorry to bother you.

Thanks,

Arun

Hi,

Now i am able to display values as datalabels,now i want to hide the column L,if i hide the column datalabels are not displayed.How to solve this problem.

Thanks,

Arun

Yes, the datalabes are hidden when the column is hidden. You can set a very narrow width but don’t hide it. For example, you can set column L’s width to 0.1.

Hi,

Thanks for your quick response,It worked out.

Thanks,

Arun