Page 1 of 1
Error Bars on Bar Chart
Posted: Tue Oct 19, 2010 10:28 am
by 13047055
Hi
I am wondering if it is possible to do some form of error bar on a bar chart.
The kind of thing I am thinking of is a normal bar chart, with an error band at the top - but I am open to suggestions. I don't seem to be able to locate any tutorials on adding error bars to a plot series either, but that may well be me being thick...
TIA for the help
Bernie
Re: Error Bars on Bar Chart
Posted: Tue Oct 19, 2010 2:06 pm
by 10050769
Hello Bernie,
TeeChart.Net gives you a series specially for do you want. I recommend you take a look to a Demo of TeeChart.Net concretely in t he example:All Features\Welcome!\Chart styles\Statistical\Error Bar
I hope will helps.
Thanks,
Re: Error Bars on Bar Chart
Posted: Tue Oct 19, 2010 3:59 pm
by 13047055
Ok, I missed that one. It's ok, and it'll do for a start, but what I really wanted to do was something akin to the image attached (edited in PSP from your example)...
You'll note I've modified the 2nd bar to have upper and lower error bands. Is this as simple as using a Bar series then adding adding a second error series? How would I get different upper and lower error bands?
TIA....
Bernie
Re: Error Bars on Bar Chart
Posted: Tue Oct 19, 2010 4:04 pm
by 13047055
I've also just noticed that the legend is now using the error bar shape and colour - is there any way of changing it back to display a square block of Bar colour?
Bernie
Re: Error Bars on Bar Chart
Posted: Wed Oct 20, 2010 7:55 am
by 13047055
Ok, I've found the .ErrorStyle property that seems to do what I need.
Still haven't found a way of turning the legend back the way I want it though...
Re: Error Bars on Bar Chart
Posted: Wed Oct 20, 2010 8:05 am
by yeray
Hi porterbe,
porterbe wrote:the legend is now using the error bar shape and colour - is there any way of changing it back to display a square block of Bar colour?
Do you mean that the Error Bar series showed a square in the legend in a previous version? I can see the same in TeeChart for NET v3 and v2.
If you want, you can customize the legend symbols as in the example at
All Features\Welcome !\Miscellaneous\Legend\OnDrawSymbol Event
Re: Error Bars on Bar Chart
Posted: Wed Oct 20, 2010 9:01 am
by 13047055
When I used a standard bar series, my legend looked like the image BarLegend.png
- BarLegend.png (8.44 KiB) Viewed 7594 times
With a ErrorBar series, my legend looks like the image ErrorBarLegend.png.
- ErrorBarLegend.png (8.81 KiB) Viewed 7596 times
I want the error bars in ErrorBarLegend.png, but with the Legend from BarLegend.png. Can I get this?
Re: Error Bars on Bar Chart
Posted: Wed Oct 20, 2010 10:41 am
by 10050769
Hello Bernie,
I think you can do something as next example:
Code: Select all
public Form1()
{
InitializeComponent();
InitializeChart();
}
private void InitializeChart()
{
tChart1.Aspect.View3D = false;
Steema.TeeChart.Styles.ErrorBar series1 = new Steema.TeeChart.Styles.ErrorBar(tChart1.Chart);
Steema.TeeChart.Styles.ErrorBar series2 = new Steema.TeeChart.Styles.ErrorBar(tChart1.Chart);
Steema.TeeChart.Styles.ErrorBar series3 = new Steema.TeeChart.Styles.ErrorBar(tChart1.Chart);
series1.Add(0, 123, 23);
series2.Add(1, -432, 65);
series3.Add(2, 88, 13);
series1.Add(4, 222, 44);
series1.ErrorPen.Color = Color.Blue;
series1.Color = Color.Red;
series2.ErrorPen.Color = Color.Blue;
series2.Color = Color.Red;
series3.ErrorPen.Color = Color.Blue;
series3.Color = Color.Red;
series1.ErrorStyle = Steema.TeeChart.Styles.ErrorStyles.TopBottom;
series2.ErrorStyle = Steema.TeeChart.Styles.ErrorStyles.Bottom;
series3.ErrorStyle = Steema.TeeChart.Styles.ErrorStyles.Top;
tChart1.Legend.Symbol.OnSymbolDraw += new Steema.TeeChart.SymbolDrawEventHandler(Symbol_OnSymbolDraw);
}
void Symbol_OnSymbolDraw(object sender, Steema.TeeChart.SymbolDrawEventArgs e)
{
Rectangle tmpR = e.Rect;
tChart1.Chart.Graphics3D.Rectangle(tmpR);
}
Could you please, tell us if this code works as you want?
I hope will helps.
Thanks,
Re: Error Bars on Bar Chart
Posted: Wed Oct 20, 2010 12:24 pm
by 13047055
That'll do the job, thank you
.
I had come to a similar conclusion, but I was struggling with how to fill the rectangle. Now I know!