I have several FastLines in a Chart, which data sources are datatables filled from a Database.
All of them are Timeseries with TreatNullsStyle = DoNotPaint and the X-Values order is set to Ascending.
When the User scrolls the Chart, I only fetch the yet not shown values into a new datatable and use the Series.Add-function.
That works fine when the added values are future to the last series-value.
But when adding a block of values before the first series-value, the TreatNull is ignored.
We bought the Source of Steema so we could have a look.
It seems to me, that when adding values before the first series-value the iColors-array of the series is not set as well. So the function ‘series.IsNull(int index)’ called in FastLine.ShouldDrawPoint returns the wrong result.
I made a little application to reproduce this issue as below.
I ran it in a form with one TeeChart, one Fastline and two buttons.
The Sub ‘AddAfter’ works as expected. The Sub ‘AddBefore’ causes the issue (when calling at least two times).
Is it possible to do something like that?
Thank you ,
Marco
Code: Select all
Imports System.Data.SqlClient
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Me.TChart1.ShowEditor()
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim s As Steema.TeeChart.Styles.FastLine
s = Me.TChart1.Series(0)
s.TreatNulls = Steema.TeeChart.Styles.TreatNullsStyle.DoNotPaint
s.XValues.Order = Steema.TeeChart.Styles.ValueListOrder.Ascending
FillData()
End Sub
Private Sub FillData()
Dim source As DataTable
Dim r As DataRow
source = New DataTable("data")
source.Columns.Add("xval", GetType(Double))
source.Columns.Add("yval", GetType(Double))
For i As Integer = 0 To 99
r = source.Rows.Add
r("xval") = i
r("yval") = i
Next
Dim s As Steema.TeeChart.Styles.FastLine
s = Me.TChart1.Series(0)
s.XValues.DataMember = "xval"
s.YValues.DataMember = "yval"
s.DataSource = source
s.CheckDataSource()
End Sub
Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
addBefore()
End Sub
Private Sub addBefore()
Static start As Integer = -200
Dim source As DataTable
Dim r As DataRow
source = New DataTable("data")
source.Columns.Add("xval", GetType(Double))
source.Columns.Add("yval", GetType(Object))
r = source.Rows.Add
r("xval") = start
r("yval") = System.DBNull.Value
For i As Integer = start To start + 99
r = source.Rows.Add
r("xval") = i
r("yval") = i
Next
Dim s As Steema.TeeChart.Styles.FastLine
s = Me.TChart1.Series(0)
s.Add(source)
start -= 200
End Sub
Private Sub addAfter()
Static start1 As Integer = 200
Dim source As DataTable
Dim r As DataRow
source = New DataTable("data")
source.Columns.Add("xval", GetType(Double))
source.Columns.Add("yval", GetType(Object))
r = source.Rows.Add
r("xval") = start1
r("yval") = System.DBNull.Value
For i As Integer = start1 To start1 + 99
r = source.Rows.Add
r("xval") = i
r("yval") = i
Next
Dim s As Steema.TeeChart.Styles.FastLine
s = Me.TChart1.Series(0)
s.Add(source)
start1 += 200
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
addAfter()
End Sub
End Class