Excel VB.NET How do you change the border of an individual bubble in a bubble chart?
-
07-07-2021 - |
Question
I am generating bubble charts in VB.NET and I think it would be nice to make the border of a bubble thicker, so its easier to see if there is an overlap, but I can't sort out how to do it. To do it by hand you just right click on the bubble, go to border styles and put in your value.
I sorted out how to change the color of bubbles with:
.chart.SeriesCollection(i).interior.color = RGB
I have spent quite a bit of time reading around looking for something similar that will allow me to raise the border weight a point or so, but I have had no luck.
Anyone know how to do it? Thanks as always SO!
Update: What I did:
With oChart
With CType(.SeriesCollection, Excel.SeriesCollection)
.NewSeries()
With CType(.Item(counterVal - 43), Excel.Series)
.Name = mainSheet.Range("a" & counterVal).Value
.XValues = mainSheet.Range("b" & counterVal).Value
.Values = mainSheet.Range("d" & counterVal).Value
.BubbleSizes = mainSheet.Range("c" & counterVal).Value
.HasDataLabels = True
.DataLabels.Position = XlDataLabelPosition.xlLabelPositionAbove
'DL.ShowSeriesName = True
.Has3DEffect = True
.Format.ThreeD.SetThreeDFormat(Microsoft.Office.Core.MsoPresetThreeDFormat.msoThreeD1)
'.Format.Line.Weight = 1.5
End With
End With
End With
I ended up just using 3D effects instead of the line weight, but I left them both in.
Solution
e.g.
Dim ws As Worksheet
Dim co As ChartObject
Dim ch As Chart
Dim sr As Series
Dim pt As Point
Set ws = ActiveSheet
Set co = ws.ChartObjects(1)
Set ch = co.Chart
Set sr = ch.SeriesCollection(1)
Set pt = sr.Points(19)
pt.Select
With Selection.Format.Fill
.Visible = msoTrue
.ForeColor.ObjectThemeColor = msoThemeColorAccent2
.ForeColor.TintAndShade = 0
.ForeColor.Brightness = 0
.Transparency = 0
.Solid
End With
With Selection.Format.Line
.Visible = msoTrue
.ForeColor.RGB = RGB(0, 176, 80)
.Transparency = 0
End With
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow