show distinct bars of stacked bar chart

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Neelam
Advanced
Posts: 193
Joined: Fri Jun 08, 2007 12:00 am

show distinct bars of stacked bar chart

Post by Neelam » Wed Apr 07, 2010 5:14 am

Hi i have a stacked bar chart and there are 11 bars with different colors stacked on each other. The problem is that there is no border between the bar sections, so its not easy to see distinguish the different bars as the colors to be used are not very distinct. i tried to put black border between them by-
Private Sub SetBarColor(ByVal aBar As Steema.TeeChart.Styles.Bar, ByVal aColor As Color)
aBar.Color = aColor
aBar.Pen.Color = Color.black
End Sub

but this does not give me black border line between 2 bars. I have uploaded attachment called screenshotBarcolor.doc for your reference.

Neelam
Advanced
Posts: 193
Joined: Fri Jun 08, 2007 12:00 am

Re: show distinct bars of stacked bar chart

Post by Neelam » Wed Apr 07, 2010 5:30 am

Also i d using transparent color of Pen for all bars-
Private Sub SetBarColor(ByVal aBar As Steema.TeeChart.Styles.Bar, ByVal aColor As Color)
aBar.Color = aColor
aBar.Pen.Color = Color.Transparent
End Sub
but strangely it gives Pink line between the bars where bars have fill color of blue,light blue and Bue color between bars where bars have pink,orange kind of shades.Why is that? i am uploading another attchment called screenshotPencolorTransparent.doc for this one.

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: show distinct bars of stacked bar chart

Post by Sandra » Wed Apr 07, 2010 11:38 am

Hello shikha,
Hi i have a stacked bar chart and there are 11 bars with different colors stacked on each other. The problem is that there is no border between the bar sections, so its not easy to see distinguish the different bars as the colors to be used are not very distinct. i tried to put black border between them by-
I couldn't reproduce it with last version 4 of TeeChart .Net and next code. Please, check if next code works as you want in your application.

Code: Select all

Private Sub InitializeChart()
        tChart1.Dock = DockStyle.Fill
        tChart1.Aspect.View3D = false
        Dim i As Integer 
        For i=0 To 10 
            New Steema.TeeChart.Styles.Bar(tChart1.Chart)
            tChart1(i).FillSampleValues
            tChart1(i).Marks.Visible = false
            CType(tChart1(i),Steema.TeeChart.Styles.Bar).Pen.Color = Color.Black
        Next i
        CType(tChart1(0),Steema.TeeChart.Styles.Bar).MultiBar = Steema.TeeChart.Styles.MultiBars.Stacked
    End Sub
Also i d using transparent color of Pen for all bars-
Private Sub SetBarColor(ByVal aBar As Steema.TeeChart.Styles.Bar, ByVal aColor As Color)
aBar.Color = aColor
aBar.Pen.Color = Color.Transparent
End Sub
I'm not sure which is your problem with previous code. Please, you could explain exactly what is your problem with Color.Transparent?
but strangely it gives Pink line between the bars where bars have fill color of blue,light blue and Bue color between bars where bars have pink,orange kind of shades.Why is that?
Pen colours are automatically shaded (either darker or lighter) for aesthetic purposes. Please, see TeeChart .Net Demo concretely All Features\Welcome !\Chart styles\Standard\Bar
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Neelam
Advanced
Posts: 193
Joined: Fri Jun 08, 2007 12:00 am

Re: show distinct bars of stacked bar chart

Post by Neelam » Wed Apr 07, 2010 12:34 pm

thanks, i figured out that my problem is due to fact that i am having some bars with value 0 , so they are showing up with a thin line in a chart giving a false impression that its due to pen.color or border of neigbour bar. So please let me know how can i remove the bars with 0 values from stacked bar, please guide with piece of code. many thanks.

Neelam
Advanced
Posts: 193
Joined: Fri Jun 08, 2007 12:00 am

Re: show distinct bars of stacked bar chart

Post by Neelam » Wed Apr 07, 2010 1:09 pm

Also i tried doing this i.e not to add the series if the value=0-
If Math.Round(dr("Series3"), 2) <> 0 Then
arBarSeries(IIABarSeries.DP).Add(dr("series3"))
End If

It solves this issue but gives another issue that in data table tool(Steema.TeeChart.Tools.DataTableTool associated with this chart) it does not display 0 , it shows blank!

Neelam
Advanced
Posts: 193
Joined: Fri Jun 08, 2007 12:00 am

Re: show distinct bars of stacked bar chart

Post by Neelam » Wed Apr 07, 2010 1:29 pm

is there any way that the bars with 0 values are added to the data table( taht is they show 0 there) , but are not shown in the chart( currently they show up as a very thin line)

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: show distinct bars of stacked bar chart

Post by Sandra » Fri Apr 09, 2010 10:17 am

Hello shikha,
is there any way that the bars with 0 values are added to the data table( taht is they show 0 there) , but are not shown in the chart( currently they show up as a very thin line)
I could reproduce your problem, and I consider as a bug report with number [TF02014788]. We will try to fix it for next versions of TeeChart.Net.

Thanks,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

AIS
Newbie
Newbie
Posts: 70
Joined: Wed Jun 25, 2008 12:00 am

Re: show distinct bars of stacked bar chart

Post by AIS » Fri Apr 09, 2010 11:15 am

Hi,

for 0 values you can use the "SetNull" method. I use it to avoid 0 value artefacts like you told.

Neelam
Advanced
Posts: 193
Joined: Fri Jun 08, 2007 12:00 am

Re: show distinct bars of stacked bar chart

Post by Neelam » Fri Apr 09, 2010 1:23 pm

But then it would show blank/null in data table tool as well and so the purpose wont be solved. Or i misunderstood anything?

AIS
Newbie
Newbie
Posts: 70
Joined: Wed Jun 25, 2008 12:00 am

Re: show distinct bars of stacked bar chart

Post by AIS » Fri Apr 09, 2010 2:55 pm

I don`t know how the datatable tool visualize the case if you first add a 0 value and then call SetNull for this point. Anyway, the bar is not shown as a small line :)

Neelam
Advanced
Posts: 193
Joined: Fri Jun 08, 2007 12:00 am

Re: show distinct bars of stacked bar chart

Post by Neelam » Fri Apr 09, 2010 4:38 pm

Thanks.. can you give me some example code( use of set null for this ) , it will really help..

AIS
Newbie
Newbie
Posts: 70
Joined: Wed Jun 25, 2008 12:00 am

Re: show distinct bars of stacked bar chart

Post by AIS » Mon Apr 12, 2010 5:25 am

for example like this:

Code: Select all

CustomBar cb = new CustomBar(tChart1.Chart);
cb.Add(0, 1);
cb.Add(1, 2);
cb.Add(2, 0);
cb.Add(3, 4);
cb.SetNull(2);

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

Re: show distinct bars of stacked bar chart

Post by Yeray » Mon Apr 12, 2010 8:09 am

Hi shikha,

I think that there are two different problems here.

1. Stacked Bars with values = 0 are drawn as thick lines (TF02014788).

2. DataTableTool shows a blank space where it is a null point. I've added to the wish list the possibility to choose between showing or not the null points in the tool (TF02014789).
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

Neelam
Advanced
Posts: 193
Joined: Fri Jun 08, 2007 12:00 am

Re: show distinct bars of stacked bar chart

Post by Neelam » Thu Apr 15, 2010 5:46 am

ok,thanks.

Post Reply