Draw Average TBarSeries
Draw Average TBarSeries
Hello,
With the TAverageFunction is there is a way to draw the average like it
I can draw the average but this is not cutted between the barSeries.
Thank you for help
Regards
With the TAverageFunction is there is a way to draw the average like it
I can draw the average but this is not cutted between the barSeries.
Thank you for help
Regards
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Calou,
Yes, we are working on it. We will get back to you when we have further news.
Yes, we are working on it. We will get back to you when we have further news.
Best Regards,
Narcís Calvet / 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 |
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Calou,
We have made a sample project doing something similar to what you request. We will send it by e-mail. You just have to remove axes labels and us a custom axis label for each stack group. You'll find a custom axis labels example at All Features\Welcome!\Axes\Labels\Custom labels in the new features demo available at TeeChart's program group.
If this doesn't help you could use custom axes (3 in that case) and associate series to those axes as in your image. Then you just should add an average function for each series.
We have made a sample project doing something similar to what you request. We will send it by e-mail. You just have to remove axes labels and us a custom axis label for each stack group. You'll find a custom axis labels example at All Features\Welcome!\Axes\Labels\Custom labels in the new features demo available at TeeChart's program group.
If this doesn't help you could use custom axes (3 in that case) and associate series to those axes as in your image. Then you just should add an average function for each series.
Best Regards,
Narcís Calvet / 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 |
Hello,
I have done something like that (i send it on your upload page. Name : Bar.zip).
But i have two problems
How i can do to have the testseries width = the group bar width and center it on each group bar?
If i unchecked series the scale is changed. Is it possible to prevent it?
Thank you for help
I have done something like that (i send it on your upload page. Name : Bar.zip).
But i have two problems
How i can do to have the testseries width = the group bar width and center it on each group bar?
If i unchecked series the scale is changed. Is it possible to prevent it?
Thank you for help
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Calou,
1. Instead of disabling series set their color to clNone. If you are using legend's checkboxes you should use OnClickLegend event.
2. Set series values to null.
However, for not needing so many customizations you'd better use a custom axis and a single series for each group.
Hope this helps!
In that case we recommend you to manually calculate average and custom draw it on chart's canvas. You can also use existing average series, disable it and use its value for manually plotting the lines you want. You'll find more information about custom drawing in Tutorial 13 - Custom drawing on the Chart Panel. Tutorials are available at TeeChart's program group. On this forum, using its search feature, you will also find several custom drawing examples.How i can do to have the testseries width = the group bar width and center it on each group bar?
Yes, in that case you have two options:If i unchecked series the scale is changed. Is it possible to prevent it?
1. Instead of disabling series set their color to clNone. If you are using legend's checkboxes you should use OnClickLegend event.
2. Set series values to null.
However, for not needing so many customizations you'd better use a custom axis and a single series for each group.
Hope this helps!
Best Regards,
Narcís Calvet / 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 |
Hello,
There is no problem to manually calculate average.
On the other hand using custom axis means that on one axis i have all the bar for one project in my case. If i uncheck it in legend, all the bars of one project are hidden. But i don't want it. I have to hidde the bar 1 on project 1, the bar 1 one project 2...
Futhermore i have not find a solution in custom axis to draw the bar side by side.
It would be very interressant for me to draw a line serie (points are calculate to do the average) which is cutted (no problem with addnull) but i am not able to centre it on each project without using custom axes
Regards
There is no problem to manually calculate average.
On the other hand using custom axis means that on one axis i have all the bar for one project in my case. If i uncheck it in legend, all the bars of one project are hidden. But i don't want it. I have to hidde the bar 1 on project 1, the bar 1 one project 2...
Futhermore i have not find a solution in custom axis to draw the bar side by side.
It would be very interressant for me to draw a line serie (points are calculate to do the average) which is cutted (no problem with addnull) but i am not able to centre it on each project without using custom axes
Regards
I have done something like it for test.
What do you think about this method (the number of series could be between 1 to n)?
What do you think about this method (the number of series could be between 1 to n)?
Code: Select all
Series1.AddXY(0,50);
Series1.AddXY(1,60);
Series1.AddXY(2,40);
Series2.AddXY(0,40);
Series2.AddXY(1,30);
Series2.AddXY(2,70);
Series3.AddNull(0);
Series3.AddXY(1,70);
Series3.Addnull(2);
Chart1.Draw();
delta_x:=Abs(Series1.XScreenToValue(Series2.CalcXPos(0))-Series1.XScreenToValue(Series1.CalcXPos(0)));
x_deb:=Series1.XScreenToValue(Series1.CalcXPos(0));
x_fin:=x_deb+delta_x*3;
Series4.AddXY(x_deb,50);
Series4.AddXY(x_fin,50);
Series4.AddNullXY(x_fin,50);
x_deb:=Series1.XScreenToValue(Series1.CalcXPos(1));
Series4.AddXY(x_deb,60);
x_fin:=x_deb+delta_x*3;
Series4.AddXY(x_fin,60);
Series4.AddNullXY(x_fin,60);
x_deb:=Series1.XScreenToValue(Series1.CalcXPos(2));
x_fin:=x_deb+delta_x*3;
Series4.AddXY(x_deb,60);
Series4.AddXY(x_fin,60);
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Calou,
Or this:
In the code example you posted in your last post, this code would make the first bar of each series not visible.
When I mentioned that you could set series values to null an option to do this is setting bar's color to clNone, for example:On the other hand using custom axis means that on one axis i have all the bar for one project in my case. If i uncheck it in legend, all the bars of one project are hidden. But i don't want it. I have to hidde the bar 1 on project 1, the bar 1 one project 2...
Code: Select all
Series1.Color:=clNone;
Code: Select all
for i:=0 to Chart1.SeriesCount - 2 do
begin
Chart1[i].ValueColor[0]:=clNone;
end;
In that case you should set bar series like this:Futhermore i have not find a solution in custom axis to draw the bar side by side.
Code: Select all
Series1.SideMargins:=false;
Series1.BarWidthPercent:=100;
Draw method call in the code you posted should prevent this. This code works fine for me here:By using this method if i do
Series1.AddXY(0,50);
Series2.AddXY(0,40);
Series3.AddNull(0);
the first time, x_deb, delta_x and x_fin equal 0
How could prevent it?
Code: Select all
procedure TForm1.FormCreate(Sender: TObject);
var delta_x : Double;
x_deb : Double;
x_fin : Double;
i : Integer;
begin
Series1.AddXY(0,50);
Series1.AddXY(1,60);
Series1.AddXY(2,40);
Series2.AddXY(0,40);
Series2.AddXY(1,30);
Series2.AddXY(2,70);
Series3.AddNull(0);
Series3.AddXY(1,70);
Series3.Addnull(2);
Chart1.Draw;
delta_x:=Abs(Series1.XScreenToValue(Series2.CalcXPos(0))-Series1.XScreenToValue(Series1.CalcXPos(0)));
x_deb:=Series1.XScreenToValue(Series1.CalcXPos(0));
x_fin:=x_deb+delta_x*3;
Series4.AddXY(x_deb,50);
Series4.AddXY(x_fin,50);
Series4.AddNullXY(x_fin,50);
x_deb:=Series1.XScreenToValue(Series1.CalcXPos(1));
Series4.AddXY(x_deb,60);
x_fin:=x_deb+delta_x*3;
Series4.AddXY(x_fin,60);
Series4.AddNullXY(x_fin,60);
x_deb:=Series1.XScreenToValue(Series1.CalcXPos(2));
x_fin:=x_deb+delta_x*3;
Series4.AddXY(x_deb,60);
Series4.AddXY(x_fin,60);
end;
Best Regards,
Narcís Calvet / 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 |
Thank you Narcis for your answer
If i write this code :
Series4 doesn't appear in spite of Chart.draw
Regards
If i write this code :
Code: Select all
procedure TForm1.Button1Click(Sender: TObject);
var
delta_x,x_deb,x_fin:double;
begin
Chart1.LeftAxis.Automatic:=FALSE;
Chart1.LeftAxis.Minimum:=0;
Chart1.LeftAxis.Maximum:=100;
Chart1.LeftAxis.Increment:=20;
Series1.AddXY(0,50,'P1');
Series2.AddXY(0,40,'P1');
Series3.AddNull(0);
Chart1.Draw();
delta_x:=Abs(Series1.XScreenToValue(Series2.CalcXPos(0))-Series1.XScreenToValue(Series1.CalcXPos(0)));
x_deb:=Series1.XScreenToValue(Series1.CalcXPos(0));
x_fin:=x_deb+delta_x*3;
Series4.AddXY(x_deb,60);
Series4.AddXY(x_fin,60);
Series4.AddNullXY(x_fin,50);
end;
Regards
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Calou,
This is because series only have on bar. Therefore bottom axis range goes from 0 to 0 and has no option for calculating exact axes positions as you'd like to do. In that case you can add an additional null point to your series and manually set bottom axis scale like this:
Hope this helps!
This is because series only have on bar. Therefore bottom axis range goes from 0 to 0 and has no option for calculating exact axes positions as you'd like to do. In that case you can add an additional null point to your series and manually set bottom axis scale like this:
Code: Select all
procedure TForm1.FormCreate(Sender: TObject);
var
delta_x,x_deb,x_fin:double;
begin
Chart1.Axes.Left.Automatic:=FALSE;
Chart1.Axes.Left.SetMinMax(0,100);
Chart1.Axes.Left.Increment:=20;
Series1.AddXY(0,50,'P1');
Series2.AddXY(0,40,'P1');
Series3.AddNull(0);
if Series1.Count=1 then
begin
Series1.AddNull('');
Series2.AddNull('');
Series3.AddNull('');
Chart1.Axes.Bottom.SetMinMax(Series1.MinXValue-0.5,Series1.XValue[Series1.Count-2]+0.5);
//or
//Chart1.Axes.Bottom.SetMinMax(-0.5,0.5);
end;
Chart1.Draw;
delta_x:=Abs(Series1.XScreenToValue(Series2.CalcXPos(0))-Series1.XScreenToValue(Series1.CalcXPos(0)));
x_deb:=Series1.XScreenToValue(Series1.CalcXPos(0));
x_fin:=x_deb+delta_x*3;
Series4.AddXY(x_deb,60);
Series4.AddXY(x_fin,60);
Series4.AddNullXY(x_fin,50);
end;
Best Regards,
Narcís Calvet / 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 |