Quantcast
Channel: Forums - ArcObjects SDKs
Viewing all articles
Browse latest Browse all 1374

ClassBreaksRenderer?

$
0
0
Hi, I've been playing with VB.net, trying to make a choropleth map:
I've tried the PresetColorRamp, and then the RandomColorRamp. I either get an error (the compiler doesn't seem to like:
pColorRamp.PresetColor(i) = pColor under the preset option - something about a COM error? Then it doesn't like
pColorRamp.Color = pColor under the random option, saying that the color is read only. I think I'm going to have to be able to change the color. Another problem I was getting was that the whole map was disappearing. It was still in the Table Of Contents
but it wasn't displaying.

Maybe I need a reference or something?

'Dim pColorRamp As IColorRamp = New PresetColorRamp
Dim pColorRamp As IColorRamp = New RandomColorRamp

pColorRamp.Name = "Colors"
pColorRamp.Size = 13
pColorRamp.CreateRamp(True)

Dim pColor As IRgbColor = New RgbColor

For i = 0 To 12
pColor.Red = i * 15
pColor.Green = i * 15
pColor.Blue = i * 15
'pColorRamp.PresetColor(i) = pColor
'pColorRamp.Color = pColor
Next i

Dim pRender As IClassBreaksRenderer = New ClassBreaksRenderer
pRender.Field = "countycd"
pRender.BreakCount = 5
pRender.MinimumBreak = 1
pRender.Break(0) = 25
...
pRender.Break(3) = 100
pRender.Break(4) = 133

pRender.Label(0) = "Label 0"
...
pRender.Label(4) = "Label 4"

Dim pColorEnum As IEnumColors = pColorRamp.Colors
pColorEnum.Reset()

Dim pSFSym As ISimpleFillSymbol = New SimpleFillSymbol
For i = 0 To 4
pSFSym.Color = pColorEnum.Next
pRender.Symbol(i) = pSFSym
Next i

Dim pUIProperties As IClassBreaksUIProperties = pRender
pUIProperties.ColorRamp = "MyCustomRamp"
pUIProperties.LowBreak(0) = 1
...
pUIProperties.LowBreak(4) = 101
pUIProperties.ShowClassGaps = False

Dim pGeoLayer As IGeoFeatureLayer = pMxDoc.ActiveView.FocusMap.Layer(0)
pGeoLayer.Renderer = pRender

pMxDoc.UpdateContents()
pMxDoc.ActiveView.Refresh()

Viewing all articles
Browse latest Browse all 1374

Trending Articles