Draw All Points of FastLine series
Re: Draw All Points of FastLine series
Hello Rajesh,
I've tried this with v3. The smoothing is not as good, the smoothed curve frequency falls longer than the input data frequency for this dataset; v2012 is a definite improvement as it's able to smooth at the same frequency as the input data.
With TeeChart v2012 the example screenshot has been created by adding a smoothing function to the Chart, turning Interpolation off (interpolation creates a too large a virtual dataset in memory for this case because of the volume of data in the sample) and setting the FastLine as source for the function. The source may optionally be set to Active True (visible) or False and the smoothing factor adjusted according to preference (eg. 1 to 4). The Chart is 2D.
Regards,
Marc
I've tried this with v3. The smoothing is not as good, the smoothed curve frequency falls longer than the input data frequency for this dataset; v2012 is a definite improvement as it's able to smooth at the same frequency as the input data.
With TeeChart v2012 the example screenshot has been created by adding a smoothing function to the Chart, turning Interpolation off (interpolation creates a too large a virtual dataset in memory for this case because of the volume of data in the sample) and setting the FastLine as source for the function. The source may optionally be set to Active True (visible) or False and the smoothing factor adjusted according to preference (eg. 1 to 4). The Chart is 2D.
Regards,
Marc
Re: Draw All Points of FastLine series
Marc,
I am not having much luck with the evaluation version of V2012 with the example data set posted in this message. The code snippet as follows.
I am not having much luck with the evaluation version of V2012 with the example data set posted in this message. The code snippet as follows.
Code: Select all
Dim mySmoooth As New Steema.TeeChart.Functions.Smoothing(GraphChart.Chart)
mySmoooth.Interpolate = False
mySmoooth.Period = 1 ' 1 to 4 values didn't make any difference
Dim txtReader As New System.IO.StreamReader("..\..\input.txt")
Dim tmpStr As String()
While Not txtReader.EndOfStream
tmpStr = Split(txtReader.ReadLine, ",")
FastLine1.Add(CDbl(tmpStr(0)), CDbl(tmpStr(1)))
End While
txtReader.Close()
Dim fs2 As New Steema.TeeChart.Styles.FastLine
fs2.DataSource = FastLine1
FastLine1.Active = False
fs2.Function = mySmoooth
GraphChart.Series.Add(fs2)
Re: Draw All Points of FastLine series
Hi,
Your code sample works ok here with the latest version, I'll download the current evaluation version to see if there's any particular problem there. What symptoms are you seeing? An empty Chart, partial data? One Series or two in the Chart?
**I correct an earlier edit of this post, testing here, changing the mySmoooth.Period value should still make a difference with Interpolate at False.
Further update:
I have downloaded the latest evaluation build, 4.1.2012.05104. Results are the same as with previous tests made.
Regards,
Marc
Your code sample works ok here with the latest version, I'll download the current evaluation version to see if there's any particular problem there. What symptoms are you seeing? An empty Chart, partial data? One Series or two in the Chart?
**I correct an earlier edit of this post, testing here, changing the mySmoooth.Period value should still make a difference with Interpolate at False.
Further update:
I have downloaded the latest evaluation build, 4.1.2012.05104. Results are the same as with previous tests made.
Regards,
Marc
Re: Draw All Points of FastLine series
Marc, I am using evaluation 4.1.2012.02284 as it was lat installed while trying Fastline.DrawAllPointsStyle option. Do you advice retrying with latest eval version?
I am getting the screenshots as shown below. Display of both original and smoothed series. After some zoom Further zoom
I am getting the screenshots as shown below. Display of both original and smoothed series. After some zoom Further zoom
Re: Draw All Points of FastLine series
Hello,
That plot looks like an earlier version. I'm not sure if there was a recent change to this during 2012, I think not, but please use the latest build anyway just in case. Check too that the reference is correctly updated to the new teechart.dll, that your project isn't picking up an earlier version (and that an earlier assembly isn't in the GAC or set as AssemblyFolders), the screenshots do give the impression that an earlier version of TeeChart is being used.
Regards,
Marc
That plot looks like an earlier version. I'm not sure if there was a recent change to this during 2012, I think not, but please use the latest build anyway just in case. Check too that the reference is correctly updated to the new teechart.dll, that your project isn't picking up an earlier version (and that an earlier assembly isn't in the GAC or set as AssemblyFolders), the screenshots do give the impression that an earlier version of TeeChart is being used.
Regards,
Marc
Steema Support
Re: Draw All Points of FastLine series
Marc,
The 4.1.2012.5106 build in the current evaluation setup fixed the issue. Now, the curve fitting is smooth.
I will upgrade from V3 to this version soon in next couple of days.
Thanks,
Rajesh
The 4.1.2012.5106 build in the current evaluation setup fixed the issue. Now, the curve fitting is smooth.
I will upgrade from V3 to this version soon in next couple of days.
Thanks,
Rajesh
Re: Draw All Points of FastLine series
Marc,
We have upgraded to latest version of Teechart and are in the process of updating our project.
We noticed a problem with the smoothing solution you suggested while we are implementing it with our project. This solutions requires that there are two series for each data; one with raw data and the other with smoothed data. Maintaining multiple series for same data creates several issues as our graph displays have several user interactions supported. All such events and features are to be modified to work with smoothed series data. This will be a lot of work for development and testing teams. Also, given the amount of data, this solution creates much higher need for memory.
Is there a simpler solution you suggest that uses only one series, but applies smoothing to its data without requiring us to create another one?
Thanks
We have upgraded to latest version of Teechart and are in the process of updating our project.
We noticed a problem with the smoothing solution you suggested while we are implementing it with our project. This solutions requires that there are two series for each data; one with raw data and the other with smoothed data. Maintaining multiple series for same data creates several issues as our graph displays have several user interactions supported. All such events and features are to be modified to work with smoothed series data. This will be a lot of work for development and testing teams. Also, given the amount of data, this solution creates much higher need for memory.
Is there a simpler solution you suggest that uses only one series, but applies smoothing to its data without requiring us to create another one?
Thanks
Re: Draw All Points of FastLine series
Hello,
The smoothing function needs to create the points according to the input data so I can't suggest a way of completely avoiding the memory space that that incurs. However you could reduce the timeframe during which the whole memory space for the two data Series is used by removing the first Series from the Chart after the data has been populated to the smoothing Series.
eg.
The smoothed Series' data will remain visible if it is not refreshed (eg. Series.CheckDatasource would fail).
Alternatively you could run the process externally to the Chart. It is not necessary to add the FastLine Series to the Chart to process it. You could prepare the smoothed data at the server and then export the smoothed data as the data to be plotted at the clients.
Regards,
Marc
The smoothing function needs to create the points according to the input data so I can't suggest a way of completely avoiding the memory space that that incurs. However you could reduce the timeframe during which the whole memory space for the two data Series is used by removing the first Series from the Chart after the data has been populated to the smoothing Series.
eg.
Code: Select all
Dim fastSmooth As New Steema.TeeChart.Styles.FastLine(GraphChart.Chart)
Dim smoothingFunc As New Steema.TeeChart.Functions.Smoothing
smoothingFunc.Interpolate = False
fastSmooth.Title = "smoothed data"
fastSmooth.Function = smoothingFunc
fastSmooth.DataSource = FastLine1 'GraphChart(0)
GraphChart.Series.Add(fastSmooth)
GraphChart.Series.Remove(FastLine1)
Alternatively you could run the process externally to the Chart. It is not necessary to add the FastLine Series to the Chart to process it. You could prepare the smoothed data at the server and then export the smoothed data as the data to be plotted at the clients.
Regards,
Marc
Steema Support
Re: Draw All Points of FastLine series
Marc,
TChart object gets refreshed several times as our desktop Application lets users to interact with the graph display with many tools.
Thanks for the hint for "offline" processing. For a desktop app., how can i apply smoothing function "offline" and load only the smoothed data to the TChart. Is there is an easy way to generate a "smoothed data" for a desktop application?
Thanks,
TChart object gets refreshed several times as our desktop Application lets users to interact with the graph display with many tools.
Thanks for the hint for "offline" processing. For a desktop app., how can i apply smoothing function "offline" and load only the smoothed data to the TChart. Is there is an easy way to generate a "smoothed data" for a desktop application?
Thanks,
Re: Draw All Points of FastLine series
Hello,
To smooth the data offline fill/load the input FastLine to prepare the data (can be the same machine or different as you can save to file or stream - ie. for example, to a database BLOB field). You can optionally create a Chart to load the first Series (source), or not. You can add the smoothingFunction Series to a Chart to export the data.
Options:
1. Create your own save routine ..... step through the Series' valuelists with you own code and write the values to a stream to be saved to memory or as a file (you don't need to load either Series in a Chart if you run it this way).
eg. To Create/Save (there are several ways to saveSeries data - although this uses a simple step-through you could try binaryFormat save the whole X and Y Valuelists in two instructions, I didn't try that)
To load back into a Chart:
2. Use Chart data export .... If you wish to use TeeChart's own export features then the easiest way would be to do something like the following:
eg. Save as text
Use a TeeChart TextSource component to import the data. See Demo's "Welcome !\Components\Text Source" for usage information.
3. Export the entire Chart as a template file. This option saves the Chart with the smoothedData as a template (.ten) file. That saves all Chart setup characteristics, automatically therefore saving/setting the XValues marked as DateTime when imported, and the Chart Title, colours, etc.
Save:
Load:
Regards,
Marc
To smooth the data offline fill/load the input FastLine to prepare the data (can be the same machine or different as you can save to file or stream - ie. for example, to a database BLOB field). You can optionally create a Chart to load the first Series (source), or not. You can add the smoothingFunction Series to a Chart to export the data.
Options:
1. Create your own save routine ..... step through the Series' valuelists with you own code and write the values to a stream to be saved to memory or as a file (you don't need to load either Series in a Chart if you run it this way).
eg. To Create/Save (there are several ways to saveSeries data - although this uses a simple step-through you could try binaryFormat save the whole X and Y Valuelists in two instructions, I didn't try that)
Code: Select all
FastLine1.DrawAllPoints = True
FastLine1.LinePen.Width = 1
FastLine1.LinePen.Style = Drawing2D.DashStyle.Solid
FastLine1.XValues.DateTime = True
Dim txtReader As New System.IO.StreamReader("..\..\input.txt")
Dim tmpStr As String()
While Not txtReader.EndOfStream
tmpStr = Split(txtReader.ReadLine, ";")
FastLine1.Add(CDbl(tmpStr(0)), CDbl(tmpStr(1)))
End While
txtReader.Close()
Dim fastSmooth As New Steema.TeeChart.Styles.FastLine(GraphChart.Chart)
Dim smoothingFunc As New Steema.TeeChart.Functions.Smoothing
smoothingFunc.Interpolate = False
fastSmooth.Title = "smoothed data"
fastSmooth.Function = smoothingFunc
fastSmooth.DataSource = FastLine1 'GraphChart(0)
GraphChart.Series.Add(fastSmooth)
GraphChart.Series.Remove(FastLine1)
Dim i
Dim dataArray As System.Collections.ArrayList
Dim tmpPoint As Steema.TeeChart.Drawing.PointDouble
Dim binFormat As New System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
dataArray = New System.Collections.ArrayList
binFormat = New System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
Dim mySaveStream As System.IO.FileStream
mySaveStream = New System.IO.FileStream("c:\output\smoothData.dat", IO.FileMode.Create)
For i = 0 To fastSmooth.Count - 1
tmpPoint = New Steema.TeeChart.Drawing.PointDouble(fastSmooth.XValues(i), fastSmooth.YValues(i))
dataArray.Add(tmpPoint)
Next
binFormat.Serialize(mySaveStream, dataArray)
mySaveStream.Flush()
mySaveStream.Close()
Code: Select all
Dim i
Dim dataArray As System.Collections.ArrayList
Dim tmpPoint As Steema.TeeChart.Drawing.PointDouble
Dim binFormat As New System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
Dim newFastSmooth As Steema.TeeChart.Styles.FastLine
dataArray = New System.Collections.ArrayList
binFormat = New System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
Dim mySaveStream As System.IO.FileStream
mySaveStream = New System.IO.FileStream("c:\output\smoothData.dat", IO.FileMode.Open)
dataArray = binFormat.Deserialize(mySaveStream)
GraphChart.Series.Clear()
newFastSmooth = New Steema.TeeChart.Styles.FastLine()
For i = 0 To dataArray.Count - 1
tmpPoint = CType(dataArray(i), Steema.TeeChart.Drawing.PointDouble)
newFastSmooth.Add(tmpPoint.X, tmpPoint.Y)
Next
mySaveStream.Close()
GraphChart.Series.Add(newFastSmooth)
2. Use Chart data export .... If you wish to use TeeChart's own export features then the easiest way would be to do something like the following:
eg. Save as text
Code: Select all
GraphChart.Export.Data.Text.Save( /* to filename or memory stream */)
3. Export the entire Chart as a template file. This option saves the Chart with the smoothedData as a template (.ten) file. That saves all Chart setup characteristics, automatically therefore saving/setting the XValues marked as DateTime when imported, and the Chart Title, colours, etc.
Save:
Code: Select all
DraftChart.Export.Theme.Save( /* to filename or memory stream */)
Code: Select all
GraphChart.Import.Theme.Load( /* to filename or memory stream */)
Marc