Jump to content
Software FX Community

Re: Only equi-distance data set is permitted ?

User (Legacy)

Recommended Posts

Are you setting the .Gallery to Scatter?

Here's some demo code:

Private Sub Form_Load()

'Create variables for ADO Connection and Resultset

Dim Conn As ADODB.Connection

Dim rs As ADODB.Recordset

Dim CfxData As Object

Dim ChartFX1 As ChartfxLib.ChartFX

Dim AnnotX As AnnotateX.AnnotationX

Dim objText As AnnotateX.AnnText

Dim nMarkerPosition As Variant

Dim i As Integer, j As Integer

Dim x As Integer, y As Integer

'set referenct to chart object

Set ChartFX1 = Me.ChartFX1.Object

'create new annotation object

Set AnnotX = New AnnotateX.AnnotationX

'turn off toolbar

AnnotX.Toolbar = False

'add AnnotX to Chart1

ChartFX1.AddExtension AnnotX

'Open the connection

Set Conn = CurrentProject.Connection

'Execute SQL and obtain resultset

Set rs = Conn.Execute("SELECT * FROM tblXY2;") '{(x,y): (1,10), (3,15), (4,20),...}.

'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 ChartFX1

.DataType(0) = CDT_XVALUE

.DataType(1) = CDT_VALUE

'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


'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

'.Axis(AXIS_X).Style = .Axis(AXIS_X).Style = AS_SHOWENDS

End With

'Place xy text annotations on graph


i = 0

j = 0 'point counter

Do Until rs.EOF

'annotate chart

Set objText = AnnotX.Add(OBJECT_TYPE_TEXT)

'set objText equal to Legend

objText.Text = "X: " & rs(0) & " Y: " & rs(1) & " "

objText.Color = vbBlack

objText.Font.Size = 7


'Give it height and width, then SizeToFit

objText.Width = 100

objText.Height = 100


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

x = CHART_LOWORD(nMarkerPosition)

y = CHART_HIWORD(nMarkerPosition)

objText.Left = x + 10

objText.Top = y + 5

j = j + 1






Set Conn = Nothing

Set rs = Nothing

Set CfxData = Nothing

Set ChartFX1 = Nothing

Set objText = Nothing

Set AnnotX = Nothing

End Sub


Kim Hyung Geun <hgkim@mathx.kaist.ac.kr> wrote in message news:Dr1cbIsUAHA.1752@sfxserver.softwarefx.com...

> Hi,


> I'm trying to plot non-equidistance data set.

> For example

> {(x,y): (1,10), (3,15), (4,20),...}.


> It is impossible in ChartFX ?



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.

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.


  • Create New...