Spread out vertically

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Little Mike
Newbie
Newbie
Posts: 15
Joined: Tue Mar 09, 2004 5:00 am

Spread out vertically

Post by Little Mike » Fri Aug 05, 2016 1:37 pm

I am on Windows 10, using C# winforms.

I have a specialized application where I need a T-Chart component to display a line style chart with vertical scroll bar, and let the vertical axis and scaling spread out a bit and not jam all 1000 points into the little space that the component occupies on my form, for purposes of better precision and readability of the vertical axis scale which goes from 4000 to 6000. In other words, I want the resolution for the vertical scale to be programmable. How might I do that most easily? Thanks.

Little Mike
Newbie
Newbie
Posts: 15
Joined: Tue Mar 09, 2004 5:00 am

Re: Spread out vertically

Post by Little Mike » Fri Aug 05, 2016 10:03 pm

OK, the NOOB has figured out a few things, but not everything.

I have been able to spread out my chart vertically by using Paging options in the Editor. However, I have been unable to control, using the Editor, keeping the vertical scrolling from going past the vertical endpoints of the series.

It seems that scrolling and paging support in the vertical is something new that the T-Chart folks don't fully support with their editor, tools, and even in code. It's going to take some work to figure out all of the side-effects of changing properties and getting it all to work correctly.

Here's a screenshot of what I'm talking about attached. The data in the series goes vertically from values of 4950 to 5380. Note how the scrolling goes past the lower limit of the data in the series (I have inverted this axis to show increasing values downward).

I haven't figured out how to show the log bottom axis vertically in a grid from top to bottom of the chart, to include not just the decades, but also the values from 2 through 9. Any clues?

Can't just add a paging control. It wants to do horizontal.
Can't just add code to control the vertical without affecting other properties, have to be careful how to do it. Changing properties willy nilly has unpredictable effects on other properties, breaking the parts of the current formatting that work as desired.

Here's my code to control the component and load it with data:

private void loadTChart()
{
// Only POC

// Load the ArrayLists that have been processed
Array depthArray = mapTheDoubles.ToArray(typeof(double));
Array secondArray = secondCurve.ToArray(typeof(double));
fastLineSeries1.Clear();
fastLineSeries1.Add(secondArray, depthArray);
tChart1.Header.Lines = new string[] { "Second Curve: ILD" };
tChart1.Visible = true;
}


Here's what the properties settings are:

// tChart1
//
//
//
//
this.tChart1.Aspect.ColorPaletteIndex = 5;
this.tChart1.Aspect.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighSpeed;
this.tChart1.Aspect.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SystemDefault;
this.tChart1.Aspect.View3D = false;
//
//
//
this.tChart1.Axes.Automatic = true;
//
//
//
this.tChart1.Axes.Bottom.Automatic = false;
this.tChart1.Axes.Bottom.AutomaticMaximum = false;
this.tChart1.Axes.Bottom.AutomaticMinimum = false;
//
//
//
this.tChart1.Axes.Bottom.AxisPen.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
this.tChart1.Axes.Bottom.AxisPen.Width = 1;
//
//
//
this.tChart1.Axes.Bottom.Grid.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
this.tChart1.Axes.Bottom.Grid.Style = System.Drawing.Drawing2D.DashStyle.Solid;
//
//
//
//
//
//
this.tChart1.Axes.Bottom.Labels.Font.Name = "Times New Roman";
this.tChart1.Axes.Bottom.Labels.Font.Size = 10;
this.tChart1.Axes.Bottom.Labels.Font.SizeFloat = 10F;
this.tChart1.Axes.Bottom.Logarithmic = true;
this.tChart1.Axes.Bottom.Maximum = 2000D;
this.tChart1.Axes.Bottom.Minimum = 0.2D;
//
//
//
this.tChart1.Axes.Bottom.MinorTicks.Visible = false;
this.tChart1.Axes.Bottom.TickOnLabelsOnly = false;
//
//
//
this.tChart1.Axes.Bottom.Ticks.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
this.tChart1.Axes.Bottom.Ticks.Length = 2;
//
//
//
//
//
//
this.tChart1.Axes.Bottom.Title.Font.Name = "Times New Roman";
//
//
//
this.tChart1.Axes.Depth.Automatic = false;
this.tChart1.Axes.Depth.AutomaticMaximum = false;
this.tChart1.Axes.Depth.AutomaticMinimum = false;
//
//
//
this.tChart1.Axes.Depth.AxisPen.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
this.tChart1.Axes.Depth.AxisPen.Width = 1;
//
//
//
this.tChart1.Axes.Depth.Grid.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
this.tChart1.Axes.Depth.Grid.Style = System.Drawing.Drawing2D.DashStyle.Solid;
//
//
//
//
//
//
this.tChart1.Axes.Depth.Labels.Font.Name = "Times New Roman";
this.tChart1.Axes.Depth.Labels.Font.Size = 10;
this.tChart1.Axes.Depth.Labels.Font.SizeFloat = 10F;
this.tChart1.Axes.Depth.Maximum = 0.5D;
this.tChart1.Axes.Depth.Minimum = -0.5D;
//
//
//
this.tChart1.Axes.Depth.MinorTicks.Visible = false;
//
//
//
this.tChart1.Axes.Depth.Ticks.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
this.tChart1.Axes.Depth.Ticks.Length = 2;
//
//
//
//
//
//
this.tChart1.Axes.Depth.Title.Font.Name = "Times New Roman";
//
//
//
this.tChart1.Axes.DepthTop.Automatic = false;
this.tChart1.Axes.DepthTop.AutomaticMaximum = false;
this.tChart1.Axes.DepthTop.AutomaticMinimum = false;
//
//
//
this.tChart1.Axes.DepthTop.AxisPen.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
this.tChart1.Axes.DepthTop.AxisPen.Width = 1;
//
//
//
this.tChart1.Axes.DepthTop.Grid.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
this.tChart1.Axes.DepthTop.Grid.Style = System.Drawing.Drawing2D.DashStyle.Solid;
//
//
//
//
//
//
this.tChart1.Axes.DepthTop.Labels.Font.Name = "Times New Roman";
this.tChart1.Axes.DepthTop.Labels.Font.Size = 10;
this.tChart1.Axes.DepthTop.Labels.Font.SizeFloat = 10F;
this.tChart1.Axes.DepthTop.Maximum = 0.5D;
this.tChart1.Axes.DepthTop.Minimum = -0.5D;
//
//
//
this.tChart1.Axes.DepthTop.MinorTicks.Visible = false;
//
//
//
this.tChart1.Axes.DepthTop.Ticks.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
this.tChart1.Axes.DepthTop.Ticks.Length = 2;
//
//
//
//
//
//
this.tChart1.Axes.DepthTop.Title.Font.Name = "Times New Roman";
//
//
//
//
//
//
this.tChart1.Axes.Left.AxisPen.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
this.tChart1.Axes.Left.AxisPen.Width = 1;
//
//
//
this.tChart1.Axes.Left.Grid.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
this.tChart1.Axes.Left.Grid.Style = System.Drawing.Drawing2D.DashStyle.Solid;
this.tChart1.Axes.Left.Inverted = true;
//
//
//
//
//
//
this.tChart1.Axes.Left.Labels.Font.Name = "Times New Roman";
this.tChart1.Axes.Left.Labels.Font.Size = 10;
this.tChart1.Axes.Left.Labels.Font.SizeFloat = 10F;
//
//
//
this.tChart1.Axes.Left.MinorTicks.Visible = false;
this.tChart1.Axes.Left.TickOnLabelsOnly = false;
//
//
//
this.tChart1.Axes.Left.Ticks.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
this.tChart1.Axes.Left.Ticks.Length = 2;
//
//
//
//
//
//
this.tChart1.Axes.Left.Title.Font.Name = "Times New Roman";
//
//
//
this.tChart1.Axes.Right.Automatic = false;
this.tChart1.Axes.Right.AutomaticMaximum = false;
this.tChart1.Axes.Right.AutomaticMinimum = false;
//
//
//
this.tChart1.Axes.Right.AxisPen.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
this.tChart1.Axes.Right.AxisPen.Width = 1;
//
//
//
this.tChart1.Axes.Right.Grid.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
this.tChart1.Axes.Right.Grid.Style = System.Drawing.Drawing2D.DashStyle.Solid;
//
//
//
//
//
//
this.tChart1.Axes.Right.Labels.Font.Name = "Times New Roman";
this.tChart1.Axes.Right.Labels.Font.Size = 10;
this.tChart1.Axes.Right.Labels.Font.SizeFloat = 10F;
this.tChart1.Axes.Right.Maximum = 0D;
this.tChart1.Axes.Right.Minimum = 0D;
//
//
//
this.tChart1.Axes.Right.MinorTicks.Visible = false;
//
//
//
this.tChart1.Axes.Right.Ticks.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
this.tChart1.Axes.Right.Ticks.Length = 2;
//
//
//
//
//
//
this.tChart1.Axes.Right.Title.Font.Name = "Times New Roman";
this.tChart1.Axes.Right.Visible = false;
//
//
//
this.tChart1.Axes.Top.Automatic = false;
this.tChart1.Axes.Top.AutomaticMaximum = false;
this.tChart1.Axes.Top.AutomaticMinimum = false;
//
//
//
this.tChart1.Axes.Top.AxisPen.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
this.tChart1.Axes.Top.AxisPen.Width = 1;
//
//
//
this.tChart1.Axes.Top.Grid.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
this.tChart1.Axes.Top.Grid.Style = System.Drawing.Drawing2D.DashStyle.Solid;
//
//
//
//
//
//
this.tChart1.Axes.Top.Labels.Font.Name = "Times New Roman";
this.tChart1.Axes.Top.Labels.Font.Size = 10;
this.tChart1.Axes.Top.Labels.Font.SizeFloat = 10F;
this.tChart1.Axes.Top.Maximum = 0D;
this.tChart1.Axes.Top.Minimum = 0D;
//
//
//
this.tChart1.Axes.Top.MinorTicks.Visible = false;
//
//
//
this.tChart1.Axes.Top.Ticks.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
this.tChart1.Axes.Top.Ticks.Length = 2;
//
//
//
//
//
//
this.tChart1.Axes.Top.Title.Font.Name = "Times New Roman";
this.tChart1.CurrentTheme = Steema.TeeChart.ThemeType.Classic;
this.tChart1.Cursor = System.Windows.Forms.Cursors.Default;
this.tChart1.Dock = System.Windows.Forms.DockStyle.Fill;
//
//
//
//
//
//
//
//
//
this.tChart1.Header.Brush.Gradient.EndColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(0)))));
this.tChart1.Header.Brush.Gradient.MiddleColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
this.tChart1.Header.Brush.Gradient.SigmaFocus = 0F;
this.tChart1.Header.Brush.Gradient.SigmaScale = 0F;
this.tChart1.Header.Brush.Gradient.StartColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
//
//
//
//
//
//
this.tChart1.Header.Font.Brush.Color = System.Drawing.Color.Gray;
this.tChart1.Header.Font.Name = "Times New Roman";
this.tChart1.Header.Font.Size = 12;
this.tChart1.Header.Font.SizeFloat = 12F;
//
//
//
this.tChart1.Header.Pen.Visible = false;
//
//
//
this.tChart1.Header.Shadow.Height = 0;
this.tChart1.Header.Shadow.Width = 0;
//
//
//
//
//
//
//
//
//
this.tChart1.Legend.Brush.Gradient.EndColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(0)))));
this.tChart1.Legend.Brush.Gradient.MiddleColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
this.tChart1.Legend.Brush.Gradient.SigmaFocus = 0F;
this.tChart1.Legend.Brush.Gradient.SigmaScale = 0F;
this.tChart1.Legend.Brush.Gradient.StartColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
//
//
//
//
//
//
this.tChart1.Legend.Font.Brush.Color = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
this.tChart1.Legend.Font.Name = "Times New Roman";
this.tChart1.Legend.Font.Size = 9;
this.tChart1.Legend.Font.SizeFloat = 9F;
//
//
//
this.tChart1.Legend.Pen.Visible = false;
//
//
//
this.tChart1.Legend.Shadow.Height = 0;
this.tChart1.Legend.Shadow.Visible = false;
this.tChart1.Legend.Shadow.Width = 0;
//
//
//
this.tChart1.Legend.Symbol.DefaultPen = false;
//
//
//
this.tChart1.Legend.Symbol.Pen.Visible = false;
this.tChart1.Legend.Transparent = true;
this.tChart1.Legend.Visible = false;
this.tChart1.Location = new System.Drawing.Point(0, 0);
this.tChart1.Name = "tChart1";
//
//
//
this.tChart1.Page.AutoScale = true;
this.tChart1.Page.MaxPointsPerPage = 100;
//
//
//
//
//
//
this.tChart1.Panel.Bevel.Outer = Steema.TeeChart.Drawing.BevelStyles.None;
//
//
//
this.tChart1.Panel.Brush.Color = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
//
//
//
this.tChart1.Panel.Brush.Gradient.EndColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(0)))));
this.tChart1.Panel.Brush.Gradient.MiddleColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
this.tChart1.Panel.Brush.Gradient.SigmaFocus = 0F;
this.tChart1.Panel.Brush.Gradient.SigmaScale = 0F;
this.tChart1.Panel.Brush.Gradient.StartColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
this.tChart1.Panel.Brush.Gradient.UseMiddle = false;
this.tChart1.Panel.Brush.Gradient.Visible = false;
this.tChart1.Panel.Brush.ImageMode = Steema.TeeChart.Drawing.ImageMode.Normal;
this.tChart1.Panel.ImageMode = Steema.TeeChart.Drawing.ImageMode.Normal;
//
//
//
this.tChart1.Panning.Allow = Steema.TeeChart.ScrollModes.Vertical;
this.tChart1.Size = new System.Drawing.Size(687, 410);
this.tChart1.TabIndex = 0;
//
//
//
//
//
//
//
//
//
this.tChart1.Walls.Back.Brush.Color = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
//
//
//
this.tChart1.Walls.Back.Brush.Gradient.EndColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(0)))));
this.tChart1.Walls.Back.Brush.Gradient.MiddleColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
this.tChart1.Walls.Back.Brush.Gradient.SigmaFocus = 0F;
this.tChart1.Walls.Back.Brush.Gradient.SigmaScale = 0F;
this.tChart1.Walls.Back.Brush.Gradient.StartColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
this.tChart1.Walls.Back.Brush.Gradient.Visible = false;
this.tChart1.Walls.Back.Brush.Visible = false;
this.tChart1.Walls.Back.Transparent = true;
this.tChart1.Walls.Back.Visible = false;
//
//
//
//
//
//
//
//
//
this.tChart1.Walls.Bottom.Brush.Gradient.EndColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(0)))));
this.tChart1.Walls.Bottom.Brush.Gradient.MiddleColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
this.tChart1.Walls.Bottom.Brush.Gradient.SigmaFocus = 0F;
this.tChart1.Walls.Bottom.Brush.Gradient.SigmaScale = 0F;
this.tChart1.Walls.Bottom.Brush.Gradient.StartColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
//
//
//
//
//
//
this.tChart1.Walls.Left.Brush.Color = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
//
//
//
this.tChart1.Walls.Left.Brush.Gradient.EndColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(0)))));
this.tChart1.Walls.Left.Brush.Gradient.MiddleColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
this.tChart1.Walls.Left.Brush.Gradient.SigmaFocus = 0F;
this.tChart1.Walls.Left.Brush.Gradient.SigmaScale = 0F;
this.tChart1.Walls.Left.Brush.Gradient.StartColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
//
//
//
//
//
//
this.tChart1.Walls.Right.Brush.Color = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
//
//
//
this.tChart1.Walls.Right.Brush.Gradient.EndColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(0)))));
this.tChart1.Walls.Right.Brush.Gradient.MiddleColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
this.tChart1.Walls.Right.Brush.Gradient.SigmaFocus = 0F;
this.tChart1.Walls.Right.Brush.Gradient.SigmaScale = 0F;
this.tChart1.Walls.Right.Brush.Gradient.StartColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
//
//
//
this.tChart1.Zoom.Direction = Steema.TeeChart.ZoomDirections.None;
this.tChart1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.tChart1_MouseMove);
//
Attachments
T-Chart_MikeR.jpg
T-Chart_MikeR.jpg (142.34 KiB) Viewed 12384 times

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Spread out vertically

Post by Sandra » Mon Aug 08, 2016 2:47 pm

Hello Mike,

Thanks for the information.

I try to use the code you send me but it doesn't work for us. Could you please attach your complete project here because we can try to suggest a simple solution for you? Also, we need you attach your data if is possible.

Thanks in advance
Best Regards,
Sandra Pazos / 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

Little Mike
Newbie
Newbie
Posts: 15
Joined: Tue Mar 09, 2004 5:00 am

Re: Spread out vertically

Post by Little Mike » Fri Aug 19, 2016 7:30 pm

I sent the complete project files WITH the data file that is processed included in the zip. It was posted to my Dropbox and I sent you a link to download the project.

Yeray
Site Admin
Site Admin
Posts: 9587
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Spread out vertically

Post by Yeray » Mon Aug 22, 2016 7:46 am

Hello,
Little Mike wrote:I sent the complete project files WITH the data file that is processed included in the zip. It was posted to my Dropbox and I sent you a link to download the project.
I'm not sure where did you send that link. Could you please send it to "info at steema dot com" referencing this thread?
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Little Mike
Newbie
Newbie
Posts: 15
Joined: Tue Mar 09, 2004 5:00 am

Re: Spread out vertically

Post by Little Mike » Tue Aug 23, 2016 8:50 pm

Thanks, I was able to resolve my issues with vertical scrolling by banging around a bit with hints that Sandra gave me before she went on vacation break, about using the Scroll event.

Here is what I did:

private void Form1_Load(object sender, EventArgs e)
{
myVScrollBar.Dock = DockStyle.Right;
tChart1.Controls.Add(myVScrollBar);
myVScrollBar.Scroll += MyVScrollBar_Scroll;
tChart1.Zoom.Direction = Steema.TeeChart.ZoomDirections.None;
tChart1.Panning.Allow = Steema.TeeChart.ScrollModes.None;
}

These lines of code are necessary to disable the right mouse button from scrolling or paging, because the chart will not disable paging just manipulating the visible properties in the Visual Studio design view. Don't know why not. No time to figure it out. Here is my scrolling handler. I notice that when you click in the vertical scrollbar, the scroll event will trigger on BOTH mouse down AND mouse up. On mouse up, the position has not changed, but that needs to be detected and properly ignored or the logic will fail. My data series is stored in an ArrayList called mapTheDoubles. I convert it to an Array and feed it to the chart component.

private void MyVScrollBar_Scroll(object sender, ScrollEventArgs e)
{
// Handle mouse up which is bogus!
if (e.NewValue == e.OldValue) return;

bool bDirectionIsDown = e.NewValue > e.OldValue;

if (mapTheDoubles.Count > 0)
{
// Check initial state
if (yMin == 0.0)
{
yMin = (double)mapTheDoubles[0];
yMax = yMin + 50.0;
}

// Now perform the scroll
if (bDirectionIsDown)
{
yMin += 50.0;
yMax += 50.0;
}
else
{
yMin -= 50.0;
yMax -= 50.0;
}

// Final check on boundaries
if(yMin < (double)mapTheDoubles[0])
{
yMin = (double)mapTheDoubles[0];
yMax = yMin + 50.0;
}
if(yMax > (double)mapTheDoubles[mapTheDoubles.Count - 1])
{
yMax = (double)mapTheDoubles[mapTheDoubles.Count - 1];
yMin = yMax - 50.0;
}
tChart1.Axes.Left.SetMinMax(yMin, yMax);
}
}

There's more to be done about scaling the scrolling thumb size to work nicely with the series limits and size, but this was close enough as is. It works.

Thanks for your assistance and attention.

Post Reply