To show message on clicking downside to axis

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
amol
Advanced
Posts: 231
Joined: Tue Mar 29, 2005 5:00 am

To show message on clicking downside to axis

Post by amol » Fri Nov 14, 2014 12:12 pm

Hi Steema Support,

Is it possible to show message box on clicking on the portion (downside of axis) of the axis. As shown in attached image.
please provide any solution for the same, it is very helpful to us.
Image1.png
Image
Image1.png (49.66 KiB) Viewed 4489 times
Thanks in advance.

Thanks&Regards
PlanoResearch

Christopher
Guru
Posts: 1603
Joined: Fri Nov 15, 2002 12:00 am

Re: To show message on clicking downside to axis

Post by Christopher » Mon Nov 17, 2014 10:38 am

Hello,

Try:

Code: Select all

    private void InitializeChart()
    {
      tChart1.MouseDown += tChart1_MouseDown;
      tChart1.Series.Add(typeof(Bar)).FillSampleValues();

      tChart1.AfterDraw += tChart1_AfterDraw;

      tChart1.Axes.Bottom.Title.Text = "bottom axes";
    }

    Rectangle rect;
    void tChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
    {
      rect = Utils.FromLTRB(tChart1.Axes.Bottom.IStartPos, tChart1.Axes.Left.IEndPos, tChart1.Axes.Bottom.IEndPos,
        tChart1.Axes.Bottom.Position + tChart1.Axes.Bottom.Labels.Height + tChart1.Axes.Bottom.Ticks.Length);

      g.Pen.Color = Color.Red;
      g.Brush.Visible = false;
      g.Rectangle(rect);
    }

    void tChart1_MouseDown(object sender, MouseEventArgs e)
    {
      tChart1.Chart.CancelMouse = true;
      if (tChart1.Axes.Bottom.Title.Clicked(e.X, e.Y))
      {
        MessageBox.Show("Title Clicked");
      }

      if(rect.Contains(e.X, e.Y))
      {
        MessageBox.Show("Axis Clicked");
      }
    }
Best Regards,
Christopher Ireland / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Instructions - How to post in this forum

Post Reply