Why it shows value and percentage?

S

Steven

Dear All,
I set "DataLabelsCollection.Add.HasPercentage = True".
However it shows value and percentage on chart. But, I just want to show
percentage on this chart.
What's going on?

The code as below.

'-------------------------------------------------------Data----------------
---------------------------------------
Dim MyTitle As String
MyTitle = "Sale amount"

Dim MyProduct() = {"ProductA", "ProductB", "ProductC", "ProductD",
"ProductE", "ProductF"}
Dim SaleAmount() = {100, 30, 25, 60, 85, 165}


'-------------------------------------------------------Data----------------
---------------------------------------
Dim Chartspace1 As New ChartSpace
Chartspace1.Clear()

Chartspace1.HasChartSpaceTitle = True
Chartspace1.ChartSpaceTitle.Caption = MyTitle

Chartspace1.ChartSpaceTitle.Font.Bold = True


Dim objChart0
objChart0 = Chartspace1.Charts.Add

Chartspace1.Charts(0).Type = ChartChartTypeEnum.chChartTypePie3D

'Chartspace1.Charts(0).HasTitle = True
'Chartspace1.Charts(0).Title.Caption = MyTitle

Chartspace1.Charts(0).HasLegend = True
Chartspace1.Charts(0).Legend.Position =
ChartLegendPositionEnum.chLegendPositionRight

'--------First Pie Chart--------
With Chartspace1.Charts(0).SeriesCollection.Add
'.SetData(ChartDimensionsEnum.chDimSeriesNames,
ChartSpecialDataSourcesEnum.chDataLiteral, "Y")
.SetData(ChartDimensionsEnum.chDimCategories,
ChartSpecialDataSourcesEnum.chDataLiteral, MyProduct)
.SetData(ChartDimensionsEnum.chDimValues,
ChartSpecialDataSourcesEnum.chDataLiteral, SaleAmount)
.DataLabelsCollection.Add.HasPercentage = True
End With

Dim strChartType
Dim strSavePath As String
Dim FileName As String


FileName = Guid.NewGuid.ToString & ".gif"
strSavePath = Server.MapPath(".") & "\Pic\" & FileName

Chartspace1.ExportPicture(strSavePath, "gif", 800, 600)

'MyImage.ImageUrl = strSavePath
MyImage.ImageUrl = "Pic\" & FileName
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top