Page 1 of 1
Stacking bars
Posted: Tue Apr 15, 2008 10:00 am
by 9637396
Hi
I have a chart with bar series.
I need to stack it using code. I can do it from the teechart editor but I really need to do it in code.
I'm using VB
I have tried this:
Dim mybar As Steema.TeeChart.Styles.MultiBars = CType(tChart.Series(0), Steema.TeeChart.Styles.Barmultibars)
mybar.Stacked = Steema.TeeChart.Styles.MultiBars.Side
But it does not allow me to do the conversion in the first line. It tells me:
Type: Steema.TeeChart.Styles.MultiBars Not defined
What Am I doing wrong?
Thanks in advance
Lars Iversen
Posted: Tue Apr 15, 2008 10:11 am
by narcis
Hi Lars,
You need tu use MultiBar property like this:
Code: Select all
Dim bar1 As New Steema.TeeChart.Styles.Bar(TChart1.Chart)
bar1.MultiBar = Steema.TeeChart.Styles.MultiBars.Side
Posted: Tue Apr 15, 2008 10:50 am
by 9637396
Hi NarcĂs
Thanks that seems to work, but then again maybe not.
The code runs but series do not get stacked
( The stay the same.
Is it a bug that might be fixed. I'm using version: 2.0.2306.26232
I have to use this version because of a lot of other problems I have with the newer ones. (Its mostly about streaming to ten and back)
anyway do you have any other suggestions on how to get my bar series stacked?
Thanks in advance
Lars
Posted: Tue Apr 15, 2008 12:05 pm
by narcis
Hi Lars,
Code below works fine for me here using
latest TeeChart for .NET v2 build available. Could you please check if this version solves the problems at your end?
Code: Select all
For index As Integer = 0 To 3
Dim bar1 As New Steema.TeeChart.Styles.Bar(TChart1.Chart)
bar1.MultiBar = Steema.TeeChart.Styles.MultiBars.Side
bar1.FillSampleValues()
Next
Code: Select all
I have to use this version because of a lot of other problems I have with the newer ones. (Its mostly about streaming to ten and back)
Which are the exact problems you are having with newer versions? If you already reported them could you please post the forums thread where they were discussed?
Thanks in advance.
Posted: Tue Apr 15, 2008 1:12 pm
by 9637396
Ahh sorry. I can now see the problem. the example you gave me creates a new bar series and makes sure they are stacken and THEN the data is filled. that works fine too in a small example I have made now.
I have it the other way around. When my customer wants to stack. the bar series has already been made in the chart. So I have to make the bar series stacked
after they are filled. Somehow I need to go through the existing series and make them stacked. can you give an example of that?
Regarding the other issues I have with newer versions: I have tried to do a search where I put in "Lars Iversen" as author but it does not return anything. But in short: I have some advanced code that builds up database queries runtime and adds data and a lot of formatting to the chart. then I can't export the chart as a stream. I get some kind of error that some string could not be converted to numeric or something like that. I can not make a small example that will simulate it
(
BR
Lars
Posted: Tue Apr 15, 2008 2:02 pm
by narcis
Hi Lars,
Sure, you can make something like this:
Code: Select all
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
For Each b As Steema.TeeChart.Styles.Series In TChart1.Series
If (TypeOf b Is Steema.TeeChart.Styles.Bar) Then
CType(b, Steema.TeeChart.Styles.Bar).MultiBar = Steema.TeeChart.Styles.MultiBars.Side
End If
Next
End Sub
Regarding the other issues, what about searching here?
http://www.teechart.net/support/search. ... or=9637396
Is that the issue?
http://www.teechart.net/support/viewtopic.php?t=6422
Thanks in advance.