Histogramfunction without DBNull

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
AIS
Newbie
Newbie
Posts: 70
Joined: Wed Jun 25, 2008 12:00 am

Histogramfunction without DBNull

Post by AIS » Thu Jun 26, 2008 6:50 am

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!

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Thu Jun 26, 2008 7:24 am

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!
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

AIS
Newbie
Newbie
Posts: 70
Joined: Wed Jun 25, 2008 12:00 am

Post by AIS » Thu Jun 26, 2008 10:09 am

Thanks for your quick response.

Unfortunatly i cant set the DefaultNullValue to DBNull.Value, because ist not an double?

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Thu Jun 26, 2008 10:22 am

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.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

AIS
Newbie
Newbie
Posts: 70
Joined: Wed Jun 25, 2008 12:00 am

Post by AIS » Thu Jun 26, 2008 11:48 am

I have created a little Project with my problem and uploaded it to your upload page. I hope there is a solution for it.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Fri Jun 27, 2008 10:19 am

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.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Fri Jun 27, 2008 11:41 am

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);
        }
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

AIS
Newbie
Newbie
Posts: 70
Joined: Wed Jun 25, 2008 12:00 am

Post by AIS » Fri Jun 27, 2008 11:55 am

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!

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Fri Apr 03, 2009 8:22 am

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;
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

AIS
Newbie
Newbie
Posts: 70
Joined: Wed Jun 25, 2008 12:00 am

Post by AIS » Mon Apr 06, 2009 6:07 am

Hi Narcís,

nice to hear that. I would implement it as far as i can :)

Thanks!

Post Reply