User (Legacy) Posted February 2, 2001 Report Share Posted February 2, 2001 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.