Page 1 of 1
Tee chart Series Visibility and downsampling questions
Posted: Wed Apr 15, 2009 5:40 pm
by 9640703
There are few things i will like to ask
1) I have a Teechart where in I draw Line chart. The user can configure the lines to be displayed using contextmenu selection. I made line visible or invisble by setting series.visible to true or false. This works fine.
There is a Grid in our application on change of selection of row i will clear the series & add new data to the series . The problem here is the scale of the chart does not change when new data is displayed . This problem wont happen when I use legend checkboxe to show & hide the lines instead of my contextmenu. Please let me know what really happens when we select unselect legend checkbox which is different then my doing it by setting series visible.
2) Axis label when its a big no say more than 5 digit number I am not able to see the complete number i just see 4 digits also the axis title is not displayed.
3) I was trying to use downsampling I add the data to a temporary series & then set it to the line by setting its datasource. I notice that the series is not displayed due to this.
Thanks
Posted: Thu Apr 16, 2009 8:29 am
by 10050769
Hello gs,
1) I have a Teechart where in I draw Line chart. The user can configure the lines to be displayed using contextmenu selection. I made line visible or invisble by setting series.visible to true or false. This works fine.
There is a Grid in our application on change of selection of row i will clear the series & add new data to the series . The problem here is the scale of the chart does not change when new data is displayed . This problem wont happen when I use legend checkboxe to show & hide the lines instead of my contextmenu. Please let me know what really happens when we select unselect legend checkbox which is different then my doing it by setting series visible.
2) Axis label when its a big no say more than 5 digit number I am not able to see the complete number i just see 4 digits also the axis title is not displayed.
For this two questions please, could you send us a simple example project we can run "as-is" to reproduce the problem here? You can either post your files at news://
www.steema.net/steema.public.attachments newsgroup or at our
upload page.
3) I was trying to use downsampling I add the data to a temporary series & then set it to the line by setting its datasource. I notice that the series is not displayed due to this.
I recomend use next code for example:
Please, check that this code works fine in your application.
Thanks,
Posted: Mon Apr 20, 2009 10:53 pm
by 9640703
Our app uses real time data and when I do a checkdatasource after adding all points in the parent series, i see the number of points in the series getting reduced but i see the series containing zeroth element as the average of all values rest all values are zero. This is not what i expected
I was thinking that if there are 50 points in the series & i say tolerance of 10 , the 10 points should be reduced by a 1 or 2 point with average of 10 points & there should be 5 points in the series but i dont see that
Also can you tell me what the function calculate in downsampling does & how it works.
Thanks
Tee chart Series Visibility and downsampling questions
Posted: Mon Apr 20, 2009 11:00 pm
by 9640703
In our app data is added realtime to the series. After adding data when I do checkdatasource i see the changed series has 0th elemnt as the average of all elements in the series & rest all elements are zeroes which i did not expected. I have set downsampling function as average.
I thought that if I have series with 50 points & set downsampling tolerance to 10. each set of 10 points will be replaced by average of those 10 elements & the new series will have 5 points. But i dont see this behavior. Can you pls explain whats the problem.
Also can you tell me what does the downsampling method calculate do.
Thanks,
Sachin
Posted: Tue Apr 21, 2009 9:13 am
by narcis
Hi Sachin,
Could you please arrange a simple example project we can run "as-is" to reproduce the problem here?
You can create a dataset at runtime as Christoper Ireland's example
here.
Files can be either posted at news://
www.steema.net/steema.public.attachments newsgroup or at our
upload page.
Thanks in advance.
downsampling issue
Posted: Tue Apr 21, 2009 8:40 pm
by 9640703
I have uploaded the example in desktop.zip. I have modified existing downsampling sample
private void btnAddPoints_Click(object sender, EventArgs e)
{
int count = int.Parse(txtDataPoints.Text);
points1.Clear();
points1.BeginUpdate();
System.Random r = new System.Random();
double tmp = r.NextDouble() * 10000;
DateTime d = new DateTime();
for (int t = 0; t < count; t++)
{
tmp += r.Next(100) - 49.5;
d = DateTime.Now;
d = d.AddMinutes(t);
points1.Add(d , tmp);
}
points1.EndUpdate();
downsampling1.Recalculate();
label1.Text = "Data points : " + points1.Count;
label4.Text = "Reduced data size :" + line1.Count;
}
on button click event I am adding the data to the series. instead of using int value for x axis I am using datetime. After running this code i see downsampling doesnt work properly the reduction of datapoints is less than the tolerance factor. Also just the zeroth point is having valid value rest all are zeroes.
Thanks,
Sachin
Posted: Wed Apr 22, 2009 11:34 am
by narcis
Hi Sachin,
You need to combine Tolerance with DisplayedPointCount here, for example:
Code: Select all
private void btnAddPoints_Click(object sender, EventArgs e)
{
int count = int.Parse(txtDataPoints.Text);
points1.XValues.DateTime = true;
points1.Clear();
points1.BeginUpdate();
System.Random r = new System.Random();
double tmp = r.NextDouble() * 10000;
DateTime d = new DateTime();
for (int t = 0; t < count; t++)
{
tmp += r.Next(100) - 49.5;
d = DateTime.Now;
d = d.AddMinutes(t);
points1.Add(d , tmp);
}
points1.EndUpdate();
downsampling1.DisplayedPointCount = Convert.ToInt32(downsampling1.Tolerance * 4);
downsampling1.Recalculate();
label1.Text = "Data points : " + points1.Count;
label4.Text = "Reduced data size :" + line1.Count;
}
The DisplayedPointCount specifies how many points the DownSampling function should paint and displays this number as a maximum number of points.
Note that the DisplayedPointCount has to be multiplied by 4 when the Method is set to DownSamplingMethod.Average. This is because the number of points in the group of points used to calculate the function varies according to the different Methods set.
downsampling issue
Posted: Wed Apr 22, 2009 7:01 pm
by 9640703
I dont see DisplayedPointCount in v2 . Is it available in new version. I there any other alternative way to do this
Thanks,
Sachin
Posted: Thu Apr 23, 2009 7:27 am
by narcis
Hi Sachin,
DisplayedPointCount is a new property in v3. In v3 DownSampling function was enhanced and I'm afraid it may not work with DateTime values in v3.
downsampling issue
Posted: Fri Apr 24, 2009 3:22 pm
by 9640703
when the datetime issue planned to fix?
Thanks,
Sachin
Posted: Fri Apr 24, 2009 3:24 pm
by narcis
Hi Sachin,
I'm afraid it may not work with DateTime values in v3.
Sorry, my fault. I meant it may not work in v2 but already works fine in v3.