Jump to content
Software FX Community

Re: series & recordsets


User (Legacy)

Recommended Posts

Karen,

Hard to tell what you're using to make charts.

Here's a routine to take data from an ADO recordset into a chart.

Steve

Private Sub Form_Load()

'Create variables for ADO Connection and Resultset

Dim Conn As ADODB.Connection

Dim rs As ADODB.Recordset

Dim objChart As ChartfxLib.ChartFX

Dim s As Integer

Dim v As Integer

Set objChart = Me.ChartFX1.Object

'Create variable to hold the Chart FX Default Data provider

Dim CfxData As CfxDataAdo

'Create Ado object from the Chart FX ChartFX Data Provider

Set CfxData = CreateObject("CfxData.Ado")

'Open the connection

Set Conn = CurrentProject.Connection

'Open rs

Set rs = New ADODB.Recordset

rs.Open "SELECT BDate, Series1, Series2, Series3 FROM tblDATA;", Conn, adOpenKeyset

'Assign the ADO resultset to the ChartFX Data Provider

CfxData.ResultSet = rs

'DataType Property:

objChart.DataType(0) = CDT_LABEL

objChart.DataType(1) = CDT_VALUE

objChart.DataType(2) = CDT_VALUE

objChart.DataType(3) = CDT_VALUE

With objChart

'Let Chart FX take information from the data provider

.GetExternalData CfxData

.Chart3D = False

.Gallery = LINES

.Axis(AXIS_Y).ForceZero = False

.Axis(AXIS_Y).Min = GetMin(rs, 1) * 0.97

.Axis(AXIS_Y).Max = GetMax(rs, 1) * 1.03

End With

ProcExit:

Set objChart = Nothing

rs.Close

Conn.Close

Set Conn = Nothing

Set rs = Nothing

Set CfxData = Nothing

End Sub

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

Archived

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

×
×
  • Create New...