I have a problem when i use large number of points in a chart. I got weird feeling when i use the panning property. I modify the Zoom_Pen class in the demo so that you will be able to reproduce the problem.
Do you have any idea that can solve my problem?
thanks in advance
Maryse
Code: Select all
using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
namespace Steema.TeeChart.Samples
{
public class Zoom_Pen : Samples.BaseForm
{
private Steema.TeeChart.Styles.FastLine fastLineSeries1;
//private Steema.TeeChart.Styles.FastLine fastLineSeries2;
//private Steema.TeeChart.Styles.FastLine fastLineSeries3;
//private Steema.TeeChart.Styles.FastLine fastLineSeries4;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Label label1;
private Steema.TeeChart.ButtonPen buttonPen1;
private Steema.TeeChart.Tools.GridBand gridBand1;
private System.ComponentModel.IContainer components = null;
public Zoom_Pen()
{
// This call is required by the Windows Form Designer.
InitializeComponent();
this.fastLineSeries1.FillSampleValues(100000);
//this.fastLineSeries2.FillSampleValues(50000);
//this.fastLineSeries3.FillSampleValues(50000);
//this.fastLineSeries4.FillSampleValues(50000);
this.tChart1.Zoom.Allow = false;
this.tChart1.Zoom.Pen.Color = Color.Lime;
this.tChart1.Zoom.Brush.Color = Color.Blue;
this.tChart1.Zoom.Pen.Width = 2;
this.tChart1.Zoom.Brush.Style = System.Drawing.Drawing2D.HatchStyle.Percent70;
this.tChart1.Panning.Allow = Steema.TeeChart.ScrollModes.Both;
this.tChart1.MouseDown += new MouseEventHandler(tChart1_MouseDown);
this.tChart1.MouseUp += new MouseEventHandler(tChart1_MouseUp);
// connect pen, brush to appropriate buttons
this.buttonPen1.Pen = this.tChart1.Zoom.Pen;
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region 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()
{
this.fastLineSeries1 = new Steema.TeeChart.Styles.FastLine();
this.button1 = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.buttonPen1 = new Steema.TeeChart.ButtonPen();
this.gridBand1 = new Steema.TeeChart.Tools.GridBand();
this.panel1.SuspendLayout();
this.SuspendLayout();
//
// textBox1
//
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(544, 68);
this.textBox1.Text = "When dragging a rectangle to zoom a Chart, Pen and Brush can be specified.\r\n\r\nExa" +
"mple: \r\ntChart1.Zoom.Pen.Color = Color.White ;\r\ntChart1.Zoom.Brush.Style = Syste" +
"m.Drawing.Drawing2D.HatchStyle.Percent70;\r\ntChart1.Zoom.Brush.Color = Color.Blue" +
";";
//
// panel1
//
this.panel1.Controls.Add(this.buttonPen1);
this.panel1.Controls.Add(this.label1);
this.panel1.Controls.Add(this.button1);
this.panel1.Location = new System.Drawing.Point(0, 68);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(544, 36);
//
// tChart1
//
//
// tChart1.Aspect
//
this.tChart1.Aspect.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
this.tChart1.Aspect.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;
//
// tChart1.Header
//
this.tChart1.Header.Lines = new string[] {
"Zoom brush & pen"};
this.tChart1.Location = new System.Drawing.Point(0, 104);
this.tChart1.Name = "tChart1";
//
// tChart1.Panel
//
//
// tChart1.Panel.Brush
//
this.tChart1.Panel.Brush.Color = System.Drawing.Color.FromArgb(((System.Byte)(254)), ((System.Byte)(255)), ((System.Byte)(255)), ((System.Byte)(255)));
this.tChart1.Series.Add(this.fastLineSeries1);
/*this.tChart1.Series.Add(this.fastLineSeries2);
this.tChart1.Series.Add(this.fastLineSeries3);
this.tChart1.Series.Add(this.fastLineSeries4);*/
this.tChart1.Size = new System.Drawing.Size(544, 228);
this.tChart1.Tools.Add(this.gridBand1);
//
// tChart1.Walls
//
//
// tChart1.Walls.Bottom
//
//
// tChart1.Walls.Bottom.Pen
//
this.tChart1.Walls.Bottom.Pen.Visible = false;
this.tChart1.Walls.Bottom.Size = 5;
//
// tChart1.Walls.Left
//
//
// tChart1.Walls.Left.Pen
//
this.tChart1.Walls.Left.Pen.Visible = false;
this.tChart1.Walls.Left.Size = 5;
//
// fastLineSeries1
//
//
// fastLineSeries1.LinePen
//
this.fastLineSeries1.LinePen.Color = System.Drawing.Color.Red;
//
// fastLineSeries1.Marks
//
//
// fastLineSeries1.Marks.Symbol
//
//
// fastLineSeries1.Marks.Symbol.Shadow
//
this.fastLineSeries1.Marks.Symbol.Shadow.Height = 1;
this.fastLineSeries1.Marks.Symbol.Shadow.Visible = true;
this.fastLineSeries1.Marks.Symbol.Shadow.Width = 1;
this.fastLineSeries1.Title = "fastLineSeries1";
//
// fastLineSeries1.XValues
//
this.fastLineSeries1.XValues.DataMember = "X";
this.fastLineSeries1.XValues.Order = Steema.TeeChart.Styles.ValueListOrder.Ascending;
//
// fastLineSeries1.YValues
//
this.fastLineSeries1.YValues.DataMember = "Y";
//
// button1
//
this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.button1.Location = new System.Drawing.Point(233, 5);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(87, 23);
this.button1.TabIndex = 0;
this.button1.Text = "Zoom &brush...";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.label1.Location = new System.Drawing.Point(7, 9);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(71, 15);
this.label1.TabIndex = 2;
this.label1.Text = "Drag to zoom";
this.label1.UseMnemonic = false;
//
// buttonPen1
//
this.buttonPen1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.buttonPen1.Location = new System.Drawing.Point(133, 5);
this.buttonPen1.Name = "buttonPen1";
this.buttonPen1.Size = new System.Drawing.Size(87, 23);
this.buttonPen1.TabIndex = 3;
this.buttonPen1.Text = "Zoom &pen...";
//
// gridBand1
//
this.gridBand1.Axis = this.tChart1.Axes.Left;
//
// gridBand1.Band1
//
this.gridBand1.Band1.Color = System.Drawing.Color.FromArgb(((System.Byte)(127)), ((System.Byte)(224)), ((System.Byte)(224)), ((System.Byte)(224)));
//
// gridBand1.Band2
//
this.gridBand1.Band2.Color = System.Drawing.Color.FromArgb(((System.Byte)(127)), ((System.Byte)(255)), ((System.Byte)(255)), ((System.Byte)(255)));
//
// Zoom_Pen
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(544, 332);
this.Name = "Zoom_Pen";
this.panel1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private void button1_Click(object sender, System.EventArgs e)
{
Steema.TeeChart.Editors.BrushEditor br = new Steema.TeeChart.Editors.BrushEditor(this.tChart1.Zoom.Brush);
try
{
br.ShowDialog();
}
finally
{
br.Dispose();
}
}
private void tChart1_MouseDown(object sender, MouseEventArgs e)
{
this.tChart1.Panning.Allow = Steema.TeeChart.ScrollModes.Both;
this.tChart1.Panning.Active = true;
tChart1.Panning.Activate(e.X,e.Y);
}
private void tChart1_MouseUp(object sender, MouseEventArgs e)
{
this.tChart1.Panning.Allow = Steema.TeeChart.ScrollModes.None;
this.tChart1.Panning.Active = false;
}
}
}