Artifacts in stacked bar with series values zero

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
qcrnd
Advanced
Posts: 214
Joined: Mon Sep 04, 2006 12:00 am

Artifacts in stacked bar with series values zero

Post by qcrnd » Wed May 13, 2009 11:39 am

Hi
I have a stacked bar with series that have a white pen width 2 and sometimes the value on the x axis can be zero. The problem I found is that in this case you still draw the series with a few pixels and it doesnt look nice.
See the image . For example in the second bar and forth bar . The last series (orange Reopen ) is drawn on top even though its value is 0 and it doesnt look nice. You will see other examples in between other series as well for example the one under bottom axis label called "sa"
Image

HOw can I remove these artifacts.
Thanks.

Yeray
Site Admin
Site Admin
Posts: 8746
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Post by Yeray » Wed May 13, 2009 3:21 pm

Hi qcrnd,

Yes, you are right. Note that this only happens in 2D charts. I've added it to the wish list to be fixed in future releases (TF02014154).

A workarround is to look for the 0 values and set them as null:

Code: Select all

            for (int i = 0; i < tChart1.Series.Count; i++)
            {
                for (int j = 0; j < tChart1.Series[i].Count; j++)
                {
                    if (tChart1.Series[i].YValues[j] == 0)
                    {
                        tChart1.Series[i].SetNull(j);
                    }
                }
            }
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

qcrnd
Advanced
Posts: 214
Joined: Mon Sep 04, 2006 12:00 am

Post by qcrnd » Sun May 17, 2009 5:45 am

Hi Yeray
Thanks for the reply.
Your workaround is OK but it causes a new problem. In the stacked bar we set the last series (the top most series) Marks.Visible to true so that we can have a mark above each stacked bar.
Because of your workaround , if the value of the top series is 0 and we set the value to Null, then the mark is not visible. The Mark is only visible in bars that the top series YValue is > 0.
How can I solve this issue as well.
Thanks

Yeray
Site Admin
Site Admin
Posts: 8746
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Post by Yeray » Mon May 18, 2009 11:09 am

Hi qcrnd,

I'm afraid that in then you should set each mark to be hidden or shown individually. For example, to show the last non null values:

Code: Select all

tChart1.Aspect.View3D = false;

for (int i = 0; i < 4; i++)
{
    new Bar(tChart1.Chart);
    tChart1.Series[i].FillSampleValues(5);
    ((Bar)tChart1.Series[i]).MultiBar = MultiBars.Stacked;
}

tChart1.Series[1].YValues[2] = 0;
tChart1.Series[2].YValues[2] = 0;
tChart1.Series[3].YValues[4] = 0;
tChart1.Series[0].YValues[3] = 0;

for (int i = 0; i < tChart1.Series.Count; i++)
{
    for (int j = 0; j < tChart1.Series[i].Count; j++)
    {
        if (tChart1.Series[i].YValues[j] == 0)
        {
            tChart1.Series[i].SetNull(j);
        }
    }
}

for (int ValueIndex = 0; ValueIndex < tChart1.Series[0].Count; ValueIndex++)
{
    int SeriesIndex = tChart1.Series.Count-1;
    while ((SeriesIndex > 0) && (tChart1.Series[SeriesIndex].IsNull(ValueIndex)))
    {
        SeriesIndex--;
    }
    for (int k = 0; k < tChart1.Series.Count; k++)
    {
        tChart1.Series[k].Marks.Items[ValueIndex].Visible = k == SeriesIndex;
    }
}
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

qcrnd
Advanced
Posts: 214
Joined: Mon Sep 04, 2006 12:00 am

Post by qcrnd » Mon May 18, 2009 12:49 pm

Hi
It doesnt seem to work . I dont see any marks.
I do have another workaround that uses GetSeriesMark and decides which marks to draw and which not But I think your workaround looks better so I would like to see how to make it work.
It seems that Marks Items doesnt have any effect on my graph.
I have a feeling that there is something more missing
Thanks.

Yeray
Site Admin
Site Admin
Posts: 8746
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Post by Yeray » Mon May 18, 2009 1:22 pm

Hi qcrnd,

It's strange, have you tested the code I said above in a new project with a new chart?
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

qcrnd
Advanced
Posts: 214
Joined: Mon Sep 04, 2006 12:00 am

Post by qcrnd » Mon May 18, 2009 1:58 pm

NO I tried in my application.
In anycase I think I will remain with my workaround and wait till it gets fixed properly.
When do you reckon it will be fixed ?
Thank.s

Yeray
Site Admin
Site Admin
Posts: 8746
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Post by Yeray » Mon May 18, 2009 2:30 pm

Hi qcrnd,

I can't tell you a date. I recommend you to be aware at this forum or subscribe to our RSS news feed for new release announcements and what's fixed on them.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply