Correcting line series

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
robotuner
Newbie
Newbie
Posts: 8
Joined: Mon Jul 17, 2006 12:00 am

Correcting line series

Post by robotuner » Wed Mar 07, 2007 2:01 am

Hi: I have line data that looks something like this:
x y
1.0075 9
1.0237 8
1.0398 7
1.0560 7
1.0721 7
1.0883 6
1.1044 6
1.1206 6
1.1367 4

I want TChart to draw the lines between the point in the order shown, however it draws it like this:

x y
1.0075 9
1.0237 8
1.0721 7 draw this first
1.0560 7 these in reverse order
1.0398 7 goess from this point to
1.1206 6 this point instead of what I want the data to do!
1.1044 6
1.0883 6
1.1367 4

How do I fix that?

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 » Wed Mar 07, 2007 8:27 am

Hi robotuner,

I can not reproduce the issue here using latest TeeChart for .NET v2 maintenance release available at the client area and populating line series in the order you mentioned:

Code: Select all

			line1.Add(1.0075, 9);
			line1.Add(1.0237, 8);
			line1.Add(1.0398, 7);
			line1.Add(1.0560, 7);
			line1.Add(1.0721, 7);
			line1.Add(1.0883, 6);
			line1.Add(1.1044, 6);
			line1.Add(1.1206, 6);
			line1.Add(1.1367, 4);
Which TeeChart version are you using? Are you adding data as in the code above? If not, could you please modify the code snippet so that we can reproduce the problem here?

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

robotuner
Newbie
Newbie
Posts: 8
Joined: Mon Jul 17, 2006 12:00 am

Code snippet

Post by robotuner » Wed Mar 07, 2007 3:15 pm

Thanks for your reply!!! Obviously the actual data is not as simple as I portrayed it, but hopefully with the snippet and the trace, you can reproduce it. I have also included a screen capture so that you can see what I am talking about (The red line upper left).
http://www.engenious.com/downloads/steema1.jpg
The following is the code snippet that defines the points. I have placed the trace to show you the values at the bottom

Code: Select all

public void ExceedenceSeries()
        {
            if (dsgnevts == null) return;
            if (matchFreq.Count == 0) return;
            Int32 pos = 0;
            try
            {
                tChart1.Series.Clear();
                Steema.TeeChart.Styles.Line preSeries = new Steema.TeeChart.Styles.Line(tChart1.Chart);
                preSeries.Title = String.Format("DSN {0}", targetdsn.SelectedItem);
                Steema.TeeChart.Styles.Line postSeries = new Steema.TeeChart.Styles.Line(tChart1.Chart);
                postSeries.Title = String.Format("DSN {0}", mitigatedsn.SelectedItem);
                //preSeries.Marks.Visible=true;
                preSeries.Pointer.Visible = true;
                preSeries.Pointer.Style = PointerStyles.Circle;

                postSeries.Pointer.Visible = true;
                postSeries.Pointer.Style = PointerStyles.Triangle;
                foreach (FreqPoint fp in matchFreq)
                {                    
                    if (fp.Precnt > 0) preSeries.Add(new PointF((float)Math.Log(fp.Precnt, Math.E), (float)fp.Flow));
                    Trace.WriteLine(String.Format("x: {0}   y:  {1}", (float)Math.Log(fp.Precnt, Math.E), (float)fp.Flow));
                    //else preSeries.Add(new PointF(0.0f, (float)fp.Flow));
                    if (fp.Postcnt > 0)
                    {
                        postSeries.Add(new PointF((float)Math.Log(fp.Postcnt, Math.E), (float)fp.Flow));
                    }
                    pos++;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(String.Format("position: {0}. {1}",pos,ex.Message));
            }
        }
TRACE Data:

line1.Add(12.40814,0)
line1.Add(11.04768,0.03130249)
line1.Add(10.60631,0.06260497)
line1.Add(10.24434,0.09390745)
line1.Add(9.902537,0.1252099)
line1.Add(9.581491,0.1565124)
line1.Add(9.269176,0.1878149)
line1.Add(8.975124,0.2191174)
line1.Add(8.683385,0.2504199)
line1.Add(8.407155,0.2817224)
line1.Add(8.148446,0.3130248)
line1.Add(8.006034,0.3291759)
line1.Add(7.878534,0.3453268)
line1.Add(7.733684,0.3614779)
line1.Add(7.590347,0.3776289)
line1.Add(7.440146,0.3937798)
line1.Add(7.302496,0.4099309)
line1.Add(7.164721,0.4260818)
line1.Add(7.021084,0.4422328)
line1.Add(6.859615,0.4583839)
line1.Add(6.716595,0.4745348)
line1.Add(6.568078,0.4906859)
line1.Add(6.423247,0.5068368)
line1.Add(6.244167,0.5229878)
line1.Add(6.073044,0.5391389)
line1.Add(5.918894,0.5552899)
line1.Add(5.771441,0.5714409)
line1.Add(5.641907,0.5875918)
line1.Add(5.455321,0.6037428)
line1.Add(5.327876,0.6198938)
line1.Add(5.159055,0.6360449)
line1.Add(5.056246,0.6521959)
line1.Add(4.905275,0.6683468)
line1.Add(4.762174,0.6844978)
line1.Add(4.65396,0.7006488)
line1.Add(4.488636,0.7167999)
line1.Add(4.29046,0.7329509)
line1.Add(4.060443,0.7491019)
line1.Add(3.871201,0.7652528)
line1.Add(3.7612,0.7814038)
line1.Add(3.688879,0.7975549)
line1.Add(3.637586,0.8137059)
line1.Add(3.496508,0.8298569)
line1.Add(3.367296,0.8460078)
line1.Add(3.295837,0.8621588)
line1.Add(3.135494,0.8783098)
line1.Add(2.995732,0.8944609)
line1.Add(2.944439,0.9106119)
line1.Add(2.833213,0.9267628)
line1.Add(2.639057,0.9429138)
line1.Add(2.564949,0.9590648)
line1.Add(2.484907,0.9752159)
line1.Add(2.302585,0.9913669)
line1.Add(2.197225,1.007518)
line1.Add(2.079442,1.023669)
line1.Add(1.94591,1.03982)
line1.Add(1.94591,1.055971)
line1.Add(1.94591,1.072122)
line1.Add(1.791759,1.088273)
line1.Add(1.791759,1.104424)
line1.Add(1.791759,1.120575)
line1.Add(1.386294,1.136726)
line1.Add(1.098612,1.152877)
line1.Add(1.098612,1.169028)
line1.Add(1.098612,1.185179)
line1.Add(1.098612,1.20133)
line1.Add(1.098612,1.217481)
line1.Add(1.098612,1.233632)
line1.Add(1.098612,1.249783)
line1.Add(1.098612,1.265934)
line1.Add(1.098612,1.282085)
line1.Add(1.098612,1.298236)
line1.Add(0.6931472,1.314387)
line1.Add(0.6931472,1.330538)
line1.Add(0.6931472,1.346689)
line1.Add(0.6931472,1.36284)
line1.Add(0.6931472,1.378991)
line1.Add(0.6931472,1.395142)
line1.Add(0.6931472,1.411293)
line1.Add(0.6931472,1.427444)
line1.Add(0.6931472,1.443595)
line1.Add(0.6931472,1.459746)
line1.Add(0.6931472,1.475897)
line1.Add(0.6931472,1.492048)
line1.Add(0.6931472,1.508199)
line1.Add(0.6931472,1.52435)
line1.Add(0.6931472,1.540501)
line1.Add(0.6931472,1.556652)
line1.Add(0.6931472,1.572803)
line1.Add(0.6931472,1.588954)
line1.Add(0.6931472,1.605105)
line1.Add(0.6931472,1.621256)
line1.Add(0.6931472,1.637407)
line1.Add(0.6931472,1.653558)
line1.Add(0.6931472,1.669709)
line1.Add(0.6931472,1.68586)
line1.Add(0.6931472,1.702011)
line1.Add(0.6931472,1.718162)
line1.Add(0.6931472,1.734313)
line1.Add(0.6931472,1.750464)
line1.Add(0.6931472,1.766615)
line1.Add(0.6931472,1.782766)
line1.Add(0.6931472,1.798917)
line1.Add(0.6931472,1.815068)
line1.Add(0.6931472,1.831219)
line1.Add(0.6931472,1.84737)
line1.Add(0.6931472,1.863521)
line1.Add(0,1.879672)
line1.Add(0,1.895823)
line1.Add(0,1.911974)
line1.Add(0,1.928125)

robotuner
Newbie
Newbie
Posts: 8
Joined: Mon Jul 17, 2006 12:00 am

version

Post by robotuner » Wed Mar 07, 2007 3:27 pm

Sorry, I am using the 2.0.2306.26232

do I need to uninstall this version before I install the latest version from your website.

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 Mar 07, 2007 3:29 pm

Hi robotuner,

Thanks for the information.

I could reproduce the issue here. I'm not sure what are you want to obtain but it may help you setting line1.XValues.Order = Steema.TeeChart.Styles.ValueListOrder.None; before populating series. As line series is designed to plot sequential data, its default value is ascending. Using your data trace would be like this:

Code: Select all

		private void Form1_Load(object sender, EventArgs e)
		{
			line1.Pointer.Visible = true;
			line1.Pointer.Style = Steema.TeeChart.Styles.PointerStyles.Circle;

			line1.XValues.Order = Steema.TeeChart.Styles.ValueListOrder.None;

			line1.Add(12.40814,0);
			line1.Add(11.04768,0.03130249);
			line1.Add(10.60631,0.06260497);
			line1.Add(10.24434,0.09390745);
			line1.Add(9.902537,0.1252099);
			line1.Add(9.581491,0.1565124);
			line1.Add(9.269176,0.1878149);
			line1.Add(8.975124,0.2191174);
			line1.Add(8.683385,0.2504199);
			line1.Add(8.407155,0.2817224);
			line1.Add(8.148446,0.3130248);
			line1.Add(8.006034,0.3291759);
			line1.Add(7.878534,0.3453268);
			line1.Add(7.733684,0.3614779);
			line1.Add(7.590347,0.3776289);
			line1.Add(7.440146,0.3937798);
			line1.Add(7.302496,0.4099309);
			line1.Add(7.164721,0.4260818);
			line1.Add(7.021084,0.4422328);
			line1.Add(6.859615,0.4583839);
			line1.Add(6.716595,0.4745348);
			line1.Add(6.568078,0.4906859);
			line1.Add(6.423247,0.5068368);
			line1.Add(6.244167,0.5229878);
			line1.Add(6.073044,0.5391389);
			line1.Add(5.918894,0.5552899);
			line1.Add(5.771441,0.5714409);
			line1.Add(5.641907,0.5875918);
			line1.Add(5.455321,0.6037428);
			line1.Add(5.327876,0.6198938);
			line1.Add(5.159055,0.6360449);
			line1.Add(5.056246,0.6521959);
			line1.Add(4.905275,0.6683468);
			line1.Add(4.762174,0.6844978);
			line1.Add(4.65396,0.7006488);
			line1.Add(4.488636,0.7167999);
			line1.Add(4.29046,0.7329509);
			line1.Add(4.060443,0.7491019);
			line1.Add(3.871201,0.7652528);
			line1.Add(3.7612,0.7814038);
			line1.Add(3.688879,0.7975549);
			line1.Add(3.637586,0.8137059);
			line1.Add(3.496508,0.8298569);
			line1.Add(3.367296,0.8460078);
			line1.Add(3.295837,0.8621588);
			line1.Add(3.135494,0.8783098);
			line1.Add(2.995732,0.8944609);
			line1.Add(2.944439,0.9106119);
			line1.Add(2.833213,0.9267628);
			line1.Add(2.639057,0.9429138);
			line1.Add(2.564949,0.9590648);
			line1.Add(2.484907,0.9752159);
			line1.Add(2.302585,0.9913669);
			line1.Add(2.197225,1.007518);
			line1.Add(2.079442,1.023669);
			line1.Add(1.94591,1.03982);
			line1.Add(1.94591,1.055971);
			line1.Add(1.94591,1.072122);
			line1.Add(1.791759,1.088273);
			line1.Add(1.791759,1.104424);
			line1.Add(1.791759,1.120575);
			line1.Add(1.386294,1.136726);
			line1.Add(1.098612,1.152877);
			line1.Add(1.098612,1.169028);
			line1.Add(1.098612,1.185179);
			line1.Add(1.098612,1.20133);
			line1.Add(1.098612,1.217481);
			line1.Add(1.098612,1.233632);
			line1.Add(1.098612,1.249783);
			line1.Add(1.098612,1.265934);
			line1.Add(1.098612,1.282085);
			line1.Add(1.098612,1.298236);
			line1.Add(0.6931472,1.314387);
			line1.Add(0.6931472,1.330538);
			line1.Add(0.6931472,1.346689);
			line1.Add(0.6931472,1.36284);
			line1.Add(0.6931472,1.378991);
			line1.Add(0.6931472,1.395142);
			line1.Add(0.6931472,1.411293);
			line1.Add(0.6931472,1.427444);
			line1.Add(0.6931472,1.443595);
			line1.Add(0.6931472,1.459746);
			line1.Add(0.6931472,1.475897);
			line1.Add(0.6931472,1.492048);
			line1.Add(0.6931472,1.508199);
			line1.Add(0.6931472,1.52435);
			line1.Add(0.6931472,1.540501);
			line1.Add(0.6931472,1.556652);
			line1.Add(0.6931472,1.572803);
			line1.Add(0.6931472,1.588954);
			line1.Add(0.6931472,1.605105);
			line1.Add(0.6931472,1.621256);
			line1.Add(0.6931472,1.637407);
			line1.Add(0.6931472,1.653558);
			line1.Add(0.6931472,1.669709);
			line1.Add(0.6931472,1.68586);
			line1.Add(0.6931472,1.702011);
			line1.Add(0.6931472,1.718162);
			line1.Add(0.6931472,1.734313);
			line1.Add(0.6931472,1.750464);
			line1.Add(0.6931472,1.766615);
			line1.Add(0.6931472,1.782766);
			line1.Add(0.6931472,1.798917);
			line1.Add(0.6931472,1.815068);
			line1.Add(0.6931472,1.831219);
			line1.Add(0.6931472,1.84737);
			line1.Add(0.6931472,1.863521);
			line1.Add(0,1.879672);
			line1.Add(0,1.895823);
			line1.Add(0,1.911974);
			line1.Add(0,1.928125);
		}
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

robotuner
Newbie
Newbie
Posts: 8
Joined: Mon Jul 17, 2006 12:00 am

That seems to do it

Post by robotuner » Wed Mar 07, 2007 5:01 pm

Thanks, the
Steema.TeeChart.Styles.ValueListOrder.None;
seems to have corrected the problem. I have another more general question. As you can see from the code snippet, I am actually plotting logs on the x-axis. Originally I was looking for a semi-log "graph paper" type plotting chart, but could not find one. Is there one? and if not, how would I make the grid spacing on the x-axis semi-log?

robotuner
Newbie
Newbie
Posts: 8
Joined: Mon Jul 17, 2006 12:00 am

Got It!

Post by robotuner » Wed Mar 07, 2007 9:11 pm

Thanks for your help. I found what I was looking for in the tutorials!

Post Reply