dee2020 0 Newbie Poster

Hello

I have a module that consist of Ms Chart show out all five month sales amount. Then I can show out the chart either in 2D bar or Pie chart. The problem is each time eg the first time I show the Pie chart, the amount of % of each slice is shown correctly. Then I change to 2D Bar and it also shows the amount correctly but when I change back to view pie chart, the amount of % of each slice is NOT SHOWN( its gone).

The coding that I used to show the data label is as below

With MSChart

blnChartType = graphType(0).Value

Select Case blnChartType

Case "True":
.chartType = VtChChartType2dPie ' Pie Chart
.ChartData = arrData
.Visible = True ' Making MSChart visible

For intA = 1 To .Plot.SeriesCollection.Count
With.Plot.SeriesCollection(intA).DataPoints.Item(-1).DataPointLabel
.LocationType = VtChLabelLocationTypeOutside
.Component = VtChLabelComponentPercent
.PercentFormat = "0%"
.VtFont.Size = 10 ' Setting Font Size to 10
End With

Next intA


Case "False":
.chartType = VtChChartType2dBar ' Bar Chart
.ChartData = arrData
.Visible = True ' Making MSChart visible


For intA = 1 To .Plot.SeriesCollection.Count

With.Plot.SeriesCollection(intA).DataPoints.Item(-1).DataPointLabel
.LocationType = VtChLabelLocationTypeAbovePoint
.Component = VtChLabelComponentValue
.VtFont.Size = 10 ' Setting Font Size to 10
End With

Next intA
End Select

End With

THANK YOU VERY MUCH
ANY HELP WOULD BE MUCH APPRECIATED

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.