Page 1 of 1
.NET 1.1: Stacked Bar
Posted: Fri May 11, 2007 11:51 am
by 8127541
Hi,
I've uploaded an file called "BarGraph.bmp". How do I created a stacked bargraph like the one in the bitmap image.
Thanks
Regards,
Casper JH Erasmus
Posted: Fri May 11, 2007 12:05 pm
by narcis
Hi Casper,
The easiest way I can think of to achieve that is making bar's pen not visible and using some code like this:
Code: Select all
private void Form1_Load(object sender, EventArgs e)
{
tChart1.Aspect.View3D = false;
for (int i = 0; i < 4; i++)
{
Steema.TeeChart.Styles.Bar bar1 = new Steema.TeeChart.Styles.Bar(tChart1.Chart);
bar1.MultiBar = Steema.TeeChart.Styles.MultiBars.Stacked;
bar1.ColorEach = true;
bar1.BarWidthPercent = 100;
bar1.Marks.Visible = false;
bar1.Pen.Visible = false;
}
tChart1[0].Add(1, 1, Color.Red);
tChart1[1].Add(1, 1, Color.Yellow);
tChart1[2].Add(1, 2, Color.Purple);
tChart1[3].Add(1, 1, Color.Turquoise);
tChart1[0].Add(2, 1, Color.Red);
tChart1[1].Add(2, 2, Color.Blue);
tChart1[2].Add(2, 1.5, Color.Lime);
tChart1[3].Add(2, 0.5, Color.Gray);
}
Is this acceptable for you?
Posted: Fri May 18, 2007 11:44 am
by 8127541
Narcis,
Thank you, unfortunately my customer changed some of the requirements and this type of stacked bar is not necessary anymore.
Thank you for your effort. I appreciated it.
Regards,
Casper JH Erasmus