# Conditionally Show Value Labels On Chart

### Pergunta

• I have a bubble chart that has a bunch of points. I want to only show a value label when the Y2 value is greater than 0.2. How can I do this? I've tried setting:

.Label = "#VALY2{P}"

and then when adding the data

If Not b > 0.2R Then
.Points(i).IsValueShownAsLabel = False
End If

However, I am not getting the results I'm looking for.

quinta-feira, 8 de março de 2012 19:22

### Respostas

• I'm guessing .Label is someSeries.Label and b is the Y2 value of the i:th data point in someSeries and .Points(i)... is someSeries.Points(i)..

I'm also guessing that the results that you are getting (I have to guess since you're not telling us this) are labels on each point formatted to look like percentages.

Anyway, the problem with your code is that setting .Label overrides .IsValueShownAsLabel.

Try something like this:

If Not b > 0.2R Then
.Points(i).Label = Nothing
Else
.Points(i).Label = "#VALY2{P}"
End If
• Marcado como Resposta sexta-feira, 9 de março de 2012 15:17
sexta-feira, 9 de março de 2012 09:56

### Todas as Respostas

• I'm guessing .Label is someSeries.Label and b is the Y2 value of the i:th data point in someSeries and .Points(i)... is someSeries.Points(i)..

I'm also guessing that the results that you are getting (I have to guess since you're not telling us this) are labels on each point formatted to look like percentages.

Anyway, the problem with your code is that setting .Label overrides .IsValueShownAsLabel.

Try something like this:

If Not b > 0.2R Then
.Points(i).Label = Nothing
Else
.Points(i).Label = "#VALY2{P}"
End If
• Marcado como Resposta sexta-feira, 9 de março de 2012 15:17
sexta-feira, 9 de março de 2012 09:56
• Sorry for not providing all the information, the good news is that you guessed everything right. Also, that was the answer I was looking for, so thanks.
sexta-feira, 9 de março de 2012 15:17