Jump to content
Software FX Community

Re: series & recordsets


User (Legacy)
 Share

Recommended Posts

Karen,

Posting this to the newsgroup for those who are interested.

I don't think you'll be able to add multiple series but you can use annotation to add some additional data/information to your chart.

I use Access 2k

Private Sub Form_Load()

'Create variables for ADO Connection and Resultset

Dim Conn As ADODB.Connection

Dim rs As ADOR.Recordset

Dim CfxData As Object

Dim objCfx As ChartfxLib.ChartFX

Dim AnnotX As AnnotateX.AnnotationX

Dim objText As AnnotateX.AnnText

Dim nMarkerPosition As Variant

Dim i As Long, j As Long

Dim x As Long, y As Long

'set referenct to chart object

Set objCfx = Me.ChartFX1.Object

'create new annotation object

Set AnnotX = New AnnotateX.AnnotationX

'turn off toolbar

AnnotX.Toolbar = False

'add AnnotX to Chart1

objCfx.AddExtension AnnotX

'Open the connection

Set Conn = CurrentProject.Connection

'Execute SQL and obtain resultset

Set rs = Conn.Execute("SELECT GIndex, TimeOfWeighBack, WeighBackLbs FROM tblWeighBack;")

'Create Ado object from the Chart FX Resultset

Set CfxData = CreateObject("CfxData.Ado")

'Assign the ADO resultset to the ChartFX Data Provider

CfxData.ResultSet = rs

With objCfx

.DataType(0) = CDT_NOTUSED 'GIndex will be used for coloring

.DataType(1) = CDT_XVALUE 'TimeOfWeighBack

.DataType(2) = CDT_VALUE 'WeighBackLbs

'Let Chart FX take information from the data provider

.GetExternalData CfxData

'Add any other adjustments to the object here.

.Gallery = SCATTER

.Chart3D = False

.PointLabels = False

.MarkerShape = MK_NONE

.RecalcScale

'Expand Min/Max values for 'readability'

.Axis(AXIS_Y).Max = .Axis(AXIS_Y).Max * 1.1

.Axis(AXIS_X).Max = .Axis(AXIS_X).Max + 1

.Axis(AXIS_X).STEP = 1

.Axis(AXIS_X).MinorStep = 0.5

End With

'Place xy text objects on graph marking GIndex numbers

rs.MoveFirst

j = 0 'point counter

Do Until rs.EOF

'annotate chart

Set objText = AnnotX.Add(OBJECT_TYPE_TEXT)

'set objText equal to Legend

objText.Text = "(" & rs(0) & ") "

'adjust color

If rs!GIndex = 1 Then

objText.Color = vbBlack 'you could have a lookup table here

Else 'for various colors, ChartFx only does 16

objText.Color = vbRed 'before it repeats

End If

objText.Font.Size = 7

objText.BkColor = CHART_TRANSPARENT

'Give it height and width, then SizeToFit

objText.Width = 100

objText.Height = 100

objText.SizeToFit

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

x = CHART_LOWORD(nMarkerPosition)

y = CHART_HIWORD(nMarkerPosition)

objText.left = x

objText.Top = y

j = j + 1

rs.MoveNext

Loop

objCfx.Export CHART_BITMAP, "c:\temp\sample.bmp"

BmpToGif "c:\temp\sample.bmp"

ProcExit:

rs.Close

Conn.Close

Set Conn = Nothing

Set rs = Nothing

Set CfxData = Nothing

Set objCfx = Nothing

End Sub

Steve

Karen <klwhitlo@unity.ncsu.edu> wrote in message news:2u9PlZLzAHA.1808@sfxserver.softwarefx.com...

> I have a record set with multiple groups of data.

>

> I would like each group represented by a series on the chart.

>

> Is it possible to assign each series in a chart to a recordset?

>

> KAren

>

>

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...