stack areas again :-)
-
- Advanced
- Posts: 228
- Joined: Tue Aug 28, 2007 12:00 am
- Location: Oregon, USA
stack areas again :-)
8.06, D2007
I have spent all afternoon (3+ hours now-) trying to figure out how to get the attached demo to work. There are three different datasets in the demo, and none of them look right--maybe I am trying to accomplish something that is not possible.
I want the area to be full, with no dead area in the chart. The stacked areas should fill the area of the sum of the values.
Can this be done for all 3 datasets with the same code? If so, what am I missing?
Ed Dressel
I have spent all afternoon (3+ hours now-) trying to figure out how to get the attached demo to work. There are three different datasets in the demo, and none of them look right--maybe I am trying to accomplish something that is not possible.
I want the area to be full, with no dead area in the chart. The stacked areas should fill the area of the sum of the values.
Can this be done for all 3 datasets with the same code? If so, what am I missing?
Ed Dressel
- Attachments
-
- Stack Area 2 Ways.zip
- (4.15 KiB) Downloaded 1000 times
Re: stack areas again :-)
Ed,
I'm not exactly sure what you're ultimately looking for, so I plotted your data in Excel (one of your cases), and then tweaked your code so the plots looked similar (at least to me). Is this kinda what you had in mind?
I'm not exactly sure what you're ultimately looking for, so I plotted your data in Excel (one of your cases), and then tweaked your code so the plots looked similar (at least to me). Is this kinda what you had in mind?
- Attachments
-
- UpdateChart.zip
- (813 Bytes) Downloaded 997 times
-
- Advanced
- Posts: 228
- Joined: Tue Aug 28, 2007 12:00 am
- Location: Oregon, USA
Re: stack areas again :-)
What I am wanting is a little different. When a series goes to zero, I want it to step down right away, not draw a line to zero. Here is a sample chart that steps down:
The green area series works perfectly here.
Let me explain what I am showing--the chart represents income during retirement. The green chart is income is from a cash account that runs out of money in year 16. If I show a step down from there to year 17, it appear it still has money after that. But actually it is running out in year 16, and it should step down (as shown above)
I can do this with charts that do not have many series, but when a large number of series are to be drawn, and/or when a series starts in the middle of the chart, I cannot get the chart to display correctly.
Ed Dressel
The green area series works perfectly here.
Let me explain what I am showing--the chart represents income during retirement. The green chart is income is from a cash account that runs out of money in year 16. If I show a step down from there to year 17, it appear it still has money after that. But actually it is running out in year 16, and it should step down (as shown above)
I can do this with charts that do not have many series, but when a large number of series are to be drawn, and/or when a series starts in the middle of the chart, I cannot get the chart to display correctly.
Ed Dressel
Re: stack areas again :-)
Ed,
Ahh, I understand the problem. I've tried a few things (probably like you) and always end up with a little unfilled triangle somewhere.
My only thoughts, if the Steema folks don't have a solution:
Bar Graph. Data seems tailor made for that...
Custom Drawing. Either custom draw the little triangle, or draw polygons in lieu of the series.
Best of luck.
Ahh, I understand the problem. I've tried a few things (probably like you) and always end up with a little unfilled triangle somewhere.
My only thoughts, if the Steema folks don't have a solution:
Bar Graph. Data seems tailor made for that...
Custom Drawing. Either custom draw the little triangle, or draw polygons in lieu of the series.
Best of luck.
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: stack areas again :-)
Hello Ed and bookman,
First of all notice that to use stacked area series you need to have same number of points and those must have the same X values. This not being the case might lead to such problems. Also, we have implemented a fix for stacked area series with negative values for next maintenance release but this may not apply to the issue discussed here.
First of all notice that to use stacked area series you need to have same number of points and those must have the same X values. This not being the case might lead to such problems. Also, we have implemented a fix for stacked area series with negative values for next maintenance release but this may not apply to the issue discussed here.
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 |
-
- Advanced
- Posts: 228
- Joined: Tue Aug 28, 2007 12:00 am
- Location: Oregon, USA
Re: stack areas again :-)
I was aware of that and int he header of the demo app put the number of points for each series:Narcís wrote:First of all notice that to use stacked area series you need to have same number of points and those must have the same X values. This not being the case might lead to such problems.
I also included the ability to see the data for each stacked area.
I am not sure how to do this--or if it can be done--on a generic basis.
Ed Dressel
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: stack areas again :-)
Hi Ed,
To get a chart similar to the image you posted on 1st June you could try using 3 series and add null values to green or pink series where values shouldn't exist. I recommend you to have a look at the All Features\Welcome!\Chart Styles\Area\Area TreatNulls example in the new features example, available at TeeChart's program group.
If this doesn't help, do you think any of the 3 datasets in your original project contains a data structure as in mentioned chart? Otherwise, could you please attach a simple example project or, at least, some date which should produce such chart structure? We will try to help you getting it.
Thanks in advance.
To get a chart similar to the image you posted on 1st June you could try using 3 series and add null values to green or pink series where values shouldn't exist. I recommend you to have a look at the All Features\Welcome!\Chart Styles\Area\Area TreatNulls example in the new features example, available at TeeChart's program group.
If this doesn't help, do you think any of the 3 datasets in your original project contains a data structure as in mentioned chart? Otherwise, could you please attach a simple example project or, at least, some date which should produce such chart structure? We will try to help you getting it.
Thanks in advance.
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 |
-
- Advanced
- Posts: 228
- Joined: Tue Aug 28, 2007 12:00 am
- Location: Oregon, USA
Re: stack areas again :-)
I installed the 8.06 with full source, which doesn't look like it includes the demo. Is there any way to just get the demo without installing over the top of the existing code?Narcís wrote:I recommend you to have a look at the All Features\Welcome!\Chart Styles\Area\Area TreatNulls example in the new features example, available at TeeChart's program group.
Thank you,
Ed Dressel
Re: stack areas again :-)
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
-
- Advanced
- Posts: 228
- Joined: Tue Aug 28, 2007 12:00 am
- Location: Oregon, USA
Re: stack areas again :-)
I found a fix--I do self stacking. Here is a screen shot of what I am looking for (the unevenness in the chart on the slope is due to rounding errors--I didn't type in the decimals for the data):
I changed the code so that it stacks itself:
I could not get this result with the maStacked option.
I have attached the project for anyone wanting to review it.
Ed Dressel
I changed the code so that it stacks itself:
Code: Select all
for I := High(lChartData) downto Low(lChartData) do
begin
Chart1.FreeAllSeries;
lChartData := GetChartData;
for I := High(lChartData) downto Low(lChartData) do
begin
lsrs := CreateChartSeries(I, maNone);;
for J := 0 to High(lChartData[I]) do
begin
lIncome := 0;
for K := 0 to I do
lIncome := lIncome + lChartData[K, J];
if (lIncome > 0) then
lsrs.AddXY(J, lIncome, IntToStr(J))
else
lsrs.AddNullXY(J, 0, IntToStr(J));
end;
end;
end;
I have attached the project for anyone wanting to review it.
Ed Dressel
- Attachments
-
- Stack Area 2 Ways.zip
- (4.8 KiB) Downloaded 937 times
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: stack areas again :-)
Hi Ed,
Excellent, thanks for sharing
Excellent, thanks for sharing
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 |