Page 1 of 1
Histogramfunction without DBNull
Posted: Thu Jun 26, 2008 6:50 am
by 13049497
Hello,
i will show a histogramfunction within a histogramseries. Like your example i need an other series (sourceseries) whitch hold (show) the data and than put this series as datasource to the histogram. This way still calculate the rigth values and shows it.
My problem in that way is, that DBNull values are possible in my datatable (sourceseries) and this values are included in the histogramcalculation. The property TreatNulls.Skip in any series does not help, how i can eliminate this values without manipulation in my datatable?
thanks!
Posted: Thu Jun 26, 2008 7:24 am
by narcis
Hi AIS,
You could try doing as in the example I posted on
this thread. Then you could use the setting you want for TreatNulls property and also assign DBNull.Value to DefaultNullValue property.
Hope this helps!
Posted: Thu Jun 26, 2008 10:09 am
by 13049497
Thanks for your quick response.
Unfortunatly i cant set the DefaultNullValue to DBNull.Value, because ist not an double?
Posted: Thu Jun 26, 2008 10:22 am
by narcis
Hi AIS,
Could you please send us a simple example project we can run "as-is" to reproduce the problem here and let us know how you'd expect null values being treated in the series?
You can either post your files at news://
www.steema.net/steema.public.attachments newsgroup or at our
upload page.
Thanks in advance.
Posted: Thu Jun 26, 2008 11:48 am
by 13049497
I have created a little Project with my problem and uploaded it to your upload page. I hope there is a solution for it.
Posted: Fri Jun 27, 2008 10:19 am
by narcis
Hi AIS,
Thanks for the example project. I could reproduce the issue here and added it (TF02013173) to the defect list to be fixed for next releases. Unfortunatelly there's no workaround I can think of at the moment.
Posted: Fri Jun 27, 2008 11:41 am
by narcis
Hi AIS,
A workaround could be using a dummy series with no null values as a datasource for the function, for example:
Code: Select all
private void InitializeTChart()
{
FastLine dataLine = new FastLine();
Histogram histogram = new Histogram();
HistogramFunction histogramFunction = new HistogramFunction();
tChart1.Series.Clear();
// Configure dataLine
// dataLine.DefaultNullValue = ???
dataLine.TreatNulls = TreatNullsStyle.Skip; // skip DBNull values
dataLine.DrawAllPoints = false; // faster
//dataLine.Visible = false; // Line is not intressting, only for calculation needed
dataLine.XValues.Order = ValueListOrder.None; // TeeChart is faster (DataTable is presorted within DB select)
dataLine.XValues.DataMember = data.Columns[0].ColumnName; // Timestamp
dataLine.YValues.DataMember = data.Columns[1].ColumnName; // Measurement
dataLine.DataSource = data; // set Source
FastLine dummySeries = new FastLine();
for (int i = 0; i < dataLine.Count; i++)
{
if (dataLine.YValues[i] != dataLine.DefaultNullValue)
{
dummySeries.Add(dataLine.XValues[i],dataLine.YValues[i]);
}
}
// Configure histogram
histogram.Function = histogramFunction; // set Function
//histogram.DataSource = dataLine; // Source for calculation
histogram.DataSource = dummySeries; // Source for calculation
tChart1.Series.Add(histogram);
}
Posted: Fri Jun 27, 2008 11:55 am
by 13049497
Hello Narcís,
this workaround can be temporary work, but i think i go one data level higher to the sourcedatatable and try to delete such DBNull.Values. Unfortunatly its not a good way, because if there are a lot of Rows and Columns in my DataTable it slows my application down due to my dataconcept.
Nevertheless it works
Thanks!
Posted: Fri Apr 03, 2009 8:22 am
by narcis
Hi AIS,
We have added IncludeNulls property to HistogramFunction for handling such cases. By default it's true so to get what you are looking for you should add line below to your project.
Code: Select all
histogramFunction.IncludeNulls = false;
Posted: Mon Apr 06, 2009 6:07 am
by 13049497
Hi Narcís,
nice to hear that. I would implement it as far as i can
Thanks!