Page 1 of 1

Making series bars displayed over other series transparent

Posted: Sat Jul 03, 2004 8:42 pm
by 6921448
I'm trying to produce a bar series that is transparent (i.e. does not cover the existing multiple series already present on the chart). The data in the series that needs to be transparent is derived from previous series already displayed on the chart. I have tried a number of different ways of doing this without any success. My application does not require this to be done at run time, but Ihave not found a way to do this in the design GUI either. I'm using TeeChart ActiveX version 5.0.5.0 Some of the methods I have tried are below. Any help would be appreciated.

'.Series(46).asBar.BarPen.Style = psClear


'.Series(46).TRANSPARENT


'.Series(46).asBar.BarBrush.Style = bsClear
'.Series(46).asBar.BarBrush.Color = vbBlue

I have also tried suppresing the display of the previous series until after this series is displayed. None of the methods I have tried have worked.

Posted: Mon Jul 05, 2004 9:50 am
by Pep
Hi,

it works fine here using the following code with the TeeChart Pro v5.06. I'm able to see the Bar transparent over the Line Series, could you please test if it works fine for you ?

Posted: Mon Jul 05, 2004 9:50 am
by Pep
Forgot the code .

Code: Select all

Private Sub Form_Load()
With TChart1
    .AddSeries scLine
    .Series(0).FillSampleValues (5)
    .AddSeries scBar
    .Series(1).FillSampleValues (5)
    .Series(1).asBar.BarBrush.Style = bsClear
End With
End Sub

Posted: Mon Jul 05, 2004 1:09 pm
by 6921448
Hi Josep,

When I use this code ( .Series(46).asBar.BarBrush.Style = bsClear)
the bar is not visible at all on the chart. All the other line series are visible. Any other ideas. I have also tried repositioning the order of the bar series in the list which also does not work.

Posted: Mon Jul 05, 2004 1:23 pm
by Pep
Hi,

most likely the problem is you've set the linepen style to psClear. Using the following code you should be able to see the red line series and over it, the bar Series with only the Pen visible :

Code: Select all

Private Sub Form_Load()
With TChart1
    .AddSeries scLine
    .Series(0).FillSampleValues (5)
    .AddSeries scBar
    .Series(1).FillSampleValues (5)
    .Series(1).asBar.BarBrush.Style = bsClear
    .Series(1).asBar.BarPen.Style = psSolid
End With
End Sub

Posted: Mon Jul 05, 2004 2:11 pm
by 6921448
Hi Josep,

Still no success. I added

.Series(46).asBar.BarBrush.Style = bsClear
.Series(46).asBar.BarPen.Style = psSolid

and the bars are still not visible although the line and candle series are visible. The bars are visible, but cover the other line series when the above code is deleted. If I reverse the code to

.Series(46).asBar.BarBrush.Style = bsSolid
.Series(46).asBar.BarPen.Style = psClear

I get the same. No bars visible but all line and candle series are visible.

Any more ideas?
Thanks!

Posted: Mon Jul 05, 2004 3:08 pm
by 6921448
Hi Josep,

Listed below is the code for the proceedure that I am trying to get to work. Everything but the transparent bars on the last one Series(46) work well. Hopefully this will stimulate an idea.

Best regards,

Private Sub cmdAI_Click()
cmdDelLine_click

TChart1.Axis.Right.Title.Visible = True
TChart1.Axis.Left.GridPen.Visible = False
TChart1.Axis.Left.Labels.Visible = False
TChart1.Panel.MarginLeft = 5


chartflag = 4

If AIfil = "" Then
SelectAIsub
AIfil = frmChart.Text2.Text
End If

' Dim array for AstroIndicator
Dim gDateAI(10000) As String, gOpenAI(10000) As Double, _
gHighAI(10000) As Double, gLowAI(10000) As Double, gCloseAI(10000) _
As Double, gVolAI(10000) As Double

TChart1.Axis.Custom(0).GridPen.Visible = False

On Error Resume Next

'TChart1.Tools.Items(0).Active = True
TChart1.Tools.Items(1).Active = False
TChart1.Tools.Items(2).Active = False
TChart1.Tools.Items(3).Active = False
TChart1.Tools.Items(4).Active = False
TChart1.Tools.Items(5).Active = False
TChart1.Tools.Items(6).Active = True
TChart1.Tools.Items(7).Active = True
TChart1.Tools.Items(8).Active = True
TChart1.Tools.Items(9).Active = False
TChart1.Tools.Items(10).Active = True



' Enable/Disable chart buttons
cmdBchart.Enabled = True
cmdAchart.Enabled = True
cmdCchart.Enabled = True
cmdAI.Enabled = False

' Disable or clear unneeded data series
TChart1.Series(5).Clear
TChart1.Series(6).Clear
TChart1.Series(7).Clear
TChart1.Series(8).Clear
TChart1.Series(9).Clear
TChart1.Series(9).FunctionType.asBollinger.LowBand.Clear
TChart1.Series(10).Clear
TChart1.Series(12).Clear
TChart1.Series(13).Clear
TChart1.Series(14).Clear
TChart1.Series(15).Clear
TChart1.Series(16).Clear
TChart1.Series(17).Clear
TChart1.Series(18).Clear
TChart1.Series(19).Clear
TChart1.Series(20).Clear
TChart1.Series(21).Clear
TChart1.Series(22).Clear
TChart1.Series(23).Clear
TChart1.Series(39).Clear
TChart1.Series(45).Clear
TChart1.Series(46).Clear

For ser1 = 0 To 46
TChart1.Series(ser1).Active = False
Next ser1

TChart1.Series(24).Active = True
TChart1.Series(25).Active = True
TChart1.Series(26).Active = True
TChart1.Series(28).Active = True
TChart1.Series(30).Active = True
TChart1.Series(40).Active = True
'TChart1.Series(45).Active = True
TChart1.Series(46).Active = True

' Draw candle chart
t = 0
z = 0
With TChart1
.AddSeries scCandle
.Series(24).Clear
.Series(24).asCandle.Dark3D = True
If chartdays <= 100 Then .Series(24).asCandle.CandleWidth = 5
If chartdays > 100 And chartdays <= 200 Then .Series(24).asCandle.CandleWidth = 4
If chartdays > 200 And chartdays <= 300 Then .Series(24).asCandle.CandleWidth = 3
If chartdays > 300 And chartdays <= 400 Then .Series(24).asCandle.CandleWidth = 2
If chartdays > 400 Then .Series(24).asCandle.CandleWidth = 1
If mutual = 1 Then .Series(24).asCandle.DownCloseColor = vbBlack: .asCandle.UpCloseColor = vbBlue
For t = IZ - (chartdays + 1) To IZ - 1
.Series(24).asCandle.AddCandle DateValue(gDate(t)), gOpen(t), gHigh(t), gLow(t), gClose(t)
Next t
begindate = DateValue((gDate(IZ - (chartdays + 1))))
stopdate = DateValue(gDate(IZ - 1)) + 90
.Series(24).VerticalAxis = TChart1.Axis.Custom(3)
End With

' Draw AstroIndicator chart

If Dir(".\" + AIfil) <> "" Then

ix = 0
t = 0
z = 0
Open ".\" + AIfil For Input As #11
With TChart1
.AddSeries scBar
.Series(25).VerticalAxis = aRightAxis
.Series(25).Color = &H80000011
If chartdays <= 100 Then .Series(25).asBar.BarPen.Width = 5
If chartdays > 100 And chartdays <= 200 Then .Series(25).asBar.BarPen.Width = 4
If chartdays > 200 And chartdays <= 300 Then .Series(25).asBar.BarPen.Width = 3
If chartdays > 300 And chartdays <= 400 Then .Series(25).asBar.BarPen.Width = 2
If chartdays > 400 Then .Series(25).asBar.BarPen.Width = 1
.Axis.Right.StartPosition = 80
.Axis.Right.EndPosition = 100
.Axis.Left.StartPosition = 0
.Axis.Left.EndPosition = 80
.Series(25).asBar.UseOrigin = True

Do Until EOF(11)
Input #11, gDateAI(ix), gOpenAI(ix), gHighAI(ix), gLowAI(ix), gCloseAI(ix), gVolAI(ix)
.Series(25).asBar.Origin = gOpenAI(ix)
If DateValue(gDateAI(ix)) > stopdate Then stopdate = DateValue(gDateAI(ix))
If DateValue(gDateAI(ix)) >= begindate Then
If DateValue(gDateAI(ix)) >= stopdate Then Exit Do
.Series(25).AddXY DateValue(gDateAI(ix)), gCloseAI(ix), "", &H80000011
End If
ix = ix + 1
Loop
Close

.AddSeries scLine
.Series(26).VerticalAxis = aRightAxis
.Series(26).SetFunction tfExpMovAvg 'tfMovavg
.Series(26).DataSource = "Series25"
.Series(26).FunctionType.Period = 14 '8
.Series(26).Color = vbCyan
.Series(26).asLine.LinePen.Width = 1


End With

Else
MsgBox AIfil + " missing from default folder."
End If

'Draw Bradley chart
If Dir(".\Bradley.txt") <> "" Then

ix1 = 0
Open ".\Bradley.txt" For Input As #11
With TChart1
.AddSeries scBar
.AddSeries scBar

Do Until EOF(11)
Input #11, gDateAI(ix1), gOpenAI(ix1), gHighAI(ix1), gLowAI(ix1), gCloseAI(ix1), gVolAI(ix1)
.Series(27).asBar.Origin = gCloseAI(ix1)
.Series(29).asBar.Origin = gOpenAI(ix1)
If DateValue(gDateAI(ix1)) > stopdate Then stopdate = DateValue(gDateAI(ix1))
If DateValue(gDateAI(ix1)) >= begindate Then
If DateValue(gDateAI(ix1)) >= stopdate Then Exit Do
.Series(27).AddXY DateValue(gDateAI(ix1)), gCloseAI(ix1), "", &H8000&
.Series(29).AddXY DateValue(gDateAI(ix1)), gOpenAI(ix1), "", vbRed
.Series(39).AddXY DateValue(gDateAI(ix1)), (gCloseAI(ix1) + gOpenAI(ix1)) / 2, "", vbBlue
End If
ix1 = ix1 + 1
Loop
Close

.AddSeries scLine
.Series(28).VerticalAxis = TChart1.Axis.Custom(3)
.Series(28).SetFunction tfExpMovAvg
.Series(28).DataSource = "Series27"
.Series(28).FunctionType.Period = 2 '8
.Series(28).Color = &H8000&
.Series(28).asLine.LinePen.Width = 2

.AddSeries scLine
.Series(30).VerticalAxis = TChart1.Axis.Custom(3)
.Series(30).SetFunction tfExpMovAvg
.Series(30).DataSource = "Series29"
.Series(30).FunctionType.Period = 1
.Series(30).Color = vbRed
.Series(30).asLine.LinePen.Width = 2

.AddSeries scLine
.Series(40).VerticalAxis = TChart1.Axis.Custom(3)
.Series(40).SetFunction tfExpMovAvg
.Series(40).DataSource = "Series39"
.Series(40).FunctionType.Period = 1
.Series(40).Color = vbBlue
.Series(40).asLine.LinePen.Width = 2

End With

Else
MsgBox "Bradley file missing from default folder."
End If

Open ".\Brad2.txt" For Output As #12

With TChart1

.AddSeries scLine
ix3 = 0
.Series(45).SetFunction tfMomentum
.Series(45).DataSource = "Series39"
.Series(45).FunctionType.Period = 2
.Series(45).Color = vbBlue

For ix3 = 1 To .Series(39).Count - 3
zzzn = (.Series(45).XValues.Value(ix3 + 1))
zzzc = Abs(.Series(45).YValues.Value(ix3 + 1) - .Series(45).YValues.Value(ix3))
Write #12, (zzzn), zzzc
Next ix3
Close #12

TChart1.Series(45).Clear
Dim ccv1(1000), ccv2(1000)

If Dir(".\Brad2.txt") <> "" Then

.AddSeries scBar
ix3 = 0
.Series(46).VerticalAxis = aLeftAxis

If chartdays <= 100 Then .Series(46).asBar.BarPen.Width = 5
If chartdays > 100 And chartdays <= 200 Then .Series(46).asBar.BarPen.Width = 4
If chartdays > 200 And chartdays <= 300 Then .Series(46).asBar.BarPen.Width = 3
If chartdays > 300 And chartdays <= 400 Then .Series(46).asBar.BarPen.Width = 2
If chartdays > 400 Then .Series(46).asBar.BarPen.Width = 1
Width = 1
Open ".\Brad2.txt" For Input As #12
Do Until EOF(12)
Input #12, ccv1(ix3), ccv2(ix3)

If (ccv1(ix3)) > stopdate Then stopdate = (ccv1(ix3))
If (ccv1(ix3)) >= begindate Then
If (ccv1(ix3)) >= stopdate Then Exit Do
End If
ix3 = ix3 + 1
Loop
Close #12


DArg = 3.75
For ix4 = 0 To ix3 - 1
If ccv2(ix4 + 1) <> 0 Then
Dval1 = ccv2(ix4 + 1)
Else
Dval1 = 0.000000001
End If

'If (((ccv2(ix4 + 1) - ccv2(ix4)) / Dval1) * 100) < DArg * (((ccv2(ix4 + 1) - ccv2(ix4 + 2)) / Dval1) * 100) Then
If (ccv2(ix4 + 1) - ccv2(ix4)) > DArg * ccv2(ix4) Then
DvalMax = .Axis.Left.Maximum
Else
DvalMax = .Axis.Left.Minimum
End If

.Series(46).AddXY (ccv1(ix4)), DvalMax, "", vbBlue '&HE0E0E0
Next ix4

Else
MsgBox "Error calculating A-Bradley Momentum Breaks."
End If

End With


' Show last day's price data on chart
With TChart1
txtData.Text = gDate(IZ - 1) & "; " & "[O]" & Format(.Series(24).asCandle.OpenValues.Value(.Series(24).Count - 1), " #####.00") & _
"; [H]" & Format(.Series(24).asCandle.HighValues.Value(.Series(24).Count - 1), " #####.00") & "; [L]" & _
Format(.Series(24).asCandle.LowValues.Value(.Series(24).Count - 1), " #####.00") & "; [C]" & _
Format(.Series(24).asCandle.CloseValues.Value(.Series(24).Count - 1), " #####.00")
End With

frmChart.Text2.Text = ""

End Sub

Posted: Thu Jul 08, 2004 9:42 am
by Pep
Hi ,

I cannot find which is the problem here. Could you please post an example with which I can reproduce "as is" the problem here into the steema.public.attachments newsgroup ?

Posted: Thu Jul 08, 2004 12:43 pm
by 6921448
Hi Josep,

I have previously submitted the entire procedure to this forum where the problem lies for your evaluation.

TChart1.Series(24)
TChart1.Series(25)
TChart1.Series(26)
TChart1.Series(27)
TChart1.Series(28)
TChart1.Series(29)
TChart1.Series(30)
TChart1.Series(39)
TChart1.Series(40)
TChart1.Series(45)

All the above series are displayed on the chart with the exception of TChart1.Series (45) which is basically used for calculation of the momentum used in TChart1.Series (46) . This is the bar series (46) that I have not been able to make transparent which displays over the previous candle and line series and disrupts their presentation. Since Series(46) is derived from previous series (45 and 39) changing the sequence in the series list or rearranging the code to draw series 46 first on the chart apparently is not possible. I have tried that and none of the series with the exception of Series 25 are displayed on the chart. Series 25 is displayed in the bottom panel and is not involved with the problem. All the other series displayed are in the top panel. You should be able to replace the data values obtained from the files with random numbers to simulate the data to use in the respective series.

I have also upgraded to version 5.0.6 and the problem still exists.

I don't know how to make the problem more clear to you than providing you with the exact code that results in the problem. Could you show the code to David, Marc or Chris Ireland and get their opinion?

Best regards,

Posted: Wed Jul 14, 2004 10:06 am
by Chris
Hi --
You should be able to replace the data values obtained from the files with random numbers to simulate the data to use in the respective series.
<snip>
I don't know how to make the problem more clear to you than providing you with the exact code that results in the problem. Could you show the code to David, Marc or Chris Ireland and get their opinion?
OK, I've seen the code and in order to speed up the turn around time of this problem it really would be greatly appreciated if you could post an example I can run "as-is" to the newsgroup:
news://www.berneda.com/steema.public.attachments

Many thanks for your continuing cooperation.

Posted: Thu Jul 15, 2004 3:03 pm
by 6921448
Hi Chris,

I can send you the complete module with the additonal files that you will need in a zip archive for you to see exactly what the problem might be with the bar transparency. I do not wish to post the whole module to the newsgroup for all to see. Provide me with a private e-mail address that I can send the files to without blasting all my code all over the internet.

Best regards

Posted: Thu Jul 15, 2004 4:44 pm
by Pep
Hi,

you can send it directly to my email account pep@steema.com and we'll take a look.