Jump to content
Software FX Community

Re: PointLabelColor Property inexistant!


User (Legacy)

Recommended Posts

Here's one solution using Annotation objects.

I use ChartFX98 with Access 2000, same code should work with Vb

Steve

Private Sub Form_Load()

Dim objChart As ChartfxLib.ChartFX

Dim AnnotX As AnnotationX

Dim objL As AnnotateX.AnnText 'this will be the point marker

Dim i As Integer

Dim j As Integer

Dim nMarkerPosition As Long

Dim x As Integer, y As Integer

'set referenct to chart object on form

Set objChart = Me.ChartFX1.Object

'create new annotation object

Set AnnotX = New AnnotationX

'turn off toolbar

AnnotX.Toolbar = False

'add AnnotX to Chart1

objChart.AddExtension AnnotX

objChart.Gallery = LINES

objChart.Chart3D = False

objChart.RGB2DBk = vbWhite

objChart.PointLabels = False

objChart.Axis(AXIS_Y).Max = objChart.Axis(AXIS_Y).Max * 1.2

For i = 0 To (objChart.nSeries - 1)

For j = 0 To (objChart.NValues - 1)

'create a new text object

Set objL = AnnotX.Add(OBJECT_TYPE_TEXT)

'figure where the chart is drawing the point marker

nMarkerPosition = objChart.PaintInfo(CPI_MARKERTOPIXEL, CHART_ML(i, j))

x = CHART_LOWORD(nMarkerPosition)

y = CHART_HIWORD(nMarkerPosition)

'set text of new text marker

objL.Text = Format(objChart.ValueEx(i, j), "##.0")

'give it an initial size

objL.Width = 5

objL.Height = 5

objL.SizeToFit

'locate the upper left position

objL.Left = x - objL.Width / 2

objL.Top = y - objL.Height

'mess up the point colors or set them to a color of your purpose

objL.Color = RGB(Int((255 * Rnd) + 1), Int((255 * Rnd) + 1), Int((255 * Rnd) + 1))

objL.BkColor = CHART_TRANSPARENT

objL.BorderStyle = LS_NONE

objL.AllowMove = False

objL.AllowModify = False

objL.Refresh False

Next j

Next i

'objChart.Export CHART_BITMAP, "c:\temp\MultiColorPoints.bmp"

Set objChart = Nothing

Set objL = Nothing

Set AnnotX = Nothing

End Sub

Fr

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...