Jump to content
Software FX Community

Extraneous Line Segment in line series?


User (Legacy)
 Share

Recommended Posts

I have a chart in which I am attempting to display an XY scatter series,

plus a Line series. The Line series represents the calculated linear

regression line through the XY points.

It seems to be working OK, except for the Line series. It is mostly

correct, but contains an extra segment that I can't seem to get rid of. The

attached screen shot shows what I'm seeing.

Is there anything obvious I'm doing wrong that would cause this?

Here's the code I'm using to feed data to ChartFX:

'-------------------------------------------------

' Feed in data for X/Y scatter and the Linear Regression line

moChartFX.OpenDataEx COD_VALUES, 2, rstXYPlot.RecordCount +

moChartFX.Axis(AXIS_X).Max - moChartFX.Axis(AXIS_X).Min + 1

moChartFX.OpenDataEx COD_XVALUES, 2, moChartFX.Axis(AXIS_X).Max -

moChartFX.Axis(AXIS_X).Min + 1 + rstXYPlot.RecordCount

moChartFX.Gallery = SCATTER

' First, run through the recordset, and assign XY values for scatter chart.

For i = 0 To rstXYPlot.RecordCount - 1

moChartFX.XValueEx(0, i) = oFieldX.Value

moChartFX.ValueEx(0, i) = oFieldY.Value

rstXYPlot.MoveNext

Next

' Next, create the XY values for the Line chart

For i = 0 To (moChartFX.Axis(AXIS_X).Max - moChartFX.Axis(AXIS_X).Min)

moChartFX.XValueEx(1, i) = moChartFX.Axis(AXIS_X).Min + i

moChartFX.ValueEx(1, i) = RoundIt(nYIntercept + ((i +

moChartFX.Axis(AXIS_X).Min) * nSlope), kgnFormatAvgSpeedDecimals)

Next

moChartFX.CloseData COD_VALUES

moChartFX.CloseData COD_XVALUES

moChartFX.Series(0).Gallery = SCATTER

moChartFX.Series(1).Gallery = LINES

Link to comment
Share on other sites

Well, after a lot of messing around, I found that this problem was somehow

being caused by the .DataType property settings. Specifically, when I

commented out these 3 lines,

moChartFX.DataType(0) = CDT_XVALUE

moChartFX.DataType(1) = CDT_VALUE

moChartFX.DataType(2) = CDT_VALUE

the chart now displays correctly (see attached .gif screen shot).

I have no idea why, but at least it's working now.

GG

"Gary German" <garyg@NOSPAMXshastasoftware.com> wrote in message

news:GUnqomOpEHA.692@webserver3.softwarefx.com...

> I have a chart in which I am attempting to display an XY scatter series,

> plus a Line series. The Line series represents the calculated linear

> regression line through the XY points.

>

> It seems to be working OK, except for the Line series. It is mostly

> correct, but contains an extra segment that I can't seem to get rid of.

The

> attached screen shot shows what I'm seeing.

>

> Is there anything obvious I'm doing wrong that would cause this?

>

> Here's the code I'm using to feed data to ChartFX:

>

> '-------------------------------------------------

> ' Feed in data for X/Y scatter and the Linear Regression line

> moChartFX.OpenDataEx COD_VALUES, 2, rstXYPlot.RecordCount +

> moChartFX.Axis(AXIS_X).Max - moChartFX.Axis(AXIS_X).Min + 1

> moChartFX.OpenDataEx COD_XVALUES, 2, moChartFX.Axis(AXIS_X).Max -

> moChartFX.Axis(AXIS_X).Min + 1 + rstXYPlot.RecordCount

>

> moChartFX.Gallery = SCATTER

>

> ' First, run through the recordset, and assign XY values for scatter

chart.

> For i = 0 To rstXYPlot.RecordCount - 1

> moChartFX.XValueEx(0, i) = oFieldX.Value

> moChartFX.ValueEx(0, i) = oFieldY.Value

> rstXYPlot.MoveNext

> Next

>

> ' Next, create the XY values for the Line chart

> For i = 0 To (moChartFX.Axis(AXIS_X).Max - moChartFX.Axis(AXIS_X).Min)

> moChartFX.XValueEx(1, i) = moChartFX.Axis(AXIS_X).Min + i

> moChartFX.ValueEx(1, i) = RoundIt(nYIntercept + ((i +

> moChartFX.Axis(AXIS_X).Min) * nSlope), kgnFormatAvgSpeedDecimals)

> Next

>

> moChartFX.CloseData COD_VALUES

> moChartFX.CloseData COD_XVALUES

>

> moChartFX.Series(0).Gallery = SCATTER

> moChartFX.Series(1).Gallery = LINES

>

>

>

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