Cursor with multiple Y axis chart
Posted: Thu Jun 14, 2012 3:53 pm
Hi, I'm wondering if you experts can help here...
I have a TChart, on which I have multiple series, set to be on seperate Y axis. I want to be able to set up a cursor, so that I can measure the values of all series as I scroll in the X direction. I have managed to achieve the measurement bit, following the code in the examples. However I don't seem to be able to get the cursor to display accross all the axes, only the one associated with the series I specify. A simple example screen shot is below - it's missing the value getting bits, but it serves to demonstrate what I'm seeing.
Now, I've tried setting, rather than the cursor series, but it doesn't help.
The code for this is as follows:
I can assign cursors to each individual axis, and then write some code to keep all the X positions in sync, but that doesn't create a single continuous line accross all the plots, which is what I wanted to achieve. Any suggestions on how to do this?
As usual, TIA for the help...
Bernie
I have a TChart, on which I have multiple series, set to be on seperate Y axis. I want to be able to set up a cursor, so that I can measure the values of all series as I scroll in the X direction. I have managed to achieve the measurement bit, following the code in the examples. However I don't seem to be able to get the cursor to display accross all the axes, only the one associated with the series I specify. A simple example screen shot is below - it's missing the value getting bits, but it serves to demonstrate what I'm seeing.
Now, I've tried setting
Code: Select all
cursorTool1 = new CursorTool(tChart1.Chart);
The code for this is as follows:
Code: Select all
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
cursorTool1.FollowMouse = true;
cursorTool1.Style = CursorToolStyles.Vertical;
cursorTool1 = new CursorTool(tChart1.Chart);
foreach (Series s in tChart1.Series)
{
s.FillSampleValues(100);
}
Axis A1 = tChart1.Axes.Left;
Axis A2 = new Axis(tChart1.Chart);
Axis A3 = new Axis(tChart1.Chart);
A1.EndPosition = 30;
A2.StartPosition = 35;
A2.EndPosition = 65;
A3.StartPosition = 70;
A3.EndPosition = 100;
tChart1.Axes.Custom.Add(A1);
tChart1.Axes.Custom.Add(A2);
tChart1.Axes.Custom.Add(A3);
tChart1.Series[0].CustomVertAxis = A1;
tChart1.Series[1].CustomVertAxis = A2;
tChart1.Series[2].CustomVertAxis = A3;
}
}
partial class Form1
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
this.tChart1 = new Steema.TeeChart.TChart();
this.fastLine1 = new Steema.TeeChart.Styles.FastLine();
this.fastLine2 = new Steema.TeeChart.Styles.FastLine();
this.fastLine3 = new Steema.TeeChart.Styles.FastLine();
this.cursorTool1 = new Steema.TeeChart.Tools.CursorTool();
this.cursorTool2 = new Steema.TeeChart.Tools.CursorTool();
this.cursorTool3 = new Steema.TeeChart.Tools.CursorTool();
this.SuspendLayout();
//
// tChart1
//
//
//
//
this.tChart1.Aspect.View3D = false;
this.tChart1.Aspect.ZOffset = 0;
this.tChart1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tChart1.Location = new System.Drawing.Point(0, 0);
this.tChart1.Name = "tChart1";
this.tChart1.Series.Add(this.fastLine1);
this.tChart1.Series.Add(this.fastLine2);
this.tChart1.Series.Add(this.fastLine3);
this.tChart1.Size = new System.Drawing.Size(796, 365);
this.tChart1.TabIndex = 0;
this.tChart1.Tools.Add(this.cursorTool1);
this.tChart1.Tools.Add(this.cursorTool2);
this.tChart1.Tools.Add(this.cursorTool3);
//
// fastLine1
//
this.fastLine1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(102)))), ((int)(((byte)(163)))));
this.fastLine1.ColorEach = false;
//
//
//
this.fastLine1.LinePen.Color = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(102)))), ((int)(((byte)(163)))));
//
//
//
//
//
//
this.fastLine1.Marks.Callout.ArrowHead = Steema.TeeChart.Styles.ArrowHeadStyles.None;
this.fastLine1.Marks.Callout.ArrowHeadSize = 8;
//
//
//
this.fastLine1.Marks.Callout.Brush.Color = System.Drawing.Color.Black;
this.fastLine1.Marks.Callout.Distance = 0;
this.fastLine1.Marks.Callout.Draw3D = false;
this.fastLine1.Marks.Callout.Length = 10;
this.fastLine1.Marks.Callout.Style = Steema.TeeChart.Styles.PointerStyles.Rectangle;
this.fastLine1.Marks.Callout.Visible = false;
this.fastLine1.Title = "fastLine1";
this.fastLine1.TreatNulls = Steema.TeeChart.Styles.TreatNullsStyle.Ignore;
//
//
//
this.fastLine1.XValues.DataMember = "X";
this.fastLine1.XValues.Order = Steema.TeeChart.Styles.ValueListOrder.Ascending;
//
//
//
this.fastLine1.YValues.DataMember = "Y";
//
// fastLine2
//
this.fastLine2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(243)))), ((int)(((byte)(156)))), ((int)(((byte)(53)))));
this.fastLine2.ColorEach = false;
//
//
//
this.fastLine2.LinePen.Color = System.Drawing.Color.FromArgb(((int)(((byte)(243)))), ((int)(((byte)(156)))), ((int)(((byte)(53)))));
//
//
//
//
//
//
this.fastLine2.Marks.Callout.ArrowHead = Steema.TeeChart.Styles.ArrowHeadStyles.None;
this.fastLine2.Marks.Callout.ArrowHeadSize = 8;
//
//
//
this.fastLine2.Marks.Callout.Brush.Color = System.Drawing.Color.Black;
this.fastLine2.Marks.Callout.Distance = 0;
this.fastLine2.Marks.Callout.Draw3D = false;
this.fastLine2.Marks.Callout.Length = 10;
this.fastLine2.Marks.Callout.Style = Steema.TeeChart.Styles.PointerStyles.Rectangle;
this.fastLine2.Marks.Callout.Visible = false;
this.fastLine2.Title = "fastLine2";
this.fastLine2.TreatNulls = Steema.TeeChart.Styles.TreatNullsStyle.Ignore;
//
//
//
this.fastLine2.XValues.DataMember = "X";
this.fastLine2.XValues.Order = Steema.TeeChart.Styles.ValueListOrder.Ascending;
//
//
//
this.fastLine2.YValues.DataMember = "Y";
//
// fastLine3
//
this.fastLine3.Color = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(76)))), ((int)(((byte)(20)))));
this.fastLine3.ColorEach = false;
//
//
//
this.fastLine3.LinePen.Color = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(76)))), ((int)(((byte)(20)))));
//
//
//
//
//
//
this.fastLine3.Marks.Callout.ArrowHead = Steema.TeeChart.Styles.ArrowHeadStyles.None;
this.fastLine3.Marks.Callout.ArrowHeadSize = 8;
//
//
//
this.fastLine3.Marks.Callout.Brush.Color = System.Drawing.Color.Black;
this.fastLine3.Marks.Callout.Distance = 0;
this.fastLine3.Marks.Callout.Draw3D = false;
this.fastLine3.Marks.Callout.Length = 10;
this.fastLine3.Marks.Callout.Style = Steema.TeeChart.Styles.PointerStyles.Rectangle;
this.fastLine3.Marks.Callout.Visible = false;
this.fastLine3.Title = "fastLine3";
this.fastLine3.TreatNulls = Steema.TeeChart.Styles.TreatNullsStyle.Ignore;
//
//
//
this.fastLine3.XValues.DataMember = "X";
this.fastLine3.XValues.Order = Steema.TeeChart.Styles.ValueListOrder.Ascending;
//
//
//
this.fastLine3.YValues.DataMember = "Y";
//
// cursorTool1
//
this.cursorTool1.FollowMouse = true;
this.cursorTool1.Style = Steema.TeeChart.Tools.CursorToolStyles.Vertical;
this.cursorTool1.Change += new Steema.TeeChart.Tools.CursorChangeEventHandler(this.cursorToolX_Change);
//
// cursorTool2
//
this.cursorTool2.FollowMouse = true;
//
//
//
this.cursorTool2.Pen.Color = System.Drawing.Color.Black;
this.cursorTool2.Style = Steema.TeeChart.Tools.CursorToolStyles.Vertical;
//
// cursorTool3
//
this.cursorTool3.FollowMouse = true;
//
//
//
this.cursorTool3.Pen.Color = System.Drawing.Color.Black;
this.cursorTool3.Style = Steema.TeeChart.Tools.CursorToolStyles.Vertical;
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(796, 365);
this.Controls.Add(this.tChart1);
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false);
}
#endregion
private Steema.TeeChart.TChart tChart1;
private Steema.TeeChart.Styles.FastLine fastLine1;
private Steema.TeeChart.Styles.FastLine fastLine2;
private Steema.TeeChart.Styles.FastLine fastLine3;
private Steema.TeeChart.Tools.CursorTool cursorTool1;
private Steema.TeeChart.Tools.CursorTool cursorTool2;
private Steema.TeeChart.Tools.CursorTool cursorTool3;
}
}
As usual, TIA for the help...
Bernie