Page 1 of 2

Contour with Custom Pallette

Posted: Fri Nov 07, 2008 2:52 pm
by 13050364
Hello,

I can't seem to work out how to apply a custom colour pallette to a contour type series, can anyone help? :lol:


Thanks
Dave

Posted: Fri Nov 07, 2008 3:06 pm
by narcis
Hi Dave,

You can define a custom palette as in the example Marjan posted here.

Posted: Fri Nov 07, 2008 5:55 pm
by 13050364
Thats great thanks!

One more question, I wish to add a cursor tool to the contour, however it seems that because the vertical axis of the contour is the Z axis the cursor tool only provides one line.

How do I go about sorting this?

Thanks
Dave

Posted: Mon Nov 10, 2008 9:27 am
by narcis
Hi Dave,

I'm not able to reproduce the issue here using latest TeeChart for .NET v3 release available at the clien area (build 3.5.3225.32183/4/5) and code snippet below. Could you please modify the example so that we can reproduce the problem here and let us know the TeeChart version you are using?

Code: Select all

		public Form1()
		{
			InitializeComponent();
			InitializeChart();
		}

		private void InitializeChart()
		{
			Steema.TeeChart.Styles.Contour contour1 = new Steema.TeeChart.Styles.Contour(tChart1.Chart);
			contour1.FillSampleValues();

			Steema.TeeChart.Tools.CursorTool cursor1 = new Steema.TeeChart.Tools.CursorTool(tChart1.Chart);
			cursor1.Series = contour1;
			cursor1.FollowMouse = true;
		}
Thanks in advance.

Posted: Mon Nov 10, 2008 12:24 pm
by 13050364
I still seem to be having problems.

I've uploaded a demo project on the upload page called CursorProblem.zip.

The example shows two problems which are probably related.

1: Notice that on startup it sets the cursor position to 10,10

cursor1.XValue = 10;
cursor1.YValue = 10;

However you can see that one of the cursors stays at 0.

2: The text boxes show the cursor positions and you can see that the cursors Z position isnt changing.

Can you help?

Thanks in advance,
Dave

Posted: Mon Nov 10, 2008 12:43 pm
by 13050364
I would also like to use the FastCursor option, but how do I change what colour the cursor lines are?

Thanks again,
Dave

Posted: Mon Nov 10, 2008 2:32 pm
by narcis
Hi Dave,

Thanks for the example project.
1: Notice that on startup it sets the cursor position to 10,10

cursor1.XValue = 10;
cursor1.YValue = 10;

However you can see that one of the cursors stays at 0.
Yes, this is quite a strange known issue for which we haven't found a solution so far. You can solve this problem setting cursor's XValue again after setting YValue, for example:

Code: Select all

            cursor1.XValue = 10;
            cursor1.YValue = 10;
            cursor1.XValue = 10;
2: The text boxes show the cursor positions and you can see that the cursors Z position isnt changing.


This is because CursorTool is not designed for X,Y and Z series. However, I think implementing cursor's Change event like this:

void cursor1_Change(object sender,

Code: Select all

Steema.TeeChart.Tools.CursorChangeEventArgs e) {
            double diff;

            xTB.Text = contour1.XValues[cursor1.NearestPoint(Steema.TeeChart.Tools.CursorToolStyles.Both, out diff)].ToString();
						//zTB.Text = contour1.ZValues[cursor1.NearestPoint(Steema.TeeChart.Tools.CursorToolStyles.Both, out diff)].ToString();
						zTB.Text = contour1.ZValues[e.ValueIndex].ToString();
            yTB.Text = contour1.YValues[cursor1.NearestPoint(Steema.TeeChart.Tools.CursorToolStyles.Both, out diff)].ToString();					
        }
Should work fine but e.ValueIndex is always zero. I'll add this issue to the defect list to be investigated.
I would also like to use the FastCursor option, but how do I change what colour the cursor lines are?
You can do this:

Code: Select all

					cursor1.FastCursor = true;
					cursor1.Pen.Color = Color.Red;

Posted: Mon Nov 10, 2008 3:24 pm
by 13050364
Yup, I get a simmilar result using the e.ValueIndex code, the value is always 1.

Is there no way to get the cursor working at the moment on a contour?

If not how quickly can we expect a fix as being able to use it is a hard requirement of the project I am working on?

Posted: Mon Nov 10, 2008 3:46 pm
by 13050364
Also the colour changing on the fastCursor doesnt seem to work for me.

I have uploaded a new example called fullExample to show more fully what I am trying to do.

I am building a custom control with a contour and two other charts which will eventually display slices from the contour data at the cursor position.

The data is X - Time, Y - DeltaOD, Z - Wavelength.

I need to use the cursor to pick a paticular point on the contour and then display "slices" of the data in the side and bottom charts based on the cursor position.

So my two problems are the Z-axis cursor and the fast cursor option not letting me keep the cursor colour black.


Hope you can help! :lol:

Dave

Posted: Mon Nov 10, 2008 3:52 pm
by narcis
Hi Dave,
Is there no way to get the cursor working at the moment on a contour?
Not that I can think of at the moment.
If not how quickly can we expect a fix as being able to use it is a hard requirement of the project I am working on?
I'm not able to give you an estimate date at the present moment. I recommend you to be aware at this forum or subscribe to our RSS news feed for new release announcements and what's being fixed and implemented on them.

As a workaround you can try combining CursorTool and MouseMove event, for example:

Code: Select all

				void tChart1_MouseMove(object sender, MouseEventArgs e)
				{
					index = contour1.Clicked(e.X, e.Y);
					this.Text = index.ToString();
					
					if (index != -1)
					{
						zTB.Text = contour1.ZValues[index].ToString();
					}
				}

        void cursor1_Change(object sender, Steema.TeeChart.Tools.CursorChangeEventArgs e) {
            double diff;

            xTB.Text = contour1.XValues[cursor1.NearestPoint(Steema.TeeChart.Tools.CursorToolStyles.Both, out diff)].ToString();
						//zTB.Text = contour1.ZValues[cursor1.NearestPoint(Steema.TeeChart.Tools.CursorToolStyles.Both, out diff)].ToString();						
            yTB.Text = contour1.YValues[cursor1.NearestPoint(Steema.TeeChart.Tools.CursorToolStyles.Both, out diff)].ToString();					
        }

Posted: Mon Nov 10, 2008 4:27 pm
by 13050364
What about the cursor colour problem illustrated in the fullExample.zip file?

Posted: Mon Nov 10, 2008 4:55 pm
by narcis
Hi Dave,
What about the cursor colour problem illustrated in the fullExample.zip file?
Sorry, I missed that one.

This is because of your chart's background color. When set to FastCursor=true, CursorTool calculates its Pen color like this:

Code: Select all

          penXOR = -1 ^ Pen.Color.ToArgb();
And then it's plotted this way:

Code: Select all

          ControlPaint.DrawReversibleLine(start, end, Color.FromArgb(penXOR));
Therefore, in your particular chart it can not be black. You'll see a black cursor if you add 2 lines below in ContourMap's constructor just after the call to InitializeComponent.

Code: Select all

						mainChart.Clear();
						mainChart.Aspect.View3D = false;

Posted: Mon Nov 10, 2008 5:11 pm
by 13050364
Have you actually tried that code?

When I do all that happens is I loose any designtime changes to the chart (unsurprisingly) and in fact i dont see any cursor!

Posted: Mon Nov 10, 2008 5:16 pm
by 13050364
Update, in fact the cursor is there, its just offscreen somewhere as it appears when i enable follow mouse.

Posted: Tue Nov 11, 2008 8:54 am
by narcis
Hi Dave,

Yes, I tried that code. Ok, I may have been a little bit drastic :wink:.

In that case you can do something like this:

Code: Select all

						mainChart.Walls.Back.Gradient.Visible = false;
						mainChart.Walls.Back.Color = Color.LightGray;