M
Mike
Hello, I have noticed a problem with the moving average trendline in both
the OWC.10 and OWC.11 versions of the chart. When you have "missing" dates
in your axis, the moving average trendline will calculate 0 for that
datapoint unlike in normal Excel. The chart renders the datapoints and line
correctly, but not the trendline.
Here is some sample code to demonstrate the problem - notice that my dataset
is missing a value for 1/4/03 which causes the problem.:
<%@ Page Language="vb" ASPCompat=True Debug=True %>
<script language="vbscript" runat="server">
Public Sub Page_Load(Sender as Object, e as EventArgs)
Dim objChartSpace, objChart, c, objSeries, objTrendline, Axis,
arrCatRst(5), arrValRst(5) As Object
Dim i As Integer
arrCatRst(0) = "1/1/03": arrValRst(0) = "100"
arrCatRst(1) = "1/2/03": arrValRst(1) = "150"
arrCatRst(2) = "1/3/03": arrValRst(2) = "125"
arrCatRst(3) = "1/5/03": arrValRst(3) = "175"
arrCatRst(4) = "1/6/03": arrValRst(4) = "200"
objChartSpace = Server.CreateObject("OWC11.ChartSpace")
objChart = objChartSpace.Charts.Add()
c = objChartSpace.Constants
objChart.SeriesCollection.Add
objChart.SetData ((c.chDimCategories), (c.chDataLiteral), arrCatRst)
objChart.SeriesCollection(0).SetData ((c.chDimValues), (c.chDataLiteral),
arrValRst)
objTrendline = objChart.SeriesCollection(0).Trendlines.Add
objTrendline.Type = c.chTrendlineTypeMovingAverage
objChart.Type = c.chChartTypeLineMarkers
Response.Expires = 0
Response.Buffer = true
Response.Clear
Response.ContentType = "image/gif"
Response.BinaryWrite (objChartSpace.GetPicture("gif", 800, 600))
Response.End
End Sub
</script>
Any ideas if there are workarounds for this annoyance besides altering my
data source to provide "last" values for dates that don't have one in the
real data?
Thanks,
Mike
the OWC.10 and OWC.11 versions of the chart. When you have "missing" dates
in your axis, the moving average trendline will calculate 0 for that
datapoint unlike in normal Excel. The chart renders the datapoints and line
correctly, but not the trendline.
Here is some sample code to demonstrate the problem - notice that my dataset
is missing a value for 1/4/03 which causes the problem.:
<%@ Page Language="vb" ASPCompat=True Debug=True %>
<script language="vbscript" runat="server">
Public Sub Page_Load(Sender as Object, e as EventArgs)
Dim objChartSpace, objChart, c, objSeries, objTrendline, Axis,
arrCatRst(5), arrValRst(5) As Object
Dim i As Integer
arrCatRst(0) = "1/1/03": arrValRst(0) = "100"
arrCatRst(1) = "1/2/03": arrValRst(1) = "150"
arrCatRst(2) = "1/3/03": arrValRst(2) = "125"
arrCatRst(3) = "1/5/03": arrValRst(3) = "175"
arrCatRst(4) = "1/6/03": arrValRst(4) = "200"
objChartSpace = Server.CreateObject("OWC11.ChartSpace")
objChart = objChartSpace.Charts.Add()
c = objChartSpace.Constants
objChart.SeriesCollection.Add
objChart.SetData ((c.chDimCategories), (c.chDataLiteral), arrCatRst)
objChart.SeriesCollection(0).SetData ((c.chDimValues), (c.chDataLiteral),
arrValRst)
objTrendline = objChart.SeriesCollection(0).Trendlines.Add
objTrendline.Type = c.chTrendlineTypeMovingAverage
objChart.Type = c.chChartTypeLineMarkers
Response.Expires = 0
Response.Buffer = true
Response.Clear
Response.ContentType = "image/gif"
Response.BinaryWrite (objChartSpace.GetPicture("gif", 800, 600))
Response.End
End Sub
</script>
Any ideas if there are workarounds for this annoyance besides altering my
data source to provide "last" values for dates that don't have one in the
real data?
Thanks,
Mike