User (Legacy) Posted September 27, 2004 Report Share Posted September 27, 2004 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 More sharing options...
User (Legacy) Posted September 28, 2004 Author Report Share Posted September 28, 2004 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.