Line Up Data Points by Text Rather Than Order Added

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Walt
Newbie
Newbie
Posts: 35
Joined: Wed Aug 17, 2005 4:00 am
Location: San Jose, CA
Contact:

Line Up Data Points by Text Rather Than Order Added

Post by Walt » Tue Nov 27, 2007 10:48 pm

I'll use an example to illustrate the problem:

Suppose I have one bar series with the names of the months for the text and the number of days in the month as the Y value (Jan=31, Feb=28, etc.). Now I want to add a series that has "sparse" data. In other words, data only for certain months (e.g. Mar=5, Aug=8). I store this data in a database and I only have rows for months with data (I do not have rows with a month and a null value, nor do I want to generate these in the query or on the client).

I would like to be able to add "sparse" data points to the 2nd series and have the points automatically line up with the matching months in the 1st series (based on the text value). So, when I add "Mar" with a Y-value of 5 to the 2nd series, it would be next to the "Mar" bar in the first series (instead of being next to the first bar). (In my case, you can assume that no series contains duplicate text values.)

Unfortunately, I currently have to add "null" data points which means I have to determine the missing data points myself.

Ideally, even the first series could be "sparse" and values would be automatically ordered/inserted along the x-axis by the text value with optional custom sort/comparison algorithm (imagine months or Roman numerals for examples of non-alphabetic textual sorting).

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

Post by Narcís » Wed Nov 28, 2007 8:11 am

Hi Walt,

I'm afraid such sorting is not possible at the moment. However, I'd recommend you to use point series for the sparse data so that you don't need to add values. Also, before populating the series you can set their order to none:

Code: Select all

points1.XValues.Order = Steema.TeeChart.Styles.ValueListOrder.None;
Also, why don't you match bars and sparse data series by their x value?
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

Walt
Newbie
Newbie
Posts: 35
Joined: Wed Aug 17, 2005 4:00 am
Location: San Jose, CA
Contact:

Post by Walt » Wed Nov 28, 2007 8:36 pm

narcis wrote: Also, why don't you match bars and sparse data series by their x value?
I guess the point is that I want to use a string for the X value, not a double or DateTime value. (In my example, you could come up with a number for the month and use that as the X value, and this would work -- however, that is just an example and it is not always like this.)

It seems that in TeeChart, strings on an axis are not truly associated with their place on the axis but instead are just pulled down from the data point in the first series (other series might have completely different strings at the same place on the axis, but only the string from the first series will show).

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 Nov 29, 2007 11:29 am

Hi Walt,

In that case you need to make the calculation outside of TeeChart before adding the point in. A map, or HashTable or dictionary, of x values and the text. You could then do points.Add(GetXValueFromDictionary("Mar"), yvalue);. For different texts in same x values you could use something like GetXValueFromHashTable("Mar") where each value can be associated with any number of keys (the strings are the keys here).
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

Post Reply