Page 1 of 2
how can i adjust width of the bar with respect to each serie
Posted: Mon Sep 11, 2006 4:17 pm
by 6925851
How can i adjust the width of the bar with respect to each series and each bar
i want to have different bar widths in each series in each y value
i want to have different bar widths for each series in each y value
for example
i have 3 series ,a b & c in a bar graph
for a barwidth is kept 40
for b bar width is 30
for c bar width is 100
barwidth option changes for all values of y axis , i need to different bar widths for different y values
pls advise me
aravind
i have posted sample tee file
Posted: Mon Sep 11, 2006 4:23 pm
by 6925851
i have posted sample tee file in group
Posted: Tue Sep 12, 2006 8:45 am
by narcis
Hi Aravind,
Have you tried setting the BarWidthPercent for each of the series? For example:
Code: Select all
TChart1.Series(0).asBar.BarWidthPercent = 70
bar width for in a series
Posted: Tue Sep 12, 2006 12:58 pm
by 6925851
enclosing a bar graph with 3 bars drawn in it ( posted in newsgroup)
for example :
x values are 10 ,950,1350
bar plotted at x=10 should have size corresponding to its value
bar plotted at 950 should have 90% size ...
how to set differenct bar sizes in a series .....
thx
aravind
Posted: Tue Sep 12, 2006 2:53 pm
by narcis
Hi Aravind,
Ok, now I understand what you are looking for. Then you can try doing something like this:
Code: Select all
Private Sub Form_Load()
Me.TeeCommander1.Chart = Me.TChart1
TChart1.Import.LoadFromFile "e:\temp\samplebargraph.tee"
TChart1.Environment.InternalRepaint
End Sub
Private Sub TChart1_OnBeforeDrawSeries()
With TChart1.Series(0)
For i = 0 To .Count - 1
.asBar.BarWidth = (.XValues.Value(i) / .XValues.Maximum) * 100
Next
End With
End Sub
Posted: Wed Sep 13, 2006 1:29 pm
by 6925851
bar width is changing but i have to insert my own calculations for bar width
if insert the below code , bar widths are not changing ..
With TChart1.Series(0)
For i = 0 To .Count - 1
Select Case i
Case 0
.asBar.BarWidth = 15
Case 1
.asBar.BarWidth = 35
Case 2
.asBar.BarWidth = 50
End Select
' .asBar.BarWidth = (.XValues.Value(i) / .XValues.Maximum) * 100
Next
End With
Posted: Mon Sep 18, 2006 8:30 am
by Pep
Hi Aravind,
I'm afraid there's no way to do this in the latest TeeChart Pro version, however it's on our wish list to be considered for the next releases.
In meantime a trick could be to use more than one Bar Series, each one with the desired barWidth.
can you give sample code to draw the trick
Posted: Thu Sep 21, 2006 11:46 am
by 6925851
can you give sample code to draw the trick
Posted: Mon Sep 25, 2006 10:37 am
by Pep
Hi,
you can do :
Code: Select all
Private Sub Form_Load()
With TChart1
.AddSeries scBar
.AddSeries scBar
.AddSeries scBar
.Series(0).Color = vbRed
.Series(1).Color = vbRed
.Series(2).Color = vbRed
.Series(0).AddXY 0, 10, "", clTeeColor
.Series(1).AddXY 1, 20, "", clTeeColor
.Series(2).AddXY 2, 30, "", clTeeColor
.Series(0).asBar.MultiBar = mbSideAll
.Series(0).asBar.BarWidth = 15
.Series(1).asBar.BarWidth = 35
.Series(2).asBar.BarWidth = 50
.Legend.LegendStyle = lsLastValues
End With
End Sub
Posted: Mon Sep 25, 2006 11:33 am
by 6925851
i need to set the widths of the first x value
for x=1 barwidth=10
for x=2 barwidth=30
for x=3 barwidth=100
not with respect to series
this is nothing but a carpetchart calculations ....
Posted: Mon Sep 25, 2006 1:47 pm
by narcis
Hi Aravind,
You should create one bar series for each X value, SelfStack the series and set a different BarWidth for each of them:
Code: Select all
Private Sub Form_Load()
For X = 0 To 3
TChart1.AddSeries scBar
TChart1.Series(X).asBar.MultiBar = mbSelfStack
TChart1.Series(X).asBar.BarWidth = 15 + (15 * X)
TChart1.Series(X).ColorEachPoint = True
TChart1.Series(X).Marks.Visible = False
For Y = 0 To 10
TChart1.Series(X).AddXY X, Rnd, "", clTeeColor
Next Y
Next X
End Sub
still having problems with barwidth for mulitple series
Posted: Thu Sep 28, 2006 11:58 am
by 6925851
i have enclosed a sample chart in xls file need to draw this chart ..
in the x-axis i have plotted a.b.c with 5 series ...
i need to have for a bar width for all 5 series should be 77.7
for b it is 16.8 and for c it should be 5.4 ( i.e. for a i should give 70% width , b 16 % width and c 5% width) but now i can create equal bar width in tchart ...
the sample code which is given by you does not suite my requirement ... because values are not been plotted correctly and also coloring each series becomes a issue ... if i set color for series entire bar becomes same color which is not correct for us because for bar @a there is 5 series plotted ...
your code :
For X = 0 To 1
TChart1.AddSeries scBar
TChart1.Series(X).asBar.MultiBar = mbSelfStack
TChart1.Series(X).asBar.BarWidth = 15 + (15 * X)
TChart1.Series(X).ColorEachPoint = True
TChart1.Series(X).Marks.Visible = False
For Y = 0 To 2
TChart1.Series(X).AddXY X, Y, Y, clTeeColor
Next Y
Next X
need code to adjust barwidth for each position at x-axis ...
Posted: Thu Sep 28, 2006 2:44 pm
by narcis
Hi Aravind,
I have posted an example at the newsgroups which creates a chart similar to your excel file.
I Cannot able to find it could you pls send me to this email
Posted: Thu Sep 28, 2006 2:48 pm
by 6925851
I Cannot able to find it could you pls send me to this email
asreenivasan@dtc-worldwide.com
Posted: Thu Sep 28, 2006 2:50 pm
by narcis
Hi Aravind,
Yes, just forwarded the message to your address.