Page 1 of 1

show distinct bars of stacked bar chart

Posted: Wed Apr 07, 2010 5:14 am
by 13045482
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.

Re: show distinct bars of stacked bar chart

Posted: Wed Apr 07, 2010 5:30 am
by 13045482
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.

Re: show distinct bars of stacked bar chart

Posted: Wed Apr 07, 2010 11:38 am
by 10050769
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

Re: show distinct bars of stacked bar chart

Posted: Wed Apr 07, 2010 12:34 pm
by 13045482
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.

Re: show distinct bars of stacked bar chart

Posted: Wed Apr 07, 2010 1:09 pm
by 13045482
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!

Re: show distinct bars of stacked bar chart

Posted: Wed Apr 07, 2010 1:29 pm
by 13045482
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)

Re: show distinct bars of stacked bar chart

Posted: Fri Apr 09, 2010 10:17 am
by 10050769
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,

Re: show distinct bars of stacked bar chart

Posted: Fri Apr 09, 2010 11:15 am
by 13049497
Hi,

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

Re: show distinct bars of stacked bar chart

Posted: Fri Apr 09, 2010 1:23 pm
by 13045482
But then it would show blank/null in data table tool as well and so the purpose wont be solved. Or i misunderstood anything?

Re: show distinct bars of stacked bar chart

Posted: Fri Apr 09, 2010 2:55 pm
by 13049497
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 :)

Re: show distinct bars of stacked bar chart

Posted: Fri Apr 09, 2010 4:38 pm
by 13045482
Thanks.. can you give me some example code( use of set null for this ) , it will really help..

Re: show distinct bars of stacked bar chart

Posted: Mon Apr 12, 2010 5:25 am
by 13049497
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);

Re: show distinct bars of stacked bar chart

Posted: Mon Apr 12, 2010 8:09 am
by yeray
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).

Re: show distinct bars of stacked bar chart

Posted: Thu Apr 15, 2010 5:46 am
by 13045482
ok,thanks.