Jump to content
Software FX Community

XY Charts 5.1 in VB


User (Legacy)
 Share

Recommended Posts

Hi,

I am trying to create a simple XY chart from a recordset and I am having

problems with the result. The recordset consists of 3 records and 7 fields,

the first field is ignored for plotting because it is the description of

series that is being plotted. Here is the code I have:

CfxData.ResultSet = rsPassedGraphdata

.DataType(0) = CDT_LABEL

.DataType(1) = CDT_VALUE

.DataType(2) = CDT_XVALUE

.OpenDataEx COD_VALUES, rsPassedGraphdata.RecordCount,

rsPassedGraphdata.Fields.count

.OpenDataEx COD_XVALUES, rsPassedGraphdata.RecordCount,

rsPassedGraphdata.Fields.count

rsPassedGraphdata.MoveFirst

For i = 0 To rsPassedGraphdata.RecordCount - 1

For j = 1 To rsPassedGraphdata.Fields.count - 1

.Series(i).Yvalue(j - 1) =

IIf(Trim(rsPassedGraphdata.Fields(j).Value) = "", "0",

rsPassedGraphdata.Fields(j).Value)

.Series(i).Xvalue(j - 1) = j

Next j

.SerLeg(i) = Trim(rsPassedGraphdata.Fields(0).Value)

rsPassedGraphdata.MoveNext

Next i

.SerLegBox = True

Set SerLegBox = .SerLegBoxObj

SerLegBox.Moveable = False

SerLegBox.BorderStyle = BBS_FLAT

SerLegBox.Docked = TGFP_FIXED

' Center vertically

SerLegBox.Left = .Width - SerLegBox.Width - 8

SerLegBox.Top = .Height / 2 - SerLegBox.Height / 2

.RightGap = SerLegBox.Width + 8

SerLegBox.Visible = True

rsPassedGraphdata.MoveFirst

For i = 0 To rsPassedGraphdata.Fields.count - 2

.Axis(AXIS_X).Label(i) = Left(rsPassedGraphdata.Fields.Item(i +

1).Name, 5)

Next i

Somehow my results get an extra column with zeros for the values. Also, I

can not get the legend to appear anywhere on the output. The legend button

is enabled in the menu bar, but will not show up.

Thanks for the help in advance.

Joe Glen

Link to comment
Share on other sites

You are mixing two things here: You are using DataBinding API (DataType) as 

well as Data API (OpenDataEx, etc.). Which one do you want to use ?

1) If you are going to use DataBinding, DataType must be assign BEFORE the

dataset is read, so simply move the line:

CfxData.ResultSet = rsPassedGraphdata

After the DataType code. The OpenDataEx, YValue,XValue must be removed.

2) If you are going top pass the data manually, remove any DataBindings from

the chart (DataSource property) and DataType code.

Other things to consider:

- Only certain types of charts support X-Values, among them Lines, Scatter,

Area. Some chart types like Bar, Cube, Hi-Low-Close, do NOT support X-Values

in Chart FX 5.

- All data indices are zero based.

--

Francisco Padron

www.chartfx.com

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...