User (Legacy) Posted March 6, 2001 Report Share Posted March 6, 2001 Johannes, This code may lead you to a solution. It uses the Annotation object to change the point marker. This code uses the 'random' data in the ChartFx object which is why you don't see me loading any data. Steve (sample from Access 2k) Private Sub Form_Load() Dim objChart As ChartfxLib.ChartFX Dim AnnotX As AnnotationX Dim objL As AnnotateX.AnnText Dim i As Integer Dim j As Integer Dim nMarkerPosition As Long Dim x As Integer, y As Integer Dim dblSeries As Double '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 = BAR 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) dblSeries = 0 'total values from current series For j = 0 To (objChart.NValues - 1) dblSeries = dblSeries + objChart.ValueEx(i, j) Next 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) / dblSeries, "##.#0%") 'Here we go! objL.Font.Size = 7 '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 '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\BarPct.bmp" Set objChart = Nothing Set objL = Nothing Set AnnotX = Nothing End Sub Johannes Appelo <jappelo@intekom.co.za> wrote in message news:gmmQH0XpAHA.2592@sfxserver.softwarefx.com... > Hi, > > Is there a method whereby one can convert all values in all series to > percentages of series total? I know this works for Pie charts, but I cannot > identify anything to make this work for Bar Charts. This would be useful for > benchmarking. > > Thanks > Johannes Appelo > > 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.