0

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.

asjohnson
  • 1,057
  • 4
  • 17
  • 25

1 Answers1

1

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
JustinJDavies
  • 2,663
  • 4
  • 30
  • 52
  • Apologies, just saw that you are asking for VB.Net and this answer is for VBA. However, you still need a reference to the point in your SeriesCollection – JustinJDavies Oct 16 '12 at 22:37
  • Thanks, I put it up in VBA as well as VB.NET, because a lot of the time VBA informs the .NET and this is one of the rare instances where the macro recorder failed me. I am going to dig into what you posted and see if I can get to the answer from it, so far it looks promising. – asjohnson Oct 17 '12 at 15:55
  • There is a strange behaviour in VBA whereby this code doesn't appear to work without the `pt.Select` statement. If you try and update the `Point.Format.Fill` directly it doesn't appear to work. – JustinJDavies Oct 18 '12 at 09:36
  • So apparently I am just not thinking very hard and sorted it out. I am giving you the credit, since your post got me going on the right track. Thanks! I updated my first post with what ended up working. – asjohnson Oct 18 '12 at 14:47