Horizontal BoxPlot

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Philippe
Newbie
Newbie
Posts: 2
Joined: Thu Jul 16, 2015 12:00 am

Horizontal BoxPlot

Post by Philippe » Fri Feb 19, 2016 10:54 am

Dear Sir,

I want to know if it is possible to rotate the boxplot in order to have a horizontal display of It ?
Is it possible also to trace the means value in addition to the median ?

Thank you

Philippe

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

Re: Horizontal BoxPlot

Post by Christopher » Mon Feb 22, 2016 12:16 pm

Hello Philippe,
Philippe wrote:I want to know if it is possible to rotate the boxplot in order to have a horizontal display of It ?
Is it possible also to trace the means value in addition to the median ?
Yes, both these things are possible, as shown in the code below:

Code: Select all

    private void InitializeChart()
    {
      tChart1.Aspect.View3D = false;
      HorizBox hBox = new HorizBox(tChart1.Chart);
      hBox.FillSampleValues();

      MessageBox.Show(hBox.XValues.Value.Take(hBox.XValues.Count).Average().ToString());
    }
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

Philippe
Newbie
Newbie
Posts: 2
Joined: Thu Jul 16, 2015 12:00 am

Re: Horizontal BoxPlot

Post by Philippe » Thu Mar 03, 2016 8:52 am

Dear Christopher,

Thank you for your reply.
About the rotation of the boxplot it's ok, but I want to draw a line with the mean value into the box plot.
Do you know if it's possible ?

Thank you.

Philippe

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

Re: Horizontal BoxPlot

Post by Christopher » Thu Mar 03, 2016 9:36 am

Hello Philippe,
Philippe wrote: About the rotation of the boxplot it's ok, but I want to draw a line with the mean value into the box plot.
Do you know if it's possible ?
Yes, you can "custom draw" on the chart using code similar to the following:

Code: Select all

    HorizBox hBox;
    private void InitializeChart()
    {
      tChart1.Aspect.View3D = false;
      hBox = new HorizBox(tChart1.Chart);
      hBox.FillSampleValues();
      tChart1.AfterDraw += TChart1_AfterDraw1;
    }

    private void TChart1_AfterDraw1(object sender, Graphics3D g)
    {
      double average = hBox.XValues.Value.Take(hBox.XValues.Count).Average();

      Point start = new Point(100, 100);

      g.Font.Color = Color.Red;
      g.Font.Size = 16;
      g.TextOut(start.X - 30, start.Y - 30, "Average: " + average.ToString("N2"));

      g.Pen.Color = Color.Red;
      g.Pen.Width = 2;
      g.Line(start, new Point(hBox.CalcXPosValue(average), hBox.CalcYPosValue(0)));
    }
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