FillRegion tool with sampled points
FillRegion tool with sampled points
I have a T-chart with FillRegion tool. How can make sure that the fill region uses only the data points that are fed to the series, and NOT the ones interpolated between the actual data points.
Thanks and best regards,
Thanks and best regards,
Re: FillRegion tool with sampled points
Hello asupriya,
I am not sure understand well as you want achieve, but I think would be very helpful for you, use SeriesBandTool instead of SeriesRegionTool as do in next code:
Can you tell us if previous code works as you expect?
Thanks,
I am not sure understand well as you want achieve, but I think would be very helpful for you, use SeriesBandTool instead of SeriesRegionTool as do in next code:
Code: Select all
public Form1()
{
InitializeComponent();
InitializeChart();
}
private Steema.TeeChart.Styles.Line line1,line2;
private Steema.TeeChart.Functions.Smoothing smoothing1;
private Steema.TeeChart.Tools.SeriesBandTool BandTool;
private void InitializeChart()
{
tChart1.Aspect.View3D = false;
line1 = new Line(tChart1.Chart);
line2 = new Line(tChart1.Chart);
smoothing1 = new Smoothing();
line1.Add(new int[] { 4, 9, 5, 7, 2, 12, 15 });
line1.Color = Color.YellowGreen;
line2.DataSource = line1;
line2.Function = smoothing1;
line2.Color = Color.BlueViolet;
//Smoothing
smoothing1.Factor = 4;
smoothing1.Period = 1;
smoothing1.Interpolate = true;
//ColorBand
BandTool = new SeriesBandTool(tChart1.Chart);
BandTool.Series = line2;
BandTool.Series2 = line1;
BandTool.Brush.Color = Color.Green;
BandTool.Brush.Transparency = 50;
}
Thanks,
Best Regards,
Sandra Pazos / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Re: FillRegion tool with sampled points
Series band tool is not the solution we are looking for. SeriesBand fills the whole chart area. What we need is the ability to fill-in the region covered by the fastline series such that the lines are drawn only with the help of actual data points added to fastline series.
For example, if the actual data added to fastline series has 12 points (x,y values) per cycle and if the system has a frequency of 60 cycles/sec, then there will be 720 points per second-worth of data. If we plot this data on a graph panel, we like to see only 12 lines (of FillRegion) between peak-peak of a waveform. Currently, we see that the number of lines drawn (of FillRegion) vary based on the width of graph panel. If we resize the graph panel to a width of 600 pixels, we see only two or three lines between the peaks, if the width is set to 1200 or so, the number of lines drawn changes arbitrarily.
My question is: how can i make sure that the number of lines drawn of FillRegion tool always correspond to the actual datapoints loaded with the series.
For example, if the actual data added to fastline series has 12 points (x,y values) per cycle and if the system has a frequency of 60 cycles/sec, then there will be 720 points per second-worth of data. If we plot this data on a graph panel, we like to see only 12 lines (of FillRegion) between peak-peak of a waveform. Currently, we see that the number of lines drawn (of FillRegion) vary based on the width of graph panel. If we resize the graph panel to a width of 600 pixels, we see only two or three lines between the peaks, if the width is set to 1200 or so, the number of lines drawn changes arbitrarily.
My question is: how can i make sure that the number of lines drawn of FillRegion tool always correspond to the actual datapoints loaded with the series.
Re: FillRegion tool with sampled points
Hello asupriya,
Thanks for information, but would be very helpful for us if you could arrange a simple example for us where we can reproduce your problem, because we can try to find a good solution for you.
Thanks,
Thanks for information, but would be very helpful for us if you could arrange a simple example for us where we can reproduce your problem, because we can try to find a good solution for you.
Thanks,
Best Regards,
Sandra Pazos / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Re: FillRegion tool with sampled points
Attached is the VS2008 project with its own input data. This input data is collected at 720 samples/second (with 12 samples per cycle and a frequency of 60 cycles/sec).
The attached screenshot below shows that there are too many vertical lines drawn for 12 actual points in a cycle. My question is, how can I make sure that the vertical lines in a cycle truly correspond to the data fed to the series?
Thanks for your help.
The attached screenshot below shows that there are too many vertical lines drawn for 12 actual points in a cycle. My question is, how can I make sure that the vertical lines in a cycle truly correspond to the data fed to the series?
Thanks for your help.
- Attachments
-
- SampleTeeCart.zip
- (301.53 KiB) Downloaded 532 times
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: FillRegion tool with sampled points
Hi asupriya,
Thanks for the info.
The vertical lines shown in your image are those corresponding to the SeriesRegionTool brush pattern you chose:
SeriesRegionTool.Brush inherits from System.Drawing.Brush and its Style property is a System.Drawing.Drawing2D.HatchStyle enum value.
Having that in mind, System.Drawing.Brush and System.Drawing.Drawing2D.HatchStyle knows nothing from SeriesRegiontool and TeeChart series. The only option I can think of to achieve what you request is using an Area series with visible area lines, for example:
Obviously, Area series lacks the DrawAllPoints functionality. In which case you should use the DownSampling function as in the All Features\Welcome !\Functions\Extended\Reducing number of points\DownSampling Additions example at the features demo, which is available at TeeChart's program group.
Thanks for the info.
The vertical lines shown in your image are those corresponding to the SeriesRegionTool brush pattern you chose:
Code: Select all
srgn.Brush.Style = System.Drawing.Drawing2D.HatchStyle.Vertical
Having that in mind, System.Drawing.Brush and System.Drawing.Drawing2D.HatchStyle knows nothing from SeriesRegiontool and TeeChart series. The only option I can think of to achieve what you request is using an Area series with visible area lines, for example:
Code: Select all
Private Sub DisplayBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DisplayBtn.Click
Try
'Dim sBandTool As New Steema.TeeChart.Tools.SeriesBandTool
'sBandTool.Series = FastLine1
'GraphChart.Tools.Add(sBandTool)
GraphChart.Aspect.View3D = False
GraphChart.Header.Text = "Graph"
GraphChart.Zoom.Direction = Steema.TeeChart.ZoomDirections.Horizontal
' FastLine1.Clear()
'FastLine1.DrawAllPoints = False
''FastLine1.DrawAllPointsStyle = Steema.TeeChart.Styles.DrawAllPointsStyle.MinMax
'FastLine1.TreatNulls = Steema.TeeChart.Styles.TreatNullsStyle.DoNotPaint
'FastLine1.LinePen.Width = 1
'FastLine1.LinePen.Style = Drawing2D.DashStyle.Solid
GraphChart.Series.RemoveAllSeries()
Dim Area1 As New Steema.TeeChart.Styles.Area
GraphChart.Series.Add(Area1)
Area1.TreatNulls = Steema.TeeChart.Styles.TreatNullsStyle.DoNotPaint
Area1.Color = Color.Transparent
Area1.UseOrigin = True
Area1.Origin = 0
Dim txtReader As New System.IO.StreamReader("..\..\input.txt")
Dim tmpStr As String()
While Not txtReader.EndOfStream
tmpStr = Split(txtReader.ReadLine, ",")
Area1.Add(CDbl(tmpStr(0)), CDbl(tmpStr(1)))
End While
txtReader.Close()
'add a series region tool
Dim srgn As New Steema.TeeChart.Tools.SeriesRegionTool
srgn.Series = Area1 'FastLine1
srgn.Active = True
srgn.UseOrigin = True
srgn.Brush.Style = System.Drawing.Drawing2D.HatchStyle.Vertical
'set brush transparency
srgn.Brush.Transparency = 100
'disabling pen
srgn.Pen.Visible = False
'set Foreground color
srgn.Brush.ForegroundColor = FastLine1.Color
'GraphChart.Tools.Add(srgn)
Catch ex As Exception
End Try
End Sub
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Re: FillRegion tool with sampled points
Narcis,
Area series is not a feasible solution for us. FastLine series itself is not fast enough for our data volumes and area series is out question.
One related question I have is that the issues posted herelong ago shows that the vertical lines are dependent on the series data. How is it so if the brush is not aware of the data source?
Thanks
Area series is not a feasible solution for us. FastLine series itself is not fast enough for our data volumes and area series is out question.
One related question I have is that the issues posted herelong ago shows that the vertical lines are dependent on the series data. How is it so if the brush is not aware of the data source?
Thanks
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: FillRegion tool with sampled points
Hi asupriya,
http://www.teechart.net/support/viewtopic.php?t=4309
http://www.teechart.net/support/viewtop ... f=4&t=6590
In that case the only solution I can think is that you create your custom series inheriting from FastLine series and overriding relevant drawing methods, eg.: DrawValue method. Please bear in mind that drawing more elements into a FastLine series you'll slow it down. To improve your project's performance I strongly recommend you to read the Real-time Charting article here. If that's not enough for your needs you may also consider using TeeChart.Direct2D.dll. Last but not least, you'll find custom series examples here:Area series is not a feasible solution for us. FastLine series itself is not fast enough for our data volumes and area series is out question.
http://www.teechart.net/support/viewtopic.php?t=4309
http://www.teechart.net/support/viewtop ... f=4&t=6590
This is an issue (TF02014468) with FastLine series when DrawAllPoints is set to false and SeriesRegionTool but there's no mention that tool's brush is linked to series data. As you can see in the screen-shots in the thread you pointed at, SeriesRegionTool draws more brush pattern lines there than points are in the series, the same issue discussed in this thread.One related question I have is that the issues posted here long ago shows that the vertical lines are dependent on the series data. How is it so if the brush is not aware of the data source?
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Re: FillRegion tool with sampled points
Hello,
You could run this code in the Chart's OnAfterDraw event, worth checking how it fairs in performance terms. You do not need the SeriesRegion Tool in the chart to obtain the vertical lines:
Regards,
Marc Meumann
You could run this code in the Chart's OnAfterDraw event, worth checking how it fairs in performance terms. You do not need the SeriesRegion Tool in the chart to obtain the vertical lines:
Code: Select all
private void tChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
{
if (tChart1[0].Count > 0)
for (int i = tChart1[0].FirstDisplayedIndex(); i <= tChart1[0].LastDisplayedIndex(); i++)
{
g.Line(tChart1[0].CalcXPosValue(tChart1[0].XValues[i]), tChart1[0].CalcYPosValue(tChart1[0].YValues[i]),
tChart1[0].CalcXPosValue(tChart1[0].XValues[i]), tChart1.Axes.Left.CalcYPosValue(0));
}
}
Marc Meumann
Steema Support