Page 1 of 1

Click Events on Series not firing

Posted: Thu Jun 11, 2009 4:54 pm
by 8120354
Hello all,

Our application was working perfectly using Steema Teechart for .NET 1.1. We've downloaded the evaluation version for .NET2.0 (Visual Studio 2005) and we're facing a strange problem :

The click events on teechart series are no more firing (they were with the previous version of Steema Teechart under Visual Studio 2003).


The code :

Code: Select all

Steema.TeeChart.Styles.Series mySerie = new Steema.TeeChart.Styles.Points;

// [Define Style Color etc ...]

mySerie.Active = true;
mySerie.Cursor = Cursors.Hand;
GraphChart.Series.Add(mySerie );

// Click event
mySerie.Click  += new System.Windows.Forms.MouseEventHandler(this.MyMethod_Click);

mySerie.Visible = true;

[...]

private void MyMethod_Click(object sender, System.Windows.Forms.MouseEventArgs e)
{
   [Some Code]
}

The "MyMethod_Click" is never called ... Any Idea ??

Thanks for help !

Re: Click Events on Series not firing

Posted: Fri Jun 12, 2009 2:34 pm
by yeray
Hi nico193,

I've tested it with your code simply adding some random points to the series and and the event seems to be fired correctly.
Could you please see if it works for you in a simple new application?

Code: Select all

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

        int n;

        private void InitializeChart()
        {
            tChart1.Aspect.View3D = false;

            Steema.TeeChart.Styles.Series mySerie = new Steema.TeeChart.Styles.Points();

            mySerie.FillSampleValues(25);

            mySerie.Active = true;
            mySerie.Cursor = Cursors.Hand;
            tChart1.Series.Add(mySerie);

            n = 0;

            // Click event
            mySerie.Click  += new System.Windows.Forms.MouseEventHandler(this.MyMethod_Click);

            mySerie.Visible = true;
        }

        private void MyMethod_Click(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            n += 1;
            tChart1.Header.Text = "Series clicked " + n.ToString() + " times";
        }

Re: Click Events on Series not firing

Posted: Thu Jun 18, 2009 7:58 am
by 8120354
Hello,
I've created a simple sample to reproduce the issue :

The Form1.designer.cs code :

Code: Select all

namespace SteemaTest
{
    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()
        {
            this.GraphChart = new Steema.TeeChart.TChart();
            this.SuspendLayout();
            // 
            // GraphChart
            // 
            // 
            // 
            // 
            this.GraphChart.Aspect.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighSpeed;
            this.GraphChart.Aspect.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SystemDefault;
            this.GraphChart.Aspect.View3D = false;
            this.GraphChart.Aspect.ZOffset = 0;
            // 
            // 
            // 
            // 
            // 
            // 
            // 
            // 
            // 
            this.GraphChart.Axes.Bottom.AxisPen.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
            // 
            // 
            // 
            this.GraphChart.Axes.Bottom.Grid.Color = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(128)))), ((int)(((byte)(128)))));
            this.GraphChart.Axes.Bottom.Grid.Style = System.Drawing.Drawing2D.DashStyle.Dot;
            // 
            // 
            // 
            this.GraphChart.Axes.Bottom.Labels.DateTimeFormat = "M/d/yyyy";
            // 
            // 
            // 
            this.GraphChart.Axes.Bottom.Labels.Font.Name = "Arial";
            this.GraphChart.Axes.Bottom.Labels.MultiLine = true;
            // 
            // 
            // 
            this.GraphChart.Axes.Bottom.Ticks.Length = 2;
            // 
            // 
            // 
            this.GraphChart.Axes.Bottom.TicksInner.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
            this.GraphChart.Axes.Bottom.TicksInner.Visible = true;
            // 
            // 
            // 
            // 
            // 
            // 
            this.GraphChart.Axes.Bottom.Title.Font.Name = "Arial";
            // 
            // 
            // 
            this.GraphChart.Axes.Depth.Automatic = false;
            this.GraphChart.Axes.Depth.AutomaticMaximum = false;
            this.GraphChart.Axes.Depth.AutomaticMinimum = false;
            // 
            // 
            // 
            this.GraphChart.Axes.Depth.AxisPen.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
            // 
            // 
            // 
            this.GraphChart.Axes.Depth.Grid.Color = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(128)))), ((int)(((byte)(128)))));
            this.GraphChart.Axes.Depth.Grid.Style = System.Drawing.Drawing2D.DashStyle.Dot;
            // 
            // 
            // 
            // 
            // 
            // 
            this.GraphChart.Axes.Depth.Labels.Font.Name = "Arial";
            this.GraphChart.Axes.Depth.Labels.ValueFormat = "#,##0.00;(#,##0.00)";
            this.GraphChart.Axes.Depth.Maximum = 0.5;
            this.GraphChart.Axes.Depth.Minimum = 0.5;
            // 
            // 
            // 
            this.GraphChart.Axes.Depth.Ticks.Length = 2;
            // 
            // 
            // 
            this.GraphChart.Axes.Depth.TicksInner.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
            this.GraphChart.Axes.Depth.TicksInner.Visible = true;
            // 
            // 
            // 
            // 
            // 
            // 
            this.GraphChart.Axes.Depth.Title.Font.Name = "Arial";
            // 
            // 
            // 
            // 
            // 
            // 
            this.GraphChart.Axes.DepthTop.AxisPen.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
            // 
            // 
            // 
            this.GraphChart.Axes.DepthTop.Grid.Color = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(128)))), ((int)(((byte)(128)))));
            this.GraphChart.Axes.DepthTop.Grid.Style = System.Drawing.Drawing2D.DashStyle.Dot;
            // 
            // 
            // 
            // 
            // 
            // 
            this.GraphChart.Axes.DepthTop.Labels.Font.Name = "Arial";
            // 
            // 
            // 
            this.GraphChart.Axes.DepthTop.Ticks.Length = 2;
            // 
            // 
            // 
            this.GraphChart.Axes.DepthTop.TicksInner.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
            this.GraphChart.Axes.DepthTop.TicksInner.Visible = true;
            // 
            // 
            // 
            // 
            // 
            // 
            this.GraphChart.Axes.DepthTop.Title.Font.Name = "Arial";
            // 
            // 
            // 
            this.GraphChart.Axes.Left.Automatic = false;
            this.GraphChart.Axes.Left.AutomaticMaximum = false;
            this.GraphChart.Axes.Left.AutomaticMinimum = false;
            // 
            // 
            // 
            this.GraphChart.Axes.Left.AxisPen.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
            // 
            // 
            // 
            this.GraphChart.Axes.Left.Grid.Color = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(128)))), ((int)(((byte)(128)))));
            this.GraphChart.Axes.Left.Grid.Style = System.Drawing.Drawing2D.DashStyle.Dot;
            // 
            // 
            // 
            // 
            // 
            // 
            this.GraphChart.Axes.Left.Labels.Font.Name = "Arial";
            this.GraphChart.Axes.Left.Labels.Separation = 5;
            this.GraphChart.Axes.Left.Labels.ValueFormat = "#,##0.00;(#,##0.00)";
            this.GraphChart.Axes.Left.Labels.Visible = false;
            this.GraphChart.Axes.Left.Maximum = 0;
            this.GraphChart.Axes.Left.Minimum = 0;
            this.GraphChart.Axes.Left.RelativePosition = 10;
            // 
            // 
            // 
            this.GraphChart.Axes.Left.Ticks.Length = 2;
            // 
            // 
            // 
            this.GraphChart.Axes.Left.TicksInner.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
            this.GraphChart.Axes.Left.TicksInner.Visible = true;
            // 
            // 
            // 
            // 
            // 
            // 
            this.GraphChart.Axes.Left.Title.Font.Name = "Arial";
            this.GraphChart.Axes.Left.Visible = false;
            // 
            // 
            // 
            this.GraphChart.Axes.Right.Automatic = false;
            this.GraphChart.Axes.Right.AutomaticMaximum = false;
            this.GraphChart.Axes.Right.AutomaticMinimum = false;
            // 
            // 
            // 
            this.GraphChart.Axes.Right.AxisPen.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
            // 
            // 
            // 
            this.GraphChart.Axes.Right.Grid.Color = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(128)))), ((int)(((byte)(128)))));
            this.GraphChart.Axes.Right.Grid.Style = System.Drawing.Drawing2D.DashStyle.Dot;
            // 
            // 
            // 
            // 
            // 
            // 
            this.GraphChart.Axes.Right.Labels.Font.Name = "Arial";
            this.GraphChart.Axes.Right.Maximum = 0;
            this.GraphChart.Axes.Right.Minimum = 0;
            // 
            // 
            // 
            this.GraphChart.Axes.Right.Ticks.Length = 2;
            // 
            // 
            // 
            this.GraphChart.Axes.Right.TicksInner.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
            this.GraphChart.Axes.Right.TicksInner.Visible = true;
            // 
            // 
            // 
            // 
            // 
            // 
            this.GraphChart.Axes.Right.Title.Font.Name = "Arial";
            this.GraphChart.Axes.Right.Visible = false;
            // 
            // 
            // 
            this.GraphChart.Axes.Top.Automatic = false;
            this.GraphChart.Axes.Top.AutomaticMaximum = false;
            this.GraphChart.Axes.Top.AutomaticMinimum = false;
            // 
            // 
            // 
            this.GraphChart.Axes.Top.AxisPen.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
            // 
            // 
            // 
            this.GraphChart.Axes.Top.Grid.Color = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(128)))), ((int)(((byte)(128)))));
            this.GraphChart.Axes.Top.Grid.Style = System.Drawing.Drawing2D.DashStyle.Dot;
            // 
            // 
            // 
            // 
            // 
            // 
            this.GraphChart.Axes.Top.Labels.Font.Name = "Arial";
            this.GraphChart.Axes.Top.Maximum = 0;
            this.GraphChart.Axes.Top.Minimum = 0;
            // 
            // 
            // 
            this.GraphChart.Axes.Top.Ticks.Length = 2;
            // 
            // 
            // 
            this.GraphChart.Axes.Top.TicksInner.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
            this.GraphChart.Axes.Top.TicksInner.Visible = true;
            // 
            // 
            // 
            // 
            // 
            // 
            this.GraphChart.Axes.Top.Title.Font.Name = "Arial";
            this.GraphChart.Axes.Top.Visible = false;
            this.GraphChart.Cursor = System.Windows.Forms.Cursors.Default;
            this.GraphChart.Dock = System.Windows.Forms.DockStyle.Fill;
            // 
            // 
            // 
            // 
            // 
            // 
            // 
            // 
            // 
            this.GraphChart.Header.Brush.Gradient.EndColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(0)))));
            this.GraphChart.Header.Brush.Gradient.MiddleColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
            this.GraphChart.Header.Brush.Gradient.SigmaFocus = 0F;
            this.GraphChart.Header.Brush.Gradient.SigmaScale = 0F;
            this.GraphChart.Header.Brush.Gradient.StartColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
            // 
            // 
            // 
            // 
            // 
            // 
            this.GraphChart.Header.Font.Brush.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(255)))));
            this.GraphChart.Header.Font.Name = "Arial";
            // 
            // 
            // 
            this.GraphChart.Header.Pen.Visible = false;
            this.GraphChart.Header.Visible = false;
            // 
            // 
            // 
            this.GraphChart.Legend.Alignment = Steema.TeeChart.LegendAlignments.Left;
            // 
            // 
            // 
            // 
            // 
            // 
            this.GraphChart.Legend.Brush.Gradient.EndColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(0)))));
            this.GraphChart.Legend.Brush.Gradient.MiddleColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
            this.GraphChart.Legend.Brush.Gradient.SigmaFocus = 0F;
            this.GraphChart.Legend.Brush.Gradient.SigmaScale = 0F;
            this.GraphChart.Legend.Brush.Gradient.StartColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
            // 
            // 
            // 
            this.GraphChart.Legend.DividingLines.Width = 7;
            // 
            // 
            // 
            this.GraphChart.Legend.Font.Name = "Arial";
            this.GraphChart.Legend.TextStyle = Steema.TeeChart.LegendTextStyles.XAndValue;
            this.GraphChart.Legend.Visible = false;
            this.GraphChart.Location = new System.Drawing.Point(0, 0);
            this.GraphChart.Name = "GraphChart";
            // 
            // 
            // 
            // 
            // 
            // 
            this.GraphChart.Panel.Brush.Color = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(240)))), ((int)(((byte)(240)))));
            // 
            // 
            // 
            this.GraphChart.Panel.Brush.Gradient.EndColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(0)))));
            this.GraphChart.Panel.Brush.Gradient.MiddleColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
            this.GraphChart.Panel.Brush.Gradient.SigmaFocus = 0F;
            this.GraphChart.Panel.Brush.Gradient.SigmaScale = 0F;
            this.GraphChart.Panel.Brush.Gradient.StartColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
            this.GraphChart.Panel.Brush.Gradient.UseMiddle = false;
            this.GraphChart.Panel.Brush.Gradient.Visible = false;
            this.GraphChart.Panel.Brush.Visible = false;
            this.GraphChart.Panel.MarginBottom = 6;
            this.GraphChart.Panel.MarginLeft = 10;
            this.GraphChart.Panel.MarginRight = 0;
            // 
            // 
            // 
            this.GraphChart.Printer.Resolution = 81;
            this.GraphChart.Size = new System.Drawing.Size(839, 509);
            this.GraphChart.TabIndex = 43;
            // 
            // 
            // 
            // 
            // 
            // 
            // 
            // 
            // 
            // 
            // 
            // 
            this.GraphChart.Walls.Back.Brush.Gradient.EndColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(0)))));
            this.GraphChart.Walls.Back.Brush.Gradient.MiddleColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
            this.GraphChart.Walls.Back.Brush.Gradient.SigmaFocus = 0F;
            this.GraphChart.Walls.Back.Brush.Gradient.SigmaScale = 0F;
            this.GraphChart.Walls.Back.Brush.Gradient.StartColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
            this.GraphChart.Walls.Back.Brush.Gradient.Visible = false;
            this.GraphChart.Walls.Back.Brush.Visible = false;
            this.GraphChart.Walls.Back.Transparent = true;
            // 
            // 
            // 
            // 
            // 
            // 
            // 
            // 
            // 
            this.GraphChart.Walls.Bottom.Brush.Gradient.EndColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(0)))));
            this.GraphChart.Walls.Bottom.Brush.Gradient.MiddleColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
            this.GraphChart.Walls.Bottom.Brush.Gradient.SigmaFocus = 0F;
            this.GraphChart.Walls.Bottom.Brush.Gradient.SigmaScale = 0F;
            this.GraphChart.Walls.Bottom.Brush.Gradient.StartColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
            // 
            // 
            // 
            // 
            // 
            // 
            // 
            // 
            // 
            this.GraphChart.Walls.Left.Brush.Gradient.EndColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(0)))));
            this.GraphChart.Walls.Left.Brush.Gradient.MiddleColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
            this.GraphChart.Walls.Left.Brush.Gradient.SigmaFocus = 0F;
            this.GraphChart.Walls.Left.Brush.Gradient.SigmaScale = 0F;
            this.GraphChart.Walls.Left.Brush.Gradient.StartColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
            // 
            // 
            // 
            // 
            // 
            // 
            this.GraphChart.Walls.Right.Brush.Color = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(192)))), ((int)(((byte)(192)))));
            // 
            // 
            // 
            this.GraphChart.Walls.Right.Brush.Gradient.EndColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(0)))));
            this.GraphChart.Walls.Right.Brush.Gradient.MiddleColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
            this.GraphChart.Walls.Right.Brush.Gradient.SigmaFocus = 0F;
            this.GraphChart.Walls.Right.Brush.Gradient.SigmaScale = 0F;
            this.GraphChart.Walls.Right.Brush.Gradient.StartColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
            this.GraphChart.UndoneZoom += new System.EventHandler(this.GraphChart_UndoneZoom);
            this.GraphChart.ClickBackground += new System.Windows.Forms.MouseEventHandler(this.GraphChart_ClickBackground);
            this.GraphChart.Zoomed += new System.EventHandler(this.GraphChart_Zoomed);
            // 
            // Form1
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(839, 509);
            this.Controls.Add(this.GraphChart);
            this.Name = "Form1";
            this.Text = "Form1";
            this.Load += new System.EventHandler(this.Form1_Load);
            this.ResumeLayout(false);

        }

        #endregion

        private Steema.TeeChart.TChart GraphChart;

    }
}


The Form1.cs code :

Code: Select all

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Globalization;

namespace SteemaTest
{
    public partial class Form1 : Form
    {




        private Steema.TeeChart.Axis myCustomAxisInGrams = new Steema.TeeChart.Axis();
        private Steema.TeeChart.Axis myCustomAxisInLiters = new Steema.TeeChart.Axis();
        private Steema.TeeChart.Styles.Series myEndOfCycleEventsSerie = null;

        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            CultureInfo theCurrentCulture = null;
		    DateTimeFormatInfo theCurrentDateTimeFormatInfo = null;
            theCurrentCulture = CultureInfo.CurrentCulture;
            theCurrentDateTimeFormatInfo = theCurrentCulture.DateTimeFormat;

            string dateTimeFormat = theCurrentDateTimeFormatInfo.ShortDatePattern + " " + theCurrentDateTimeFormatInfo.LongTimePattern;


            // Create custom vertical axes
            myCustomAxisInGrams.Horizontal = false;
            myCustomAxisInGrams.Automatic = true;
            myCustomAxisInGrams.Title.Text = "(Grams)";
            myCustomAxisInGrams.Title.Angle = 90;
            myCustomAxisInGrams.RelativePosition = 0;
            myCustomAxisInGrams.Visible = false;
            myCustomAxisInGrams.Labels.ValueFormat = "#,##0.00";

            myCustomAxisInLiters.Horizontal = false;
            myCustomAxisInLiters.Automatic = true;
            myCustomAxisInLiters.Title.Text = "(Liters)";
            myCustomAxisInLiters.Title.Angle = 90;
            myCustomAxisInLiters.RelativePosition = 0;
            myCustomAxisInLiters.Visible = false;
            myCustomAxisInLiters.Chart = GraphChart.Chart;
            myCustomAxisInLiters.Labels.ValueFormat = "#,##0.00";


            GraphChart.Axes.Custom.Add(myCustomAxisInGrams);
            GraphChart.Axes.Custom.Add(myCustomAxisInLiters);

            // Bottom axe
            this.GraphChart.Axes.Bottom.Labels.DateTimeFormat = dateTimeFormat;

            this.myEndOfCycleEventsSerie = CreateOneEventSerie("End of cycle events", Steema.TeeChart.Styles.PointerStyles.Circle, System.Drawing.Color.Green, System.Drawing.Color.Yellow, 3, 3);
            this.myEndOfCycleEventsSerie.Active = true;
            GraphChart.Series.Add(this.myEndOfCycleEventsSerie);

            // Click event
            this.myEndOfCycleEventsSerie.Click += new System.Windows.Forms.MouseEventHandler(this.EndOfCycleEventsSerie_Click);


            // Define some liters values

            this.myEndOfCycleEventsSerie.CustomVertAxis = myCustomAxisInLiters;

            myCustomAxisInLiters.Visible = true;
            myCustomAxisInLiters.AxisPen.Color = Color.Black;
            myCustomAxisInLiters.Labels.Font.Color = Color.Black;
            myCustomAxisInLiters.Title.Font.Color = Color.Black;


            // Add points

            this.myEndOfCycleEventsSerie.Add(DateTime.Now - TimeSpan.FromMinutes(3), 10.0);
            this.myEndOfCycleEventsSerie.Add(DateTime.Now - TimeSpan.FromMinutes(2), 10.0);
            this.myEndOfCycleEventsSerie.Add(DateTime.Now - TimeSpan.FromMinutes(1), 10.0);

            // Set the axe to automatic to true
            this.myCustomAxisInGrams.Automatic = true;
            this.myCustomAxisInGrams.AdjustMaxMin();

            this.myCustomAxisInLiters.Automatic = true;
            this.myCustomAxisInLiters.AdjustMaxMin();

            GraphChart.Refresh();

        }

        private void GraphChart_ClickBackground(object sender, MouseEventArgs e)
        {

        }

        private void GraphChart_UndoneZoom(object sender, EventArgs e)
        {
            // Set the axe to automatic to true
            this.myCustomAxisInGrams.Automatic = true;
            this.myCustomAxisInLiters.Automatic = true;

        }

        private void GraphChart_Zoomed(object sender, EventArgs e)
        {
                // Set min / max for both the custom axes.
                this.myCustomAxisInGrams.SetMinMax(this.myCustomAxisInGrams.CalcPosPoint(GraphChart.Zoom.y1), this.myCustomAxisInGrams.CalcPosPoint(GraphChart.Zoom.y0));
                this.myCustomAxisInLiters.SetMinMax(this.myCustomAxisInLiters.CalcPosPoint(GraphChart.Zoom.y1), this.myCustomAxisInLiters.CalcPosPoint(GraphChart.Zoom.y0));

        }

        private Steema.TeeChart.Styles.Series CreateOneEventSerie(string myTitle, Steema.TeeChart.Styles.PointerStyles myPointerStyle, System.Drawing.Color myPointerColor, System.Drawing.Color myPenColor, int vertSize, int horizSize)
        {
            Steema.TeeChart.Styles.Points mySerie = new Steema.TeeChart.Styles.Points();
            mySerie.Title = myTitle;

            mySerie.Pointer.Style = myPointerStyle;
            mySerie.Pointer.Color = myPointerColor;
            mySerie.Pointer.VertSize = vertSize;
            mySerie.Pointer.HorizSize = horizSize;

            if (myPenColor != System.Drawing.Color.Empty)
            {
                mySerie.Pointer.Pen.Width = 2;
                mySerie.Pointer.Pen.Color = myPenColor;
                mySerie.Pointer.Pen.Visible = true;
            }

            // Set series type
            mySerie.XValues.DateTime = true;
            mySerie.YValues.DateTime = false;

            // Not visible by default
            mySerie.Visible = false;

            // Set the cursors on events
            mySerie.Cursor = Cursors.Hand;

            // Return serie
            return mySerie;
        }

        private void EndOfCycleEventsSerie_Click(object sender, System.Windows.Forms.MouseEventArgs e)
        {

        }
    }
}

Re: Click Events on Series not firing

Posted: Thu Jun 18, 2009 10:07 am
by 10050769
Hello nico193,

We couldn't reproduce your issue with last version of TeeChartFor .Net (version 4) and this is the latest evaluation version available. Please could you say exactly with is your TeeChartFor .Net version use?

Also, in your code I have added lines in the Event Click, for checked that works. Please add this lines and check that works fine in your application:

Code: Select all

    public partial class Form1 : Form
    {

        private Steema.TeeChart.Axis myCustomAxisInGrams = new Steema.TeeChart.Axis();
        private Steema.TeeChart.Axis myCustomAxisInLiters = new Steema.TeeChart.Axis();
        private Steema.TeeChart.Styles.Series myEndOfCycleEventsSerie = null;
        int n;//<---int that use in click event.
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            CultureInfo theCurrentCulture = null;
            DateTimeFormatInfo theCurrentDateTimeFormatInfo = null;
            theCurrentCulture = CultureInfo.CurrentCulture;
            theCurrentDateTimeFormatInfo = theCurrentCulture.DateTimeFormat;

            string dateTimeFormat = theCurrentDateTimeFormatInfo.ShortDatePattern + " " + theCurrentDateTimeFormatInfo.LongTimePattern;


            // Create custom vertical axes
            myCustomAxisInGrams.Horizontal = false;
            myCustomAxisInGrams.Automatic = true;
            myCustomAxisInGrams.Title.Text = "(Grams)";
            myCustomAxisInGrams.Title.Angle = 90;
            myCustomAxisInGrams.RelativePosition = 0;
            myCustomAxisInGrams.Visible = false;
            myCustomAxisInGrams.Labels.ValueFormat = "#,##0.00";

            myCustomAxisInLiters.Horizontal = false;
            myCustomAxisInLiters.Automatic = true;
            myCustomAxisInLiters.Title.Text = "(Liters)";
            myCustomAxisInLiters.Title.Angle = 90;
            myCustomAxisInLiters.RelativePosition = 0;
            myCustomAxisInLiters.Visible = false;
            myCustomAxisInLiters.Chart = GraphChart.Chart;
            myCustomAxisInLiters.Labels.ValueFormat = "#,##0.00";


            GraphChart.Axes.Custom.Add(myCustomAxisInGrams);
            GraphChart.Axes.Custom.Add(myCustomAxisInLiters);

            // Bottom axe
            this.GraphChart.Axes.Bottom.Labels.DateTimeFormat = dateTimeFormat;

            this.myEndOfCycleEventsSerie = CreateOneEventSerie("End of cycle events", Steema.TeeChart.Styles.PointerStyles.Circle, System.Drawing.Color.Green, System.Drawing.Color.Yellow, 3, 3);
            this.myEndOfCycleEventsSerie.Active = true;
            GraphChart.Series.Add(this.myEndOfCycleEventsSerie);

            // Click event
            n = 0;//<--- This lines initialize int and is used in Click event;
            this.myEndOfCycleEventsSerie.Click += new System.Windows.Forms.MouseEventHandler(this.EndOfCycleEventsSerie_Click);


            // Define some liters values

            this.myEndOfCycleEventsSerie.CustomVertAxis = myCustomAxisInLiters;

            myCustomAxisInLiters.Visible = true;
            myCustomAxisInLiters.AxisPen.Color = Color.Black;
            myCustomAxisInLiters.Labels.Font.Color = Color.Black;
            myCustomAxisInLiters.Title.Font.Color = Color.Black;


            // Add points

            this.myEndOfCycleEventsSerie.Add(DateTime.Now - TimeSpan.FromMinutes(3), 10.0);
            this.myEndOfCycleEventsSerie.Add(DateTime.Now - TimeSpan.FromMinutes(2), 10.0);
            this.myEndOfCycleEventsSerie.Add(DateTime.Now - TimeSpan.FromMinutes(1), 10.0);

            // Set the axe to automatic to true
            this.myCustomAxisInGrams.Automatic = true;
            this.myCustomAxisInGrams.AdjustMaxMin();

            this.myCustomAxisInLiters.Automatic = true;
            this.myCustomAxisInLiters.AdjustMaxMin();

            GraphChart.Refresh();

        }

        private void GraphChart_ClickBackground(object sender, MouseEventArgs e)
        {

        }

        private void GraphChart_UndoneZoom(object sender, EventArgs e)
        {
            // Set the axe to automatic to true
            this.myCustomAxisInGrams.Automatic = true;
            this.myCustomAxisInLiters.Automatic = true;

        }

        private void GraphChart_Zoomed(object sender, EventArgs e)
        {
            // Set min / max for both the custom axes.
            this.myCustomAxisInGrams.SetMinMax(this.myCustomAxisInGrams.CalcPosPoint(GraphChart.Zoom.y1), this.myCustomAxisInGrams.CalcPosPoint(GraphChart.Zoom.y0));
            this.myCustomAxisInLiters.SetMinMax(this.myCustomAxisInLiters.CalcPosPoint(GraphChart.Zoom.y1), this.myCustomAxisInLiters.CalcPosPoint(GraphChart.Zoom.y0));

        }

        private Steema.TeeChart.Styles.Series CreateOneEventSerie(string myTitle, Steema.TeeChart.Styles.PointerStyles myPointerStyle, System.Drawing.Color myPointerColor, System.Drawing.Color myPenColor, int vertSize, int horizSize)
        {
            Steema.TeeChart.Styles.Points mySerie = new Steema.TeeChart.Styles.Points();
            mySerie.Title = myTitle;

            mySerie.Pointer.Style = myPointerStyle;
            mySerie.Pointer.Color = myPointerColor;
            mySerie.Pointer.VertSize = vertSize;
            mySerie.Pointer.HorizSize = horizSize;

            if (myPenColor != System.Drawing.Color.Empty)
            {
                mySerie.Pointer.Pen.Width = 2;
                mySerie.Pointer.Pen.Color = myPenColor;
                mySerie.Pointer.Pen.Visible = true;
            }

            // Set series type
            mySerie.XValues.DateTime = true;
            mySerie.YValues.DateTime = false;

            // Not visible by default
            mySerie.Visible = false;

            // Set the cursors on events
            mySerie.Cursor = Cursors.Hand;

            // Return serie
            return mySerie;
        }

        private void EndOfCycleEventsSerie_Click(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            //Add this code for check that the click event works
           n += 1;
            GraphChart.Header.Visible = true;
            GraphChart.Header.Text = "Series clicked " + n.ToString() + " times";
        }
    }
Thanks,

Re: Click Events on Series not firing

Posted: Thu Jun 18, 2009 12:38 pm
by 8120354
Thanks for replying.

I've put a breakpoint in the Click event to see it's fired or not. But the message is more explicit, you're right.

About the Teechart version :
The TeeChart.dll version is 4.0.2009.16186

I'm working with Visual Studio 2005 SP1, with Windows XP SP3.

The click event is fired in VS 2003 with a previous version of Teechart.

Re: Click Events on Series not firing

Posted: Thu Jun 18, 2009 2:01 pm
by yeray
Hi nico193,

Excuse us, we were doing the tests with the actual sources, not with the version available at the download area and we couldn't reproduce the problem because this is a bug recently fixed (TF02014214). So it should work fine with the next maintenance release.