Page 1 of 1
Horizontal BoxPlot
Posted: Fri Feb 19, 2016 10:54 am
by 16075081
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
Re: Horizontal BoxPlot
Posted: Mon Feb 22, 2016 12:16 pm
by Christopher
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());
}
Re: Horizontal BoxPlot
Posted: Thu Mar 03, 2016 8:52 am
by 16075081
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
Re: Horizontal BoxPlot
Posted: Thu Mar 03, 2016 9:36 am
by Christopher
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)));
}