Hello lilo,
Doesn't exist any property to allow remove /not remove duplicates. And at the moment, the correct way is treating duplicates manually. I recommend two options to treat duplicates:
First: In the moment to add values in your Series, where you can create an algorithm that control to treat duplicate, as do in next code:
Code: Select all
private Steema.TeeChart.Styles.Bar Series1;
private void InitializeChart()
{
tChart1.Aspect.View3D = false;
tChart1.Series.Add(Series1 = new Steema.TeeChart.Styles.Bar());
System.Data.DataSet data = GetData();
Series1.DataSource = data;
Series1.XValues.DataMember = "ID";
Series1.YValues.DataMember = "Y";
Series1.LabelMember = "Name";
double ValueX, ValueY;
ValueX = 0;
ValueY = 0;
for (int i = 0; i < Series1.Count; i++)
{
if (ValueX == Series1.XValues[i] && ValueY == Series1.YValues[i])
{
Series1.XValues.RemoveAt(i);
Series1.YValues.RemoveAt(i);
}
ValueX = Series1.XValues[i];
ValueY = Series1.YValues[i];
}
}
private System.Data.DataSet GetData()
{
System.Data.DataSet data = new System.Data.DataSet();
System.Data.DataTable table = new System.Data.DataTable("Customers");
table.Columns.Add("ID", typeof(int));
table.Columns.Add("Y", typeof(double));
table.Columns.Add("Name", typeof(string));
data.Tables.Add(table);
Random y = new Random();
double row4 = y.Next(100);
table.Rows.Add(1, y.Next(100), "Customer A");
table.Rows.Add(2, y.Next(100), "Customer B");
table.Rows.Add(3, y.Next(100), "Customer C");
// example of dubplicate rows.
table.Rows.Add(4, row4, "Customer D");
table.Rows.Add(4, row4, "Customer D");
return data;
}
Second: Removing duplicates before assign Data to DataSource of Series, so, treat the duplicates in the DataSource, as explain in next link:
http://dotnetguts.blogspot.com/2007/02/ ... -from.html
I think options are the best for you, but on the other hand, you need know that if you doesn't use calculate statistics about your series, you needn't treat duplicates, because the only diference you can find is that the point duplicate is repaints twice.
I hope will helps.
Thanks